feat: enhance websearch functionality with reasoning-based approach

- Changed use_websearch default from False to True for all tools
- Redesigned websearch behavior to focus on reasoning rather than direct search
- Tools now analyze when web searches would be helpful and recommend specific searches
- Updated all tool-specific websearch instructions to be more thoughtful
- Gemini will now suggest what Claude should search for and explain why

Key improvements:
- Web search is now enabled by default for better documentation awareness
- Instead of performing searches, Gemini reasons about what searches would help
- Provides specific search recommendations for Claude to execute
- More collaborative approach between Gemini and Claude

This change makes the tools more intelligent about when external information
would be valuable while keeping Claude in control of actual web searches.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Fahad
2025-06-10 12:45:57 +04:00
parent ba8f7192c3
commit 3d958ef7e9
7 changed files with 33 additions and 21 deletions

View File

@@ -165,18 +165,30 @@ class BaseTool(ABC):
base_instruction = """
WEB SEARCH ENABLED: Feel free to perform appropriate web searches to enhance your analysis."""
WEB SEARCH REASONING: As you analyze this request, consider whether web searches would enhance your response.
If you identify areas where current documentation, API references, or community solutions would be valuable,
please note in your response what specific searches Claude should perform and why they would be helpful."""
if tool_specific:
return f"{base_instruction} {tool_specific}"
return f"{base_instruction}
{tool_specific}
In your response, if web searches would be beneficial, include a section like:
**Recommended Web Searches for Claude:**
- [Specific topic/framework/library] - to verify/understand/confirm [specific aspect]
- [Another search topic] - to explore [specific concern or feature]"""
# Default instruction for all tools
return f"""{base_instruction} Search for:
return f"""{base_instruction}
Consider searches for:
- Current documentation and best practices
- Similar issues and community solutions
- Similar issues and community solutions
- API references and usage examples
- Recent developments and updates
Consider relevant findings when formulating your response."""
If any of these would strengthen your analysis, specify what Claude should search for and why."""
@abstractmethod
def get_request_model(self):