Spaces:
Sleeping
Sleeping
Download math_tools.py from alialhaddad/FinalAssignment-AliA: direct link, hf CLI and curl.
- Browser
- Download file 873 Bytes
-
https://huggingface.co/spaces/alialhaddad/FinalAssignment-AliA/resolve/main/math_tools.py
- Command line
-
hf download hf://spaces/alialhaddad/FinalAssignment-AliA/math_tools.py
-
curl -L -o math_tools.py https://huggingface.co/spaces/alialhaddad/FinalAssignment-AliA/resolve/main/math_tools.py
873 Bytes
| from langchain_core.tools import tool | |
| def multiply(a: int, b: int) -> int: | |
| """Multiply two numbers. | |
| Args: | |
| a: first int | |
| b: second int | |
| """ | |
| return a * b | |
| def add(a: int, b: int) -> int: | |
| """Add two numbers. | |
| Args: | |
| a: first int | |
| b: second int | |
| """ | |
| return a + b | |
| def subtract(a: int, b: int) -> int: | |
| """Subtract two numbers. | |
| Args: | |
| a: first int | |
| b: second int | |
| """ | |
| return a - b | |
| def divide(a: int, b: int) -> int: | |
| """Divide two numbers. | |
| Args: | |
| a: first int | |
| b: second int | |
| """ | |
| if b == 0: | |
| raise ValueError("Cannot divide by zero.") | |
| return a / b | |
| def modulus(a: int, b: int) -> int: | |
| """Get the modulus of two numbers. | |
| Args: | |
| a: first int | |
| b: second int | |
| """ | |
| return a % b |