Download tools/maths.py from dmfelder/DF_Final_Assignment_Template: direct link, hf CLI and curl.
- Browser
- Download file 558 Bytes
-
https://huggingface.co/spaces/dmfelder/DF_Final_Assignment_Template/resolve/main/tools/maths.py
- Command line
-
hf download hf://spaces/dmfelder/DF_Final_Assignment_Template/tools/maths.py
-
curl -L -o maths.py https://huggingface.co/spaces/dmfelder/DF_Final_Assignment_Template/resolve/main/tools/maths.py
558 Bytes
| from typing import List | |
| from langchain_core.tools import tool | |
| from loguru import logger | |
| def add_integers(numbers: List[int]) -> int: | |
| """ | |
| Adds a list of integers and returns the sum. | |
| Args: | |
| numbers (List[int]): A list of integers to add together. | |
| Returns: | |
| int: The total sum of all integers in the list. | |
| """ | |
| logger.info(f"add_integers called with: {numbers}") | |
| return sum(numbers) | |
| if __name__ == "__main__": | |
| print(add_integers.invoke({"numbers": [1, 2, 3]})) |