File size: 390 Bytes
3208dbf
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from langchain.tools import tool


class CalculatorTools():

  @tool("Make a calculation")
  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)