Skip to content

Commit 0eaaa98

Browse files
committed
Update prompt
1 parent 8924cff commit 0eaaa98

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

text_2_sql/autogen/src/autogen_text_2_sql/autogen_text_2_sql.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ def selector(self, messages):
141141
elif messages[-1].source == "sql_query_correction_agent":
142142
decision = "sql_query_generation_agent"
143143

144+
elif messages[-1].source == "sql_query_generation_agent":
145+
decision = "sql_query_correction_agent"
146+
144147
# Log the decision
145148
logging.info("Decision: %s", decision)
146149

text_2_sql/text_2_sql_core/src/text_2_sql_core/connectors/databricks_sql.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,7 @@ async def get_entity_schemas(
101101
# schema["SelectFromEntity"] = ".".join(
102102
# [schema["Catalog"], schema["Schema"], schema["Entity"]]
103103
# )
104-
schema["SelectFromEntity"] = (
105-
os.environ["Text2Sql__Databricks__Catalog"] + "." + schema["Entity"]
106-
)
104+
schema["SelectFromEntity"] = schema["Entity"]
107105

108106
del schema["Entity"]
109107
# del schema["Schema"]

text_2_sql/text_2_sql_core/src/text_2_sql_core/prompts/sql_query_correction_agent.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ description:
44
"An agent that will look at the SQL query, SQL query results and correct any mistakes in the SQL query to ensure the correct results are returned. Use this agent AFTER the SQL query has been executed and the results are not as expected."
55
system_message:
66
"<role_and_objective>
7-
You are a helpful AI Assistant specializing in diagnosing and correcting invalid SQL queries or improving SQL queries that do not return expected results.
7+
You are a helpful AI Assistant specializing in diagnosing and making fix suggestions for invalid SQL queries, or improving SQL queries that do not return expected results.
88
</role_and_objective>
99
1010
<scope_of_user_query>
11-
The user's question will be related to SQL queries and their results in the context of {{ target_engine }}. Queries must adhere to the syntax and rules of {{ target_engine }} {{ engine_specific_rules }}.
11+
Queries must adhere to the syntax and rules of {{ target_engine }} {{ engine_specific_rules }}.
1212
</scope_of_user_query>
1313
1414
<instructions>
1515
1. **Validate Syntax**: Check if the provided SQL query is syntactically correct. If not, suggest fixes to the query.
1616
2. **Verify Results**: Ensure the query results align with the user’s question. If the query fails to meet the expected results:
17-
- Make suggestions to correct the query.
17+
- Make suggestions to the query writter on how to correct the query.
1818
3. **Contextual Relevance**: Ensure the query fully addresses the user's question based on its context and requirements.
1919
</instructions>
2020
@@ -41,8 +41,7 @@ system_message:
4141
```json
4242
[
4343
{
44-
\"fix_request\": \"<REQUESTED FIX OF THE SQL QUERY>\",
45-
\"explanation\": \"<EXPLANATION OF CORRECTION>\"
44+
\"requested_fix\": \"<EXPLANATION OF REQUESTED FIX OF THE SQL QUERY>\"
4645
}
4746
]
4847
```

0 commit comments

Comments
 (0)