File tree Expand file tree Collapse file tree 1 file changed +9
-13
lines changed
pydantic_ai_slim/pydantic_ai/common_tools Expand file tree Collapse file tree 1 file changed +9
-13
lines changed Original file line number Diff line number Diff line change 22
33import functools
44from dataclasses import KW_ONLY , dataclass
5- from typing import TYPE_CHECKING
65
76import anyio
87import anyio .to_thread
1110
1211from pydantic_ai .tools import Tool
1312
14- if TYPE_CHECKING :
15- from ddgs import DDGS
16- else :
13+ try :
1714 try :
18- try :
19- from ddgs import DDGS
20- except ImportError : # Fallback for older versions of ddgs
21- from duckduckgo_search import DDGS
22- except ImportError as _import_error :
23- raise ImportError (
24- 'Please install `ddgs` to use the DuckDuckGo search tool, '
25- 'you can use the `duckduckgo` optional group — `pip install "pydantic-ai-slim[duckduckgo]"`'
26- ) from _import_error
15+ from ddgs .ddgs import DDGS
16+ except ImportError : # Fallback for older versions of ddgs
17+ from duckduckgo_search import DDGS
18+ except ImportError as _import_error :
19+ raise ImportError (
20+ 'Please install `ddgs` to use the DuckDuckGo search tool, '
21+ 'you can use the `duckduckgo` optional group — `pip install "pydantic-ai-slim[duckduckgo]"`'
22+ ) from _import_error
2723
2824__all__ = ('duckduckgo_search_tool' ,)
2925
You can’t perform that action at this time.
0 commit comments