Skip to content

Add chat history rewriter back into agent #111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading