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/wolfram.py
2023-06-20 15:29:56 +08:00

15 lines
615 B
Python

from langchain.utilities import WolframAlphaAPIWrapper
from config import Config
from .utils import to_async_func, AkariTool
wolfram = WolframAlphaAPIWrapper(wolfram_alpha_appid=Config('wolfram_alpha_appid'))
async def wolfram_alpha(query: str):
return to_async_func(wolfram.run)(query)
wolfram_tool = AkariTool.from_function(
func=wolfram_alpha,
description='A wrapper around Wolfram Alpha. Useful for when you need to answer questions about Math, Science, Technology, Culture, Society and Everyday Life. Also useful for generating SHA or MD5 hashes. Input should be a search query in English.'
)