Skip to content

Commit

Permalink
Update DDGS lib and fix type issue
Browse files Browse the repository at this point in the history
Error: 'NoneType' object is not iterable
  • Loading branch information
tpai committed Apr 23, 2024
1 parent 8817fd3 commit 1b4b9b3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions main.py
Expand Up @@ -42,9 +42,8 @@ def scrape_text_from_url(url):
print(f"Error: {e}")

async def search_results(keywords):
async with AsyncDDGS() as ddgs:
results = [r async for r in ddgs.text(keywords, region='wt-wt', safesearch='off', max_results=3)]
return results
results = await AsyncDDGS().text(keywords, region='wt-wt', safesearch='off', max_results=3)
return results

def summarize(text_array):
"""
Expand Down Expand Up @@ -220,8 +219,7 @@ async def handle(command, update, context):
])
print(keywords)

tasks = []
tasks.append(search_results(keywords))
tasks = [search_results(keywords)]
results = await asyncio.gather(*tasks)
print(results)

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Expand Up @@ -11,7 +11,7 @@ litellm==1.21.7
trafilatura==1.8.1

# duckduckgo
duckduckgo_search==4.4.3
duckduckgo_search==5.3.0

# PDFs
PyPDF2==3.0.1
Expand Down

0 comments on commit 1b4b9b3

Please sign in to comment.