2023-05-30 20:58:16 +00:00
|
|
|
# Wolfram Alpha
|
2023-01-11 13:52:19 +00:00
|
|
|
|
2023-05-30 20:58:16 +00:00
|
|
|
>[WolframAlpha](https://en.wikipedia.org/wiki/WolframAlpha) is an answer engine developed by `Wolfram Research`.
|
|
|
|
> It answers factual queries by computing answers from externally sourced data.
|
|
|
|
|
|
|
|
This page covers how to use the `Wolfram Alpha API` within LangChain.
|
2023-01-11 13:52:19 +00:00
|
|
|
|
|
|
|
## Installation and Setup
|
2023-05-30 20:58:16 +00:00
|
|
|
- Install requirements with
|
|
|
|
```bash
|
|
|
|
pip install wolframalpha
|
|
|
|
```
|
2023-01-11 13:52:19 +00:00
|
|
|
- Go to wolfram alpha and sign up for a developer account [here](https://developer.wolframalpha.com/)
|
2023-05-30 20:58:16 +00:00
|
|
|
- Create an app and get your `APP ID`
|
2023-01-11 13:52:19 +00:00
|
|
|
- Set your APP ID as an environment variable `WOLFRAM_ALPHA_APPID`
|
|
|
|
|
|
|
|
|
|
|
|
## Wrappers
|
|
|
|
|
|
|
|
### Utility
|
|
|
|
|
|
|
|
There exists a WolframAlphaAPIWrapper utility which wraps this API. To import this utility:
|
|
|
|
|
|
|
|
```python
|
|
|
|
from langchain.utilities.wolfram_alpha import WolframAlphaAPIWrapper
|
|
|
|
```
|
|
|
|
|
2023-06-16 18:52:56 +00:00
|
|
|
For a more detailed walkthrough of this wrapper, see [this notebook](/docs/modules/agents/tools/integrations/wolfram_alpha.html).
|
2023-01-11 13:52:19 +00:00
|
|
|
|
|
|
|
### Tool
|
|
|
|
|
|
|
|
You can also easily load this wrapper as a Tool (to use with an Agent).
|
|
|
|
You can do this with:
|
|
|
|
```python
|
|
|
|
from langchain.agents import load_tools
|
|
|
|
tools = load_tools(["wolfram-alpha"])
|
|
|
|
```
|
|
|
|
|
2023-06-20 21:06:50 +00:00
|
|
|
For more information on tools, see [this page](/docs/modules/agents/tools/).
|