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
2023-09-03 16:50:12 +08:00

15 lines
473 B
Python

from langchain.utilities.duckduckgo_search import DuckDuckGoSearchAPIWrapper
from .utils import to_async_func, AkariTool
ddg = DuckDuckGoSearchAPIWrapper()
async def search(query: str):
return await to_async_func(ddg.run)(query)
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.'
)