Changed config and tavily_search for tavily API

This commit is contained in:
anigasan 2025-07-03 12:21:28 -07:00
parent 15d27a251f
commit 349e80d06a
2 changed files with 5 additions and 4 deletions

View file

@ -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,
}

View file

@ -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",