Skip to content

[Bug Fix] Perplexity - LiteLLM doesn't support 'web_search_options' for Perplexity' Sonar Pro model #11983

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 23, 2025

Conversation

ishaan-jaff
Copy link
Contributor

@ishaan-jaff ishaan-jaff commented Jun 23, 2025

[Bug Fix] Perplexity - LiteLLM doesn't support 'web_search_options' for Perplexity' Sonar Pro model

Fixes #11976

Relevant issues

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

Type

🐛 Bug Fix
✅ Test

Changes

Copy link

vercel bot commented Jun 23, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
litellm ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 23, 2025 5:11pm

@ishaan-jaff ishaan-jaff requested a review from Copilot June 23, 2025 17:07
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a missing web_search_options parameter for Perplexity Sonar models (including Sonar Pro) and adds a unit test to verify it.

  • Append web_search_options in get_supported_openai_params when supported
  • Add a pytest to ensure the new parameter is included for both perplexity/sonar and perplexity/sonar-pro

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/test_litellm/llms/perplexity/test_perplexity.py New test to assert web_search_options is in supported params
litellm/llms/perplexity/chat/transformation.py Updated to append web_search_options when supports_web_search is true
Comments suppressed due to low confidence (2)

tests/test_litellm/llms/perplexity/test_perplexity.py:20

  • [nitpick] The docstring mentions only 'Perplexity sonar models' but the test also covers 'sonar-pro'. Consider updating it to reflect both model names for clarity.
        Test that web_search_options is in the list of supported parameters for Perplexity sonar models

@ishaan-jaff ishaan-jaff merged commit ef7f8cc into main Jun 23, 2025
21 of 46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: LiteLLM doesn't support 'web_search_options' for Perplexity' Sonar Pro model
1 participant