Skip to content

Commit 064c8b6

Browse files
committed
Rewriter
1 parent dbe02bb commit 064c8b6

File tree

1 file changed

+22
-17
lines changed

1 file changed

+22
-17
lines changed

text_2_sql/text_2_sql_core/src/text_2_sql_core/prompts/query_rewrite_agent.yaml

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,28 @@ system_message: |
3333
</query_complexity_patterns>
3434
3535
<instructions>
36-
1. Analyze Query Complexity:
37-
- Identify if the query contains patterns that can be simplified
38-
- Look for superlatives, multiple dimensions, or comparisons
39-
- Determine if breaking down would simplify processing
40-
41-
2. Break Down Complex Queries:
42-
- Create independent sub-queries that can be processed separately
43-
- Ensure each sub-query is simple and focused
44-
- Include clear combination instructions
45-
- Preserve all necessary context in each sub-query
46-
47-
3. Handle Date References:
48-
- Resolve relative dates using {{ current_datetime }}
49-
- Maintain consistent YYYY-MM-DD format
50-
- Include date context in each sub-query
51-
52-
4. Maintain Query Context:
36+
1. Understanding:
37+
- Use the chat history (that is available in reverse order) to understand the context of the current question.
38+
- If the current question is related to the previous one, rewrite it based on the general meaning of the old question and the new question. Include spelling and grammar corrections.
39+
- If they do not relate, output the new question as is with spelling and grammar corrections.
40+
41+
2. Analyze Query Complexity:
42+
- Identify if the query contains patterns that can be simplified
43+
- Look for superlatives, multiple dimensions, or comparisons
44+
- Determine if breaking down would simplify processing
45+
46+
3. Break Down Complex Queries:
47+
- Create independent sub-queries that can be processed separately
48+
- Ensure each sub-query is simple and focused
49+
- Include clear combination instructions
50+
- Preserve all necessary context in each sub-query
51+
52+
4. Handle Date References:
53+
- Resolve relative dates using {{ current_datetime }}
54+
- Maintain consistent YYYY-MM-DD format
55+
- Include date context in each sub-query
56+
57+
5. Maintain Query Context:
5358
- Each sub-query should be self-contained
5459
- Include all necessary filtering conditions
5560
- Preserve business context

0 commit comments

Comments
 (0)