|
1 | | -from autogen_agentchat.task import TextMentionTermination |
| 1 | +from autogen_agentchat.task import TextMentionTermination, MaxMessageTermination |
2 | 2 | from autogen_agentchat.teams import SelectorGroupChat |
3 | 3 | from utils.models import MINI_MODEL |
4 | | -from utils.agent_creator import AgentCreator |
| 4 | +from utils.llm_agent_creator import LLMAgentCreator |
5 | 5 | from autogen_core.components.models import FunctionExecutionResult |
6 | 6 | import logging |
7 | 7 |
|
8 | | -SQL_QUERY_GENERATION_AGENT = AgentCreator.create( |
| 8 | +SQL_QUERY_GENERATION_AGENT = LLMAgentCreator.create( |
9 | 9 | "sql_query_generation_agent", |
10 | 10 | target_engine="Microsoft SQL Server", |
11 | 11 | 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.", |
12 | 12 | ) |
13 | | -SQL_SCHEMA_SELECTION_AGENT = AgentCreator.create("sql_schema_selection_agent") |
14 | | -SQL_QUERY_CORRECTION_AGENT = AgentCreator.create( |
| 13 | +SQL_SCHEMA_SELECTION_AGENT = LLMAgentCreator.create("sql_schema_selection_agent") |
| 14 | +SQL_QUERY_CORRECTION_AGENT = LLMAgentCreator.create( |
15 | 15 | "sql_query_correction_agent", |
16 | 16 | target_engine="Microsoft SQL Server", |
17 | 17 | 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.", |
18 | 18 | ) |
19 | | -SQL_QUERY_CACHE_AGENT = AgentCreator.create("sql_query_cache_agent") |
20 | | -ANSWER_AGENT = AgentCreator.create("answer_agent") |
21 | | -QUESTION_DECOMPOSITION_AGENT = AgentCreator.create("question_decomposition_agent") |
| 19 | +SQL_QUERY_CACHE_AGENT = LLMAgentCreator.create("sql_query_cache_agent") |
| 20 | +ANSWER_AGENT = LLMAgentCreator.create("answer_agent") |
| 21 | +QUESTION_DECOMPOSITION_AGENT = LLMAgentCreator.create("question_decomposition_agent") |
22 | 22 |
|
23 | 23 |
|
24 | 24 | def text_2_sql_generator_selector_func(messages): |
@@ -51,7 +51,7 @@ def text_2_sql_generator_selector_func(messages): |
51 | 51 | return None |
52 | 52 |
|
53 | 53 |
|
54 | | -termination = TextMentionTermination("TERMINATE") |
| 54 | +termination = TextMentionTermination("TERMINATE") | MaxMessageTermination(10) |
55 | 55 | text_2_sql_generator = SelectorGroupChat( |
56 | 56 | [ |
57 | 57 | SQL_QUERY_GENERATION_AGENT, |
|
0 commit comments