JRealValdes commited on
Commit
ee51219
·
1 Parent(s): 0a94331

Date and time tool

Browse files
Files changed (1) hide show
  1. tools/date_time.py +12 -0
tools/date_time.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from langchain.tools import tool
2
+ from datetime import datetime
3
+
4
+ @tool
5
+ def current_date_time_tool():
6
+ """
7
+ Returns the current date and time with second-level precision, including the day of the week.
8
+ """
9
+ now = datetime.now()
10
+ weekday = now.strftime("%A")
11
+ formatted = now.strftime("%Y-%m-%d %H:%M:%S")
12
+ return f"Hoy es {weekday}, y la fecha y hora actual es: {formatted}"