Source code for langchain_community.tools.wolfram_alpha.tool
"""Tool for the Wolfram Alpha API."""fromtypingimportOptionalfromlangchain_core.callbacksimportCallbackManagerForToolRunfromlangchain_core.toolsimportBaseToolfromlangchain_community.utilities.wolfram_alphaimportWolframAlphaAPIWrapper
[docs]classWolframAlphaQueryRun(BaseTool):# type: ignore[override]"""Tool that queries using the Wolfram Alpha SDK."""name:str="wolfram_alpha"description:str=("A wrapper around Wolfram Alpha. ""Useful for when you need to answer questions about Math, ""Science, Technology, Culture, Society and Everyday Life. ""Input should be a search query.")api_wrapper:WolframAlphaAPIWrapperdef_run(self,query:str,run_manager:Optional[CallbackManagerForToolRun]=None,)->str:"""Use the WolframAlpha tool."""returnself.api_wrapper.run(query)