Skip to content

Commit fa26325

Browse files
committed
New agent
1 parent 710562d commit fa26325

File tree

5 files changed

+8
-18
lines changed

5 files changed

+8
-18
lines changed

text_2_sql/autogen/agentic_text_2_sql.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"name": "python",
7373
"nbconvert_exporter": "python",
7474
"pygments_lexer": "ipython3",
75-
"version": "3.12.6"
75+
"version": "3.12.7"
7676
}
7777
},
7878
"nbformat": 4,

text_2_sql/autogen/agentic_text_2_sql.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,15 @@
55
from utils.models import MINI_MODEL
66
from utils.llm_agent_creator import LLMAgentCreator
77
import logging
8-
from custom_agents.sql_query_cache_agent import SqlQueryCacheAgent
9-
from custom_agents.sql_schema_extraction_agent import SqlSchemaExtractionAgent
8+
from agents.custom_agents.sql_query_cache_agent import SqlQueryCacheAgent
109
import json
1110

1211
SQL_QUERY_GENERATION_AGENT = LLMAgentCreator.create(
1312
"sql_query_generation_agent",
1413
target_engine="Microsoft SQL Server",
1514
engine_specific_rules="Use TOP X to limit the number of rows returned instead of LIMIT X. NEVER USE LIMIT X as it produces a syntax error.",
1615
)
17-
# SQL_SCHEMA_SELECTION_AGENT = LLMAgentCreator.create(
18-
# "sql_schema_selection_agent")
19-
SQL_SCHEMA_SELECTION_AGENT = SqlSchemaExtractionAgent()
16+
SQL_SCHEMA_SELECTION_AGENT = LLMAgentCreator.create("sql_schema_selection_agent")
2017
SQL_QUERY_CORRECTION_AGENT = LLMAgentCreator.create(
2118
"sql_query_correction_agent",
2219
target_engine="Microsoft SQL Server",

text_2_sql/autogen/agents/llm_agents/sql_schema_selection_agent.yaml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,8 @@ system_message:
2121
You would then use the 'sql_get_entity_schemas_tool' tool to search for the correct schema based on these key terms.
2222
2323
Output Info:
24-
If there are multiple possible schemas, return the information to the use in the following form for clarrification:
25-
26-
[
27-
{
28-
'question': 'Which of the following columns does the key term <key_term> belong to?',
29-
'columns': ['<column_1>', '<column_2>', '<column_3>']
30-
}
31-
]
32-
33-
End your answer with 'TERMINATE' if you are unable to find the correct schema or if the user's question is too ambiguous to select a schema."
24+
- Just return the output of the 'sql_get_entity_schemas_tool' tool.
25+
- Concate the results of the 'sql_get_entity_schemas_tool' tool if you are calling this agent in parallel.
26+
- Do not provide any analysis or additional information to the user."
3427
tools:
3528
- sql_get_entity_schemas_tool

text_2_sql/autogen/utils/llm_agent_creator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
class LLMAgentCreator:
1515
@classmethod
1616
def load_agent_file(cls, name):
17-
with open(f"/agents/llm_agents/{name.lower()}.yaml", "r") as file:
17+
with open(f"./agents/llm_agents/{name.lower()}.yaml", "r") as file:
1818
file = yaml.safe_load(file)
1919

2020
return file

text_2_sql/autogen/utils/sql.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import os
55
import aioodbc
66
from typing import Annotated
7-
from text_2_sql.autogen.utils.ai_search import run_ai_search_query
7+
from utils.ai_search import run_ai_search_query
88
import json
99
import asyncio
1010

0 commit comments

Comments
 (0)