crypto_crewAI / tools /.ipynb_checkpoints /wolfram_alpha_tool-checkpoint.py
quocdat25's picture
Upload folder using huggingface_hub
d9b1770 verified
from crewai_tools import BaseTool
from langchain_community.utilities.wolfram_alpha import WolframAlphaAPIWrapper
wolfram = WolframAlphaAPIWrapper()
class AskWolframAlpha(BaseTool):
name: str = "AskWolframAlpha"
description: str = "use WolframAlpha to analyze data"
def _run(self, question: str) -> str:
"Ask Wolfram Alpha to do math, e.g : descriptive statistics {20.9,23.2,26.2,26.4}"
wolfram = WolframAlphaAPIWrapper()
return wolfram.run(question)
# Test
# print(AskWolframAlpha()._run("descriptive statistics {20.9,23.2,26.2,26.4,20.9,23.2,26.2,26.4,20.9}"))