Archived
1
0
Fork 0
This repository has been archived on 2024-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
akari-bot/modules/ask/tools/search.py

15 lines
472 B
Python
Raw Normal View History

from langchain.utilities.duckduckgo_search import DuckDuckGoSearchAPIWrapper
2023-04-08 04:25:48 +00:00
2023-04-19 07:41:39 +00:00
from .utils import to_async_func, AkariTool
2023-07-15 08:15:28 +00:00
ddg = DuckDuckGoSearchAPIWrapper()
2023-04-08 04:25:48 +00:00
2023-06-20 07:29:56 +00:00
async def search(query: str):
2023-07-15 08:15:28 +00:00
return await to_async_func(ddg.run)(query)
2023-06-20 07:29:56 +00:00
search_tool = AkariTool.from_function(
func=search,
description='DuckDuckGo Search. Useful for when you need to answer questions about current events. You should ask targeted questions and ask as few questions as possible.'
2023-04-08 04:25:48 +00:00
)