Building AI agents, atomically
max_results change in fetch_search
[email protected]f1f0ebd983cd
diff --git a/atomic-forge/tools/tavily_search/tool/tavily_search.py b/atomic-forge/tools/tavily_search/tool/tavily_search.pyindex ddd2219..687967e 100644--- a/atomic-forge/tools/tavily_search/tool/tavily_search.py+++ b/atomic-forge/tools/tavily_search/tool/tavily_search.py@@ -93,7 +93,7 @@ class TavilySearchTool(BaseTool):self.include_answer = config.include_answerself.include_raw_content = config.include_raw_content- async def _fetch_search_results(self, session: aiohttp.ClientSession, query: str) -> List[dict]:+ async def _fetch_search_results(self, session: aiohttp.ClientSession, query: str, max_results: Optional[int]) -> List[dict]:headers = {"accept": "/","content-type": "application/json",@@ -111,7 +111,7 @@ class TavilySearchTool(BaseTool):"include_answer": self.include_answer,"include_raw_content": self.include_raw_content,"include_domains": self.include_domains,- "max_results": self.max_results,+ "max_results": max_results,}async with session.post("https://api.tavily.com/search", headers=headers, json=json_data) as response:@@ -137,7 +137,7 @@ class TavilySearchTool(BaseTool):) -> TavilySearchToolOutputSchema:async with aiohttp.ClientSession() as session:# Fetch results for all queries- tasks = [self._fetch_search_results(session, query) for query in params.queries]+ tasks = [self._fetch_search_results(session, query, max_results if max_results is not None else self.max_results) for query in params.queries]raw_results = await asyncio.gather(*tasks)# Process results for each query