liunux4odoo 5c650a8dc3
优化目录结构 (#4058)
* 优化目录结构

* 修改一些测试问题

---------

Co-authored-by: glide-the <2533736852@qq.com>
2024-05-22 13:11:45 +08:00

17 lines
592 B
Python

# Langchain 自带的 Wolfram Alpha API 封装
from chatchat.server.pydantic_v1 import Field
from chatchat.server.utils import get_tool_config
from .tools_registry import regist_tool, BaseToolOutput
@regist_tool
def wolfram(query: str = Field(description="The formula to be calculated")):
'''Useful for when you need to calculate difficult formulas'''
from langchain.utilities.wolfram_alpha import WolframAlphaAPIWrapper
wolfram = WolframAlphaAPIWrapper(wolfram_alpha_appid=get_tool_config("wolfram").get("appid"))
ans = wolfram.run(query)
return BaseToolOutput(ans)