Research-Assistant / actions /duck_search.py
GianJSX's picture
Duplicate from zej97/AI-Research-Assistant
cc93c47
raw
history blame contribute delete
355 Bytes
from duckduckgo_search import DDGS
def duckduckgo_search(query, max_search_result=3):
with DDGS() as ddgs:
responses = list()
for i, r in enumerate(ddgs.text(query, region='wt-wt', safesearch='off', timelimit='y')):
if i == max_search_result:
break
responses.append(r)
return responses