diff --git a/g4f/tools/run_tools.py b/g4f/tools/run_tools.py index f6870bbc..920b1bb9 100644 --- a/g4f/tools/run_tools.py +++ b/g4f/tools/run_tools.py @@ -216,8 +216,8 @@ async def perform_web_search(messages: Messages, web_search_param: Any) -> Tuple search_query = web_search_param if isinstance(web_search_param, str) and web_search_param != "true" else None messages[-1]["content"], sources = await do_search(messages[-1]["content"], search_query) except Exception as e: - debug.error(f"Couldn't do web search: {e.__class__.__name__}: {e}") - + debug.error(f"Couldn't do web search:", e) + return messages, sources @@ -274,7 +274,7 @@ def iter_run_tools( # Note: Using asyncio.run inside sync function is not ideal, but maintaining original pattern messages[-1]["content"], sources = asyncio.run(do_search(messages[-1]["content"], search_query)) except Exception as e: - debug.error(f"Couldn't do web search: {e.__class__.__name__}: {e}") + debug.error(f"Couldn't do web search:", e) # Get API key if needed if provider is not None: diff --git a/requirements-slim.txt b/requirements-slim.txt index 4f64e9d4..66bec7e3 100644 --- a/requirements-slim.txt +++ b/requirements-slim.txt @@ -3,7 +3,6 @@ pycryptodome curl_cffi>=0.6.2 aiohttp certifi -duckduckgo-search>=6.3.7 nest_asyncio werkzeug pillow @@ -17,4 +16,5 @@ cryptography python-multipart markitdown[all] a2wsgi -python-dotenv \ No newline at end of file +python-dotenv +ddgs \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 7463cc7a..1070101a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,6 @@ curl_cffi>=0.6.2 aiohttp certifi browser_cookie3 -duckduckgo-search>=5.0 nest_asyncio werkzeug pillow @@ -21,3 +20,4 @@ python-multipart markitdown[all] a2wsgi python-dotenv +ddgs diff --git a/setup.py b/setup.py index 42a4986e..d07bddb5 100644 --- a/setup.py +++ b/setup.py @@ -21,9 +21,9 @@ EXTRA_REQUIRE = { 'all': [ "curl_cffi>=0.6.2", "certifi", - "browser_cookie3", # get_cookies - "duckduckgo-search>=5.0", # internet.search - "beautifulsoup4", # internet.search and bing.create_images + "browser_cookie3", # get_cookies + "ddgs", # web_search + "beautifulsoup4", # web_search and bing.create_images "platformdirs", "aiohttp_socks", # proxy "pillow", # image @@ -44,8 +44,8 @@ EXTRA_REQUIRE = { "curl_cffi>=0.6.2", "certifi", "browser_cookie3", - "duckduckgo-search>=5.0" ,# internet.search - "beautifulsoup4", # internet.search and bing.create_images + "ddgs", # web_search + "beautifulsoup4", # web_search and bing.create_images "aiohttp_socks", # proxy "pillow", # image "werkzeug", "flask", # gui @@ -75,12 +75,12 @@ EXTRA_REQUIRE = { "gui": [ "werkzeug", "flask", "beautifulsoup4", "pillow", - "duckduckgo-search>=5.0", + "ddgs", ], "search": [ "beautifulsoup4", "pillow", - "duckduckgo-search>=5.0", + "ddgs", ], "local": [ "gpt4all"