Add datetime tool to gptbot
Introduced a new 'datetime' tool to the gptbot, which provides the current date and time in UTC. This enhancement caters to the need for time-related queries within the bot's functionality, expanding its utility for users dealing with time-sensitive information.
This commit is contained in:
parent
e1782d1034
commit
eba650188b
2 changed files with 17 additions and 0 deletions
|
@ -13,6 +13,7 @@ for tool in [
|
|||
"imagine",
|
||||
"imagedescription",
|
||||
"wikipedia",
|
||||
"datetime",
|
||||
]:
|
||||
tool_class = getattr(import_module(
|
||||
"." + tool, "gptbot.tools"), tool.capitalize())
|
||||
|
|
16
src/gptbot/tools/datetime.py
Normal file
16
src/gptbot/tools/datetime.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
from .base import BaseTool
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
class Datetime(BaseTool):
|
||||
DESCRIPTION = "Get the current date and time."
|
||||
PARAMETERS = {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
},
|
||||
}
|
||||
|
||||
async def run(self):
|
||||
"""Get the current date and time."""
|
||||
return f"""**Current date and time (UTC)**
|
||||
{datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S")}"""
|
Loading…
Reference in a new issue