text-generation-webui/user_data/tools/get_datetime.py

19 lines
404 B
Python
Raw Normal View History

2026-03-12 20:02:57 +01:00
from datetime import datetime
tool = {
"type": "function",
"function": {
"name": "get_datetime",
"description": "Get the current date and time.",
"parameters": {
"type": "object",
"properties": {},
}
}
}
def execute(arguments):
now = datetime.now()
return {"date": now.strftime("%Y-%m-%d"), "time": now.strftime("%I:%M %p")}