Spaces:
Sleeping
Sleeping
| from typing import Any, Optional | |
| from smolagents.tools import Tool | |
| import datetime | |
| class DateTimeTool(Tool): | |
| """ | |
| A simple tool to get the current local date and time. | |
| """ | |
| name = "get_today_datetime" | |
| description = "Get the current local date and time in the format 'YYYY-MM-DD HH:MM:SS'." | |
| inputs = {} | |
| output_type = "string" | |
| def forward(self): | |
| """ | |
| Executes the tool. | |
| Returns: | |
| str: Current date and time. | |
| """ | |
| from datetime import datetime | |
| return datetime.now().strftime("%Y-%m-%d %H:%M:%S") | |
| def __init__(self, *args, **kwargs): | |
| self.is_initialized = False | |