Align Tavily Search schema with current API behavior#2720
Align Tavily Search schema with current API behavior#2720yasu-oh wants to merge 6 commits intolanggenius:mainfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on improving the reliability and usability of the Tavily Search tool by updating its schema to accurately reflect the underlying API's behavior. The changes primarily involve enhancing parameter descriptions and clarifying usage constraints, which will lead to more precise and predictable tool calls by large language models. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request updates the Tavily Search tool's YAML schema to improve clarity and align with the current API, particularly for LLM consumption. The changes refine parameter descriptions and constraints, such as clarifying the relationship between time range and specific date parameters. While the schema updates are beneficial, I've identified a potential inconsistency where a description for chunks_per_source was updated to include 'fast' search, but the corresponding default-handling logic in the Python implementation was not updated, which could lead to unexpected behavior.
| en_US: Chunks Per Source | ||
| zh_Hans: 每来源片段数 | ||
| llm_description: Maximum number of relevant content chunks (1-3) returned per source. Valid only when search_depth is advanced. | ||
| llm_description: Maximum number of relevant content chunks (1-3) returned per source. Valid when search_depth is 'advanced' or 'fast'. |
There was a problem hiding this comment.
This description update correctly reflects that chunks_per_source is valid for 'fast' search. However, the backing implementation in tools/tavily/tools/tavily_search.py appears to be inconsistent with this change. The _process_params method only sets a default value for chunks_per_source when search_depth is 'advanced':
# tools/tavily/tools/tavily_search.py:111-112
if processed_params.get("search_depth") == "advanced":
processed_params.setdefault("chunks_per_source", 3)This logic does not include the 'fast' search depth. As a result, the default value for chunks_per_source will not be applied for 'fast' searches, which may lead to behavior that is inconsistent with the updated description. Please consider aligning the Python code with this schema change.
|
Hi maintainers, just a gentle follow-up on this PR. If there are any issues with the approach, implementation, or scope, please feel free to let me know directly. I’d really appreciate any feedback, and I’m happy to revise the PR if needed. Thanks for your time and review. |
Related Issues or Context
This PR updates the Tavily Search tool schema to better align with the current Tavily Search API and improve LLM tool-call reliability.
Changes include:
chunks_per_sourcedescriptions foradvancedandfasttime_range/start_date/end_dateconstraintscountryparameter guidance so exact option values are used