fix(agent, forge): Conform web_search.py to duckduckgo_search v5 (#7045)

Update `web_search` command for both autogpt and forge to adjust for breaking change in v5 of `duckduckgo_search`
This commit is contained in:
Krzysztof Czerwinski
2024-03-25 19:50:26 +01:00
committed by GitHub
parent 5f9cc585b1
commit 12640f7092
4 changed files with 4 additions and 6 deletions

View File

@@ -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:
break

View File

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

View File

@@ -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:
break

View File

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