Tools
Calculator
Calculator enables an Agent to perform mathematical calculations.
Example
The following agent will calculate the result of 10*5
and then raise it to the power of 2
:
cookbook/tools/calculator_tools.py
Toolkit Params
Parameter | Type | Default | Description |
---|---|---|---|
add | bool | True | Enables the functionality to perform addition. |
subtract | bool | True | Enables the functionality to perform subtraction. |
multiply | bool | True | Enables the functionality to perform multiplication. |
divide | bool | True | Enables the functionality to perform division. |
exponentiate | bool | False | Enables the functionality to perform exponentiation. |
factorial | bool | False | Enables the functionality to calculate the factorial of a number. |
is_prime | bool | False | Enables the functionality to check if a number is prime. |
square_root | bool | False | Enables the functionality to calculate the square root of a number. |
Toolkit Functions
Function | Description |
---|---|
add | Adds two numbers and returns the result. |
subtract | Subtracts the second number from the first and returns the result. |
multiply | Multiplies two numbers and returns the result. |
divide | Divides the first number by the second and returns the result. Handles division by zero. |
exponentiate | Raises the first number to the power of the second number and returns the result. |
factorial | Calculates the factorial of a number and returns the result. Handles negative numbers. |
is_prime | Checks if a number is prime and returns the result. |
square_root | Calculates the square root of a number and returns the result. Handles negative numbers. |
Information
- View on Github
Was this page helpful?