Spaces:
Sleeping
Sleeping
File size: 661 Bytes
6867117 a6e7cd7 6867117 a6e7cd7 6867117 a6e7cd7 6867117 a6e7cd7 6867117 a6e7cd7 6867117 a6e7cd7 6867117 a6e7cd7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
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
|