File size: 395 Bytes
ee51219
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
from langchain.tools import tool
from datetime import datetime

@tool
def current_date_time_tool():
    """
    Returns the current date and time with second-level precision, including the day of the week.
    """
    now = datetime.now()
    weekday = now.strftime("%A")
    formatted = now.strftime("%Y-%m-%d %H:%M:%S")
    return f"Hoy es {weekday}, y la fecha y hora actual es: {formatted}"