Download tools/calculator_tools.py from ahensd/vacayBot: direct link, hf CLI and curl.
- Browser
- Download file 377 Bytes
-
https://huggingface.co/spaces/ahensd/vacayBot/resolve/main/tools/calculator_tools.py
- Command line
-
hf download hf://spaces/ahensd/vacayBot/tools/calculator_tools.py
-
curl -L -o calculator_tools.py https://huggingface.co/spaces/ahensd/vacayBot/resolve/main/tools/calculator_tools.py
377 Bytes
| from langchain.tools import tool | |
| class CalculatorTools(): | |
| def calculate(operation): | |
| """Useful to perform any mathematical calculations, | |
| like sum, minus, multiplication, division, etc. | |
| The input to this tool should be a mathematical | |
| expression, a couple examples are `200*7` or `5000/2*10` | |
| """ | |
| return eval(operation) | |