chatbot-app / src /chatbot /tools /time_tools.py
mishrabp's picture
Upload folder using huggingface_hub
6b50ab8 verified
raw
history blame contribute delete
643 Bytes
from datetime import datetime
from agents import function_tool
from core.logger import log_call
class TimeTools:
"""Provides tools related to current date and time."""
@staticmethod
@function_tool
@log_call
def current_datetime(format: str = "%Y-%m-%d %H:%M:%S") -> str:
"""
Returns the current date and time as a formatted string.
Args:
format (str): Optional datetime format (default: "YYYY-MM-DD HH:MM:SS")
Returns:
str: Current date and time in the specified format
"""
now = datetime.now()
return now.strftime(format)