From 349e80d06ad08faea293ec3de28a504cc04cf063 Mon Sep 17 00:00:00 2001 From: anigasan Date: Thu, 3 Jul 2025 12:21:28 -0700 Subject: [PATCH] Changed config and tavily_search for tavily API --- .../providers/remote/tool_runtime/tavily_search/config.py | 2 +- .../remote/tool_runtime/tavily_search/tavily_search.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/llama_stack/providers/remote/tool_runtime/tavily_search/config.py b/llama_stack/providers/remote/tool_runtime/tavily_search/config.py index b4ddd9cb4..e3046343e 100644 --- a/llama_stack/providers/remote/tool_runtime/tavily_search/config.py +++ b/llama_stack/providers/remote/tool_runtime/tavily_search/config.py @@ -26,7 +26,7 @@ class TavilySearchToolConfig(BaseModel): @classmethod def sample_run_config(cls, __distro_dir__: str) -> dict[str, Any]: return { - "api_key": "${env.TAVILY_SEARCH_API_KEY:=}", + "api_key": "${env.TAVILY_SEARCH_API_KEY:+}", "max_results": 3, "timeout": 30.0, } diff --git a/llama_stack/providers/remote/tool_runtime/tavily_search/tavily_search.py b/llama_stack/providers/remote/tool_runtime/tavily_search/tavily_search.py index 5158f4d40..e8ca36cf4 100644 --- a/llama_stack/providers/remote/tool_runtime/tavily_search/tavily_search.py +++ b/llama_stack/providers/remote/tool_runtime/tavily_search/tavily_search.py @@ -69,9 +69,10 @@ class TavilySearchToolRuntimeImpl(ToolGroupsProtocolPrivate, ToolRuntime, NeedsR async def invoke_tool(self, tool_name: str, kwargs: dict[str, Any]) -> ToolInvocationResult: api_key = self._get_api_key() - - timeout = httpx.Timeout(timeout=self.config.timeout) - + + # Configure timeout for external API calls using config values + timeout = httpx.Timeout(timeout=self.config.timeout, connect=self.config.connect_timeout) + async with httpx.AsyncClient(timeout=timeout) as client: response = await client.post( "https://api.tavily.com/search",