From 708ee684141dd67b78adc0749d8ecd41bdfafc12 Mon Sep 17 00:00:00 2001 From: marko-kraemer Date: Sat, 12 Apr 2025 16:13:38 +0100 Subject: [PATCH] simplify web search tool --- backend/agent/tools/web_search_tool.py | 103 +++---------------------- 1 file changed, 12 insertions(+), 91 deletions(-) diff --git a/backend/agent/tools/web_search_tool.py b/backend/agent/tools/web_search_tool.py index 01440ec5..706997a5 100644 --- a/backend/agent/tools/web_search_tool.py +++ b/backend/agent/tools/web_search_tool.py @@ -35,36 +35,6 @@ class WebSearchTool(Tool): "description": "Whether to include a summary of each search result. Summaries provide key context about each page without requiring full content extraction. Set to true to get concise descriptions of each result.", "default": True }, - "start_published_date": { - "type": "string", - "description": "Optional start date to filter results by publication date (ISO format YYYY-MM-DDTHH:MM:SS.sssZ). Use this to find content published after a specific date, useful for recent news or updated information." - }, - "end_published_date": { - "type": "string", - "description": "Optional end date to filter results by publication date (ISO format YYYY-MM-DDTHH:MM:SS.sssZ). Use this to limit results to content published before a specific date, helpful for historical information." - }, - "start_crawl_date": { - "type": "string", - "description": "Optional start date to filter results by when they were crawled (ISO format YYYY-MM-DDTHH:MM:SS.sssZ). This can be useful for finding content that was recently indexed by search engines." - }, - "end_crawl_date": { - "type": "string", - "description": "Optional end date to filter results by when they were crawled (ISO format YYYY-MM-DDTHH:MM:SS.sssZ). This can help filter out potentially outdated content." - }, - "include_text": { - "type": "array", - "items": { - "type": "string" - }, - "description": "A list of terms that must be included in the search results. Use this to ensure results contain specific keywords, making them more relevant to the query." - }, - "exclude_text": { - "type": "array", - "items": { - "type": "string" - }, - "description": "A list of terms that must be excluded from the search results. Use this to filter out irrelevant content or focus the search away from certain topics." - }, "num_results": { "type": "integer", "description": "The number of search results to return. Increase for more comprehensive research or decrease for focused, high-relevance results.", @@ -80,46 +50,32 @@ class WebSearchTool(Tool): mappings=[ {"param_name": "query", "node_type": "attribute", "path": "."}, {"param_name": "summary", "node_type": "attribute", "path": "."}, - {"param_name": "start_published_date", "node_type": "attribute", "path": "."}, - {"param_name": "end_published_date", "node_type": "attribute", "path": "."}, - {"param_name": "start_crawl_date", "node_type": "attribute", "path": "."}, - {"param_name": "end_crawl_date", "node_type": "attribute", "path": "."}, - {"param_name": "include_text", "node_type": "attribute", "path": "."}, - {"param_name": "exclude_text", "node_type": "attribute", "path": "."}, {"param_name": "num_results", "node_type": "attribute", "path": "."} ], example=''' - + - + + num_results="20"> ''' ) @@ -127,12 +83,6 @@ class WebSearchTool(Tool): self, query: str, summary: bool = True, - start_published_date: Optional[str] = None, - end_published_date: Optional[str] = None, - start_crawl_date: Optional[str] = None, - end_crawl_date: Optional[str] = None, - include_text: Optional[List[str]] = None, - exclude_text: Optional[List[str]] = None, num_results: int = 20 ) -> ToolResult: """ @@ -149,18 +99,9 @@ class WebSearchTool(Tool): - Published Date: When the content was published (if available) - Score: The relevance score of the result - Use this function to discover relevant web pages before potentially - using crawl_webpage to extract their complete content. - Parameters: - query: The search query to find relevant web pages - summary: Whether to include a summary of the results (default: True) - - start_published_date: Optional start date for published results (ISO format) - - end_published_date: Optional end date for published results (ISO format) - - start_crawl_date: Optional start date for crawled results (ISO format) - - end_crawl_date: Optional end date for crawled results (ISO format) - - include_text: List of terms that must be included in the results - - exclude_text: List of terms that must be excluded from the results - num_results: The number of results to return (default: 20) """ try: @@ -255,27 +196,7 @@ class WebSearchTool(Tool): example='''