AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
fix(agent, forge): Conform `web_search.py` to `duckduckgo_search` v5 (#7045)
Krzysztof Czerwinski12640f7092a7
diff --git a/autogpts/autogpt/autogpt/commands/web_search.py b/autogpts/autogpt/autogpt/commands/web_search.pyindex e39bfffc6d..717d5295c3 100644--- a/autogpts/autogpt/autogpt/commands/web_search.py+++ b/autogpts/autogpt/autogpt/commands/web_search.py@@ -49,8 +49,7 @@ def web_search(query: str, agent: Agent, num_results: int = 8) -> str:if not query:return json.dumps(search_results)- results = DDGS().text(query)- search_results = list(islice(results, num_results))+ search_results = DDGS().text(query, max_results=num_results)if search_results:breakdiff --git a/autogpts/autogpt/pyproject.toml b/autogpts/autogpt/pyproject.tomlindex 73706967aa..404bffaaa5 100644--- a/autogpts/autogpt/pyproject.toml+++ b/autogpts/autogpt/pyproject.toml@@ -33,7 +33,7 @@ colorama = "^0.4.6"demjson3 = "^3.0.0"distro = "^1.8.0"docker = "*"-duckduckgo-search = "^4.0.0"+duckduckgo-search = "^5.0.0"en-core-web-sm = {url = "https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.5.0/en_core_web_sm-3.5.0-py3-none-any.whl"}fastapi = "^0.109.1"ftfy = "^6.1.1"diff --git a/autogpts/forge/forge/actions/web/web_search.py b/autogpts/forge/forge/actions/web/web_search.pyindex 2bcc0a32d5..afd09563f3 100644--- a/autogpts/forge/forge/actions/web/web_search.py+++ b/autogpts/forge/forge/actions/web/web_search.py@@ -42,8 +42,7 @@ async def web_search(agent, task_id: str, query: str) -> str:if not query:return json.dumps(search_results)- results = DDGS().text(query)- search_results = list(islice(results, num_results))+ search_results = DDGS().text(query, max_results=num_results)if search_results:breakdiff --git a/autogpts/forge/pyproject.toml b/autogpts/forge/pyproject.tomlindex a85f275b18..bd5575304f 100644--- a/autogpts/forge/pyproject.toml+++ b/autogpts/forge/pyproject.toml@@ -21,7 +21,7 @@ toml = "^0.10.2"jinja2 = "^3.1.2"uvicorn = "^0.23.2"litellm = "^1.17.9"-duckduckgo-search = "^4.0.0"+duckduckgo-search = "^5.0.0"selenium = "^4.13.0"bs4 = "^0.0.1"agbenchmark = { path = "../../benchmark", optional = true }