mirror of
https://github.com/RYDE-WORK/Langchain-Chatchat.git
synced 2026-01-22 14:57:02 +08:00
14 lines
456 B
Python
14 lines
456 B
Python
# Langchain 自带的 Wolfram Alpha API 封装
|
|
from langchain.utilities.wolfram_alpha import WolframAlphaAPIWrapper
|
|
from chatchat.server.pydantic_v1 import BaseModel, Field
|
|
wolfram_alpha_appid = "your key"
|
|
|
|
|
|
def wolfram(query: str):
|
|
wolfram = WolframAlphaAPIWrapper(wolfram_alpha_appid=wolfram_alpha_appid)
|
|
ans = wolfram.run(query)
|
|
return ans
|
|
|
|
class WolframInput(BaseModel):
|
|
formula: str = Field(description="The formula to be calculated")
|