Spaces:
Sleeping
Sleeping
| from smolagents import Tool | |
| from typing import Any, Optional | |
| class SimpleTool(Tool): | |
| name = "calculator" | |
| description = "Calculate the result of the expression." | |
| inputs = {"expr":{"type":"string","description":"The math expression to calculate."}} | |
| output_type = "string" | |
| def forward(self, expr: str) -> str: | |
| """ | |
| Calculate the result of the expression. | |
| Args: | |
| expr: The math expression to calculate. | |
| Returns: | |
| The result of the expression. | |
| """ | |
| return eval(expr) |