From 5f94ed56c566935a7b7b7fe254dfb380c67b50b6 Mon Sep 17 00:00:00 2001 From: anigasan Date: Thu, 3 Jul 2025 12:21:28 -0700 Subject: [PATCH 1/6] Changed config and tavily_search for tavily API --- .../remote/tool_runtime/tavily_search/config.py | 12 +++++++++++- .../tool_runtime/tavily_search/tavily_search.py | 6 +++++- 2 files changed, 16 insertions(+), 2 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 ca4e615db..28f7c3d3c 100644 --- a/llama_stack/providers/remote/tool_runtime/tavily_search/config.py +++ b/llama_stack/providers/remote/tool_runtime/tavily_search/config.py @@ -18,10 +18,20 @@ class TavilySearchToolConfig(BaseModel): default=3, description="The maximum number of results to return", ) + timeout: float = Field( + default=30.0, + description="HTTP request timeout in seconds", + ) + connect_timeout: float = Field( + default=10.0, + description="HTTP connection timeout in seconds", + ) @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, + "connect_timeout": 10.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 1fe91fd7f..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,7 +69,11 @@ class TavilySearchToolRuntimeImpl(ToolGroupsProtocolPrivate, ToolRuntime, NeedsR async def invoke_tool(self, tool_name: str, kwargs: dict[str, Any]) -> ToolInvocationResult: api_key = self._get_api_key() - async with httpx.AsyncClient() as client: + + # 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", json={"api_key": api_key, "query": kwargs["query"]}, From 7201bdaee44ca1c6fe09bb55f0a421221fa8867d Mon Sep 17 00:00:00 2001 From: anigasan Date: Fri, 4 Jul 2025 11:48:47 -0700 Subject: [PATCH 2/6] config file changes --- .../providers/remote/tool_runtime/tavily_search/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 28f7c3d3c..30d29d34b 100644 --- a/llama_stack/providers/remote/tool_runtime/tavily_search/config.py +++ b/llama_stack/providers/remote/tool_runtime/tavily_search/config.py @@ -30,7 +30,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, "connect_timeout": 10.0, From ef332c296e08ae764d030bcf35c07e9e6421cbec Mon Sep 17 00:00:00 2001 From: anigasan Date: Sun, 6 Jul 2025 12:52:47 -0700 Subject: [PATCH 3/6] commits --- .../remote/tool_runtime/tavily_search/config.py | 6 +++--- .../remote/tool_runtime/tavily_search/tavily_search.py | 9 ++++----- 2 files changed, 7 insertions(+), 8 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 30d29d34b..ae7b41d50 100644 --- a/llama_stack/providers/remote/tool_runtime/tavily_search/config.py +++ b/llama_stack/providers/remote/tool_runtime/tavily_search/config.py @@ -20,11 +20,11 @@ class TavilySearchToolConfig(BaseModel): ) timeout: float = Field( default=30.0, - description="HTTP request timeout in seconds", + description="HTTP request timeout for the API", ) connect_timeout: float = Field( default=10.0, - description="HTTP connection timeout in seconds", + description="HTTP connection timeout in seconds for the API", ) @classmethod @@ -32,6 +32,6 @@ class TavilySearchToolConfig(BaseModel): return { "api_key": "${env.TAVILY_SEARCH_API_KEY:=}", "max_results": 3, - "timeout": 30.0, + "timeout:" 30.0, "connect_timeout": 10.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 e8ca36cf4..cdaf78d4a 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,11 +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() - - # 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: + + timeout = https.Timeout(timeout=self.config.timeout, connect=self.config.connect_timeout) + + async with httpx.AsyncClient() as client: response = await client.post( "https://api.tavily.com/search", json={"api_key": api_key, "query": kwargs["query"]}, From e679cd02617404c3267e882a932b392bf71e3e3e Mon Sep 17 00:00:00 2001 From: anigasan Date: Sun, 6 Jul 2025 18:44:27 -0700 Subject: [PATCH 4/6] more commits --- docs/source/providers/tool_runtime/remote_tavily-search.md | 4 ++++ .../providers/remote/tool_runtime/tavily_search/config.py | 2 +- .../remote/tool_runtime/tavily_search/tavily_search.py | 2 +- llama_stack/templates/bedrock/run.yaml | 2 ++ llama_stack/templates/cerebras/run.yaml | 2 ++ llama_stack/templates/ci-tests/run.yaml | 2 ++ llama_stack/templates/dell/run-with-safety.yaml | 2 ++ llama_stack/templates/dell/run.yaml | 2 ++ llama_stack/templates/fireworks/run-with-safety.yaml | 2 ++ llama_stack/templates/fireworks/run.yaml | 2 ++ llama_stack/templates/groq/run.yaml | 2 ++ llama_stack/templates/hf-endpoint/run-with-safety.yaml | 2 ++ llama_stack/templates/hf-endpoint/run.yaml | 2 ++ llama_stack/templates/hf-serverless/run-with-safety.yaml | 2 ++ llama_stack/templates/hf-serverless/run.yaml | 2 ++ llama_stack/templates/llama_api/run.yaml | 2 ++ llama_stack/templates/meta-reference-gpu/run-with-safety.yaml | 2 ++ llama_stack/templates/meta-reference-gpu/run.yaml | 2 ++ llama_stack/templates/ollama/run-with-safety.yaml | 2 ++ llama_stack/templates/ollama/run.yaml | 2 ++ llama_stack/templates/open-benchmark/run.yaml | 2 ++ llama_stack/templates/passthrough/run-with-safety.yaml | 2 ++ llama_stack/templates/passthrough/run.yaml | 2 ++ llama_stack/templates/postgres-demo/run.yaml | 2 ++ llama_stack/templates/remote-vllm/run-with-safety.yaml | 2 ++ llama_stack/templates/remote-vllm/run.yaml | 2 ++ llama_stack/templates/sambanova/run.yaml | 2 ++ llama_stack/templates/starter/run.yaml | 2 ++ llama_stack/templates/tgi/run-with-safety.yaml | 2 ++ llama_stack/templates/tgi/run.yaml | 2 ++ llama_stack/templates/together/run-with-safety.yaml | 2 ++ llama_stack/templates/together/run.yaml | 2 ++ llama_stack/templates/vllm-gpu/run.yaml | 2 ++ llama_stack/templates/watsonx/run.yaml | 2 ++ 34 files changed, 68 insertions(+), 2 deletions(-) diff --git a/docs/source/providers/tool_runtime/remote_tavily-search.md b/docs/source/providers/tool_runtime/remote_tavily-search.md index 3dc31534d..73ee4af46 100644 --- a/docs/source/providers/tool_runtime/remote_tavily-search.md +++ b/docs/source/providers/tool_runtime/remote_tavily-search.md @@ -10,12 +10,16 @@ Tavily Search tool for AI-optimized web search with structured results. |-------|------|----------|---------|-------------| | `api_key` | `str \| None` | No | | The Tavily Search API Key | | `max_results` | `` | No | 3 | The maximum number of results to return | +| `timeout` | `` | No | 30.0 | HTTP request timeout for the API | +| `connect_timeout` | `` | No | 10.0 | HTTP connection timeout in seconds for the API | ## Sample Configuration ```yaml api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 +timeout: 30.0 +connect_timeout: 10.0 ``` 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 ae7b41d50..ec409ab55 100644 --- a/llama_stack/providers/remote/tool_runtime/tavily_search/config.py +++ b/llama_stack/providers/remote/tool_runtime/tavily_search/config.py @@ -32,6 +32,6 @@ class TavilySearchToolConfig(BaseModel): return { "api_key": "${env.TAVILY_SEARCH_API_KEY:=}", "max_results": 3, - "timeout:" 30.0, + "timeout": 30.0, "connect_timeout": 10.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 cdaf78d4a..d89c9b101 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 @@ -70,7 +70,7 @@ 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 = https.Timeout(timeout=self.config.timeout, connect=self.config.connect_timeout) + httpx.Timeout(timeout=self.config.timeout, connect=self.config.connect_timeout) async with httpx.AsyncClient() as client: response = await client.post( diff --git a/llama_stack/templates/bedrock/run.yaml b/llama_stack/templates/bedrock/run.yaml index 068278c66..632fa5b02 100644 --- a/llama_stack/templates/bedrock/run.yaml +++ b/llama_stack/templates/bedrock/run.yaml @@ -85,6 +85,8 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 + timeout: 30.0 + connect_timeout: 10.0 - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} diff --git a/llama_stack/templates/cerebras/run.yaml b/llama_stack/templates/cerebras/run.yaml index 305e9a20f..bda867555 100644 --- a/llama_stack/templates/cerebras/run.yaml +++ b/llama_stack/templates/cerebras/run.yaml @@ -91,6 +91,8 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 + timeout: 30.0 + connect_timeout: 10.0 - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} diff --git a/llama_stack/templates/ci-tests/run.yaml b/llama_stack/templates/ci-tests/run.yaml index 5a68af3e6..6501fb7e5 100644 --- a/llama_stack/templates/ci-tests/run.yaml +++ b/llama_stack/templates/ci-tests/run.yaml @@ -89,6 +89,8 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 + timeout: 30.0 + connect_timeout: 10.0 - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} diff --git a/llama_stack/templates/dell/run-with-safety.yaml b/llama_stack/templates/dell/run-with-safety.yaml index 1e1ef1ea9..121087d8c 100644 --- a/llama_stack/templates/dell/run-with-safety.yaml +++ b/llama_stack/templates/dell/run-with-safety.yaml @@ -92,6 +92,8 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 + timeout: 30.0 + connect_timeout: 10.0 - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} diff --git a/llama_stack/templates/dell/run.yaml b/llama_stack/templates/dell/run.yaml index 6f5c56dd3..de661bfda 100644 --- a/llama_stack/templates/dell/run.yaml +++ b/llama_stack/templates/dell/run.yaml @@ -88,6 +88,8 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 + timeout: 30.0 + connect_timeout: 10.0 - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} diff --git a/llama_stack/templates/fireworks/run-with-safety.yaml b/llama_stack/templates/fireworks/run-with-safety.yaml index 1233e2271..26212e57d 100644 --- a/llama_stack/templates/fireworks/run-with-safety.yaml +++ b/llama_stack/templates/fireworks/run-with-safety.yaml @@ -105,6 +105,8 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 + timeout: 30.0 + connect_timeout: 10.0 - provider_id: wolfram-alpha provider_type: remote::wolfram-alpha config: diff --git a/llama_stack/templates/fireworks/run.yaml b/llama_stack/templates/fireworks/run.yaml index 7f0bc49f5..38860cdb9 100644 --- a/llama_stack/templates/fireworks/run.yaml +++ b/llama_stack/templates/fireworks/run.yaml @@ -100,6 +100,8 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 + timeout: 30.0 + connect_timeout: 10.0 - provider_id: wolfram-alpha provider_type: remote::wolfram-alpha config: diff --git a/llama_stack/templates/groq/run.yaml b/llama_stack/templates/groq/run.yaml index 351ca74f7..ecc533ad9 100644 --- a/llama_stack/templates/groq/run.yaml +++ b/llama_stack/templates/groq/run.yaml @@ -91,6 +91,8 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 + timeout: 30.0 + connect_timeout: 10.0 - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} diff --git a/llama_stack/templates/hf-endpoint/run-with-safety.yaml b/llama_stack/templates/hf-endpoint/run-with-safety.yaml index 63063ad91..550651cf8 100644 --- a/llama_stack/templates/hf-endpoint/run-with-safety.yaml +++ b/llama_stack/templates/hf-endpoint/run-with-safety.yaml @@ -96,6 +96,8 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 + timeout: 30.0 + connect_timeout: 10.0 - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} diff --git a/llama_stack/templates/hf-endpoint/run.yaml b/llama_stack/templates/hf-endpoint/run.yaml index 4caf0db04..77e7c8cfc 100644 --- a/llama_stack/templates/hf-endpoint/run.yaml +++ b/llama_stack/templates/hf-endpoint/run.yaml @@ -91,6 +91,8 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 + timeout: 30.0 + connect_timeout: 10.0 - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} diff --git a/llama_stack/templates/hf-serverless/run-with-safety.yaml b/llama_stack/templates/hf-serverless/run-with-safety.yaml index a4bba1f76..5344d4347 100644 --- a/llama_stack/templates/hf-serverless/run-with-safety.yaml +++ b/llama_stack/templates/hf-serverless/run-with-safety.yaml @@ -96,6 +96,8 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 + timeout: 30.0 + connect_timeout: 10.0 - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} diff --git a/llama_stack/templates/hf-serverless/run.yaml b/llama_stack/templates/hf-serverless/run.yaml index 23e4c1f28..de7ba3a10 100644 --- a/llama_stack/templates/hf-serverless/run.yaml +++ b/llama_stack/templates/hf-serverless/run.yaml @@ -91,6 +91,8 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 + timeout: 30.0 + connect_timeout: 10.0 - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} diff --git a/llama_stack/templates/llama_api/run.yaml b/llama_stack/templates/llama_api/run.yaml index 77bbcfbc8..83cf5d5b2 100644 --- a/llama_stack/templates/llama_api/run.yaml +++ b/llama_stack/templates/llama_api/run.yaml @@ -101,6 +101,8 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 + timeout: 30.0 + connect_timeout: 10.0 - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} diff --git a/llama_stack/templates/meta-reference-gpu/run-with-safety.yaml b/llama_stack/templates/meta-reference-gpu/run-with-safety.yaml index 2f5ee4062..d3600c8a1 100644 --- a/llama_stack/templates/meta-reference-gpu/run-with-safety.yaml +++ b/llama_stack/templates/meta-reference-gpu/run-with-safety.yaml @@ -106,6 +106,8 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 + timeout: 30.0 + connect_timeout: 10.0 - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} diff --git a/llama_stack/templates/meta-reference-gpu/run.yaml b/llama_stack/templates/meta-reference-gpu/run.yaml index cc119bf4d..82ebd3c44 100644 --- a/llama_stack/templates/meta-reference-gpu/run.yaml +++ b/llama_stack/templates/meta-reference-gpu/run.yaml @@ -96,6 +96,8 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 + timeout: 30.0 + connect_timeout: 10.0 - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} diff --git a/llama_stack/templates/ollama/run-with-safety.yaml b/llama_stack/templates/ollama/run-with-safety.yaml index 98db5fc98..2838d6069 100644 --- a/llama_stack/templates/ollama/run-with-safety.yaml +++ b/llama_stack/templates/ollama/run-with-safety.yaml @@ -107,6 +107,8 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 + timeout: 30.0 + connect_timeout: 10.0 - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} diff --git a/llama_stack/templates/ollama/run.yaml b/llama_stack/templates/ollama/run.yaml index 38fb2bace..129bf4912 100644 --- a/llama_stack/templates/ollama/run.yaml +++ b/llama_stack/templates/ollama/run.yaml @@ -105,6 +105,8 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 + timeout: 30.0 + connect_timeout: 10.0 - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} diff --git a/llama_stack/templates/open-benchmark/run.yaml b/llama_stack/templates/open-benchmark/run.yaml index 7b1ef8f10..d9031b15f 100644 --- a/llama_stack/templates/open-benchmark/run.yaml +++ b/llama_stack/templates/open-benchmark/run.yaml @@ -115,6 +115,8 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 + timeout: 30.0 + connect_timeout: 10.0 - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} diff --git a/llama_stack/templates/passthrough/run-with-safety.yaml b/llama_stack/templates/passthrough/run-with-safety.yaml index 5cd8a2930..e33009b6d 100644 --- a/llama_stack/templates/passthrough/run-with-safety.yaml +++ b/llama_stack/templates/passthrough/run-with-safety.yaml @@ -96,6 +96,8 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 + timeout: 30.0 + connect_timeout: 10.0 - provider_id: wolfram-alpha provider_type: remote::wolfram-alpha config: diff --git a/llama_stack/templates/passthrough/run.yaml b/llama_stack/templates/passthrough/run.yaml index 5b6078953..3578b3ad8 100644 --- a/llama_stack/templates/passthrough/run.yaml +++ b/llama_stack/templates/passthrough/run.yaml @@ -91,6 +91,8 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 + timeout: 30.0 + connect_timeout: 10.0 - provider_id: wolfram-alpha provider_type: remote::wolfram-alpha config: diff --git a/llama_stack/templates/postgres-demo/run.yaml b/llama_stack/templates/postgres-demo/run.yaml index 2b6b1a64f..ce3ea23bf 100644 --- a/llama_stack/templates/postgres-demo/run.yaml +++ b/llama_stack/templates/postgres-demo/run.yaml @@ -65,6 +65,8 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 + timeout: 30.0 + connect_timeout: 10.0 - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} diff --git a/llama_stack/templates/remote-vllm/run-with-safety.yaml b/llama_stack/templates/remote-vllm/run-with-safety.yaml index a8d30904d..0faee221d 100644 --- a/llama_stack/templates/remote-vllm/run-with-safety.yaml +++ b/llama_stack/templates/remote-vllm/run-with-safety.yaml @@ -100,6 +100,8 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 + timeout: 30.0 + connect_timeout: 10.0 - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} diff --git a/llama_stack/templates/remote-vllm/run.yaml b/llama_stack/templates/remote-vllm/run.yaml index 58c4f867d..80da1f534 100644 --- a/llama_stack/templates/remote-vllm/run.yaml +++ b/llama_stack/templates/remote-vllm/run.yaml @@ -93,6 +93,8 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 + timeout: 30.0 + connect_timeout: 10.0 - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} diff --git a/llama_stack/templates/sambanova/run.yaml b/llama_stack/templates/sambanova/run.yaml index ab6c70ae0..39e6290e1 100644 --- a/llama_stack/templates/sambanova/run.yaml +++ b/llama_stack/templates/sambanova/run.yaml @@ -70,6 +70,8 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 + timeout: 30.0 + connect_timeout: 10.0 - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} diff --git a/llama_stack/templates/starter/run.yaml b/llama_stack/templates/starter/run.yaml index de8d35683..d2e129881 100644 --- a/llama_stack/templates/starter/run.yaml +++ b/llama_stack/templates/starter/run.yaml @@ -162,6 +162,8 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 + timeout: 30.0 + connect_timeout: 10.0 - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} diff --git a/llama_stack/templates/tgi/run-with-safety.yaml b/llama_stack/templates/tgi/run-with-safety.yaml index c19b916d5..400b654e7 100644 --- a/llama_stack/templates/tgi/run-with-safety.yaml +++ b/llama_stack/templates/tgi/run-with-safety.yaml @@ -91,6 +91,8 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 + timeout: 30.0 + connect_timeout: 10.0 - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} diff --git a/llama_stack/templates/tgi/run.yaml b/llama_stack/templates/tgi/run.yaml index f0197d74c..b4636ddfb 100644 --- a/llama_stack/templates/tgi/run.yaml +++ b/llama_stack/templates/tgi/run.yaml @@ -90,6 +90,8 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 + timeout: 30.0 + connect_timeout: 10.0 - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} diff --git a/llama_stack/templates/together/run-with-safety.yaml b/llama_stack/templates/together/run-with-safety.yaml index b32c9ee8d..f6df14477 100644 --- a/llama_stack/templates/together/run-with-safety.yaml +++ b/llama_stack/templates/together/run-with-safety.yaml @@ -96,6 +96,8 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 + timeout: 30.0 + connect_timeout: 10.0 - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} diff --git a/llama_stack/templates/together/run.yaml b/llama_stack/templates/together/run.yaml index 22c99f6cf..ef64cf8ee 100644 --- a/llama_stack/templates/together/run.yaml +++ b/llama_stack/templates/together/run.yaml @@ -91,6 +91,8 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 + timeout: 30.0 + connect_timeout: 10.0 - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} diff --git a/llama_stack/templates/vllm-gpu/run.yaml b/llama_stack/templates/vllm-gpu/run.yaml index 6d122e180..8f80a2dcb 100644 --- a/llama_stack/templates/vllm-gpu/run.yaml +++ b/llama_stack/templates/vllm-gpu/run.yaml @@ -95,6 +95,8 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 + timeout: 30.0 + connect_timeout: 10.0 - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} diff --git a/llama_stack/templates/watsonx/run.yaml b/llama_stack/templates/watsonx/run.yaml index d80ee6329..8193c0ac6 100644 --- a/llama_stack/templates/watsonx/run.yaml +++ b/llama_stack/templates/watsonx/run.yaml @@ -92,6 +92,8 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:=} max_results: 3 + timeout: 30.0 + connect_timeout: 10.0 - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} From 37f4d02392e7eb77ff56c1203297f1ff1deb52b2 Mon Sep 17 00:00:00 2001 From: anigasan Date: Mon, 7 Jul 2025 12:39:33 -0700 Subject: [PATCH 5/6] made changes to tavily_search, simplified config logic --- .../remote/tool_runtime/tavily_search/tavily_search.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 d89c9b101..5158f4d40 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 @@ -70,9 +70,9 @@ class TavilySearchToolRuntimeImpl(ToolGroupsProtocolPrivate, ToolRuntime, NeedsR async def invoke_tool(self, tool_name: str, kwargs: dict[str, Any]) -> ToolInvocationResult: api_key = self._get_api_key() - httpx.Timeout(timeout=self.config.timeout, connect=self.config.connect_timeout) + timeout = httpx.Timeout(timeout=self.config.timeout) - async with httpx.AsyncClient() as client: + async with httpx.AsyncClient(timeout=timeout) as client: response = await client.post( "https://api.tavily.com/search", json={"api_key": api_key, "query": kwargs["query"]}, From 2e57d1b7e6b80202ae5ac006c2bb14a14a9b230e Mon Sep 17 00:00:00 2001 From: anigasan Date: Mon, 7 Jul 2025 12:44:45 -0700 Subject: [PATCH 6/6] made changes to configuration --- .../providers/remote/tool_runtime/tavily_search/config.py | 5 ----- 1 file changed, 5 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 ec409ab55..b4ddd9cb4 100644 --- a/llama_stack/providers/remote/tool_runtime/tavily_search/config.py +++ b/llama_stack/providers/remote/tool_runtime/tavily_search/config.py @@ -22,10 +22,6 @@ class TavilySearchToolConfig(BaseModel): default=30.0, description="HTTP request timeout for the API", ) - connect_timeout: float = Field( - default=10.0, - description="HTTP connection timeout in seconds for the API", - ) @classmethod def sample_run_config(cls, __distro_dir__: str) -> dict[str, Any]: @@ -33,5 +29,4 @@ class TavilySearchToolConfig(BaseModel): "api_key": "${env.TAVILY_SEARCH_API_KEY:=}", "max_results": 3, "timeout": 30.0, - "connect_timeout": 10.0, }