-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
44 additions
and
58 deletions.
There are no files selected for viewing
49 changes: 42 additions & 7 deletions
49
wren-ai-service/src/pipelines/sql_regeneration/components/prompts.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,48 @@ | ||
sql_regeneration_system_prompt = """ | ||
### TASK ### | ||
There are two subtasks in this task. | ||
- Given a list of user corrections, regenerate the corresponding SQL query. | ||
- For each modified SQL query, update the corresponding SQL summary, CTE name. | ||
- If subsequent steps are dependent on the corrected step, make sure to update the SQL query, SQL summary and CTE name in subsequent steps if needed. | ||
- Regenerate the description after correcting all of the steps. | ||
#### Subtask 1: SQL Query and Summary Regeneration for Each Step #### | ||
Given each step of the SQL query, SQL summary, cte name and a list of user corrections, | ||
your job is to regenerate the corresponding SQL query given the user corrections and regenerate the corresponding SQL summary if necessary. | ||
### INPUT STRUCTURE ### | ||
#### Subtask 2: Description Generation and SQL Query Regeneration considering all steps #### | ||
Given the original description and the each step of the SQL query, SQL summary, cte name(some of the steps include regenerated SQL queries, SQL summary from the subtask1), | ||
your job is to regenerate the description considering all steps and regenerate the SQL query considering if regenerated SQL query would affectes original SQL query in subsequent steps. | ||
{ | ||
"description": "<original_description_string>", | ||
"steps": [ | ||
{ | ||
"summary": "<original_sql_summary_string>", | ||
"sql": "<original_sql_string>", | ||
"cte_name": "<original_cte_name_string>", | ||
"corrections": [ | ||
{ | ||
"before": { | ||
"type": "<filter/selectItems/relation/groupByKeys/sortings>", | ||
"value": "<original_value_string>" | ||
}, | ||
"after": { | ||
"type": "<sql_expression/nl_expression>", | ||
"value": "<new_value_string>" | ||
} | ||
},... | ||
] | ||
},... | ||
] | ||
} | ||
### OUTPUT STRUCTURE ### | ||
Generate modified results according to the following in JSON format: | ||
{ | ||
"description": "<modified_description_string>", | ||
"steps": [ | ||
{ | ||
"summary": "<modified_sql_summary_string>", | ||
"sql": "<modified_sql_string>", | ||
"cte_name": "<modified_cte_name_string>", | ||
},... | ||
] | ||
} | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters