Skip to content

Commit 3ea1ffe

Browse files
committed
Add current datetime
1 parent 011f665 commit 3ea1ffe

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

text_2_sql/autogen/agents/llm_agents/sql_query_correction_agent.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ system_message:
2020
tools:
2121
- sql_get_entity_schemas_tool
2222
- sql_query_execution_tool
23+
- current_datetime_tool

text_2_sql/autogen/agents/llm_agents/sql_query_generation_agent.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,4 @@ tools:
3939
- sql_query_execution_tool
4040
- sql_get_entity_schemas_tool
4141
- sql_query_validation_tool
42+
- current_datetime_tool

text_2_sql/autogen/utils/llm_agent_creator.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from utils.sql import query_execution, get_entity_schemas, query_validation
77
from utils.models import MINI_MODEL
88
from jinja2 import Template
9+
from datetime import datetime
910

1011

1112
class LLMAgentCreator:
@@ -40,6 +41,11 @@ def get_tool(cls, tool_name):
4041
query_validation,
4142
description="Validates the SQL query to ensure that it is syntactically correct for the target database engine. Use this BEFORE executing any SQL statement.",
4243
)
44+
elif tool_name == "current_datetime_tool":
45+
return FunctionTool(
46+
lambda: datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
47+
description="Gets the current date and time.",
48+
)
4349
else:
4450
raise ValueError(f"Tool {tool_name} not found")
4551

0 commit comments

Comments
 (0)