Skip to content

Commit 596a829

Browse files
authored
Don't raise RuntimeError on DuckDuckGoSearchTool and TavilySearchTool when result not found (#1536)
1 parent 072a123 commit 596a829

File tree

2 files changed

+0
-4
lines changed

2 files changed

+0
-4
lines changed

pydantic_ai_slim/pydantic_ai/common_tools/duckduckgo.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ async def __call__(self, query: str) -> list[DuckDuckGoResult]:
5454
"""
5555
search = functools.partial(self.client.text, max_results=self.max_results)
5656
results = await anyio.to_thread.run_sync(search, query)
57-
if len(results) == 0:
58-
raise RuntimeError('No search results found.')
5957
return duckduckgo_ta.validate_python(results)
6058

6159

pydantic_ai_slim/pydantic_ai/common_tools/tavily.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ async def __call__(
6363
The search results.
6464
"""
6565
results = await self.client.search(query, search_depth=search_deep, topic=topic, time_range=time_range) # type: ignore[reportUnknownMemberType]
66-
if not results['results']:
67-
raise RuntimeError('No search results found.')
6866
return tavily_search_ta.validate_python(results['results'])
6967

7068

0 commit comments

Comments
 (0)