Skip to content

Commit

Permalink
Rewriter (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
BenConstable9 authored Dec 20, 2024
1 parent dbe02bb commit a892d45
Showing 1 changed file with 22 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,28 @@ system_message: |
</query_complexity_patterns>
<instructions>
1. Analyze Query Complexity:
- Identify if the query contains patterns that can be simplified
- Look for superlatives, multiple dimensions, or comparisons
- Determine if breaking down would simplify processing
2. Break Down Complex Queries:
- Create independent sub-queries that can be processed separately
- Ensure each sub-query is simple and focused
- Include clear combination instructions
- Preserve all necessary context in each sub-query
3. Handle Date References:
- Resolve relative dates using {{ current_datetime }}
- Maintain consistent YYYY-MM-DD format
- Include date context in each sub-query
4. Maintain Query Context:
1. Understanding:
- Use the chat history (that is available in reverse order) to understand the context of the current question.
- 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.
- If they do not relate, output the new question as is with spelling and grammar corrections.
2. Analyze Query Complexity:
- Identify if the query contains patterns that can be simplified
- Look for superlatives, multiple dimensions, or comparisons
- Determine if breaking down would simplify processing
3. Break Down Complex Queries:
- Create independent sub-queries that can be processed separately
- Ensure each sub-query is simple and focused
- Include clear combination instructions
- Preserve all necessary context in each sub-query
4. Handle Date References:
- Resolve relative dates using {{ current_datetime }}
- Maintain consistent YYYY-MM-DD format
- Include date context in each sub-query
5. Maintain Query Context:
- Each sub-query should be self-contained
- Include all necessary filtering conditions
- Preserve business context
Expand Down

0 comments on commit a892d45

Please sign in to comment.