Planner and react: multi-clause routing, conversation context resolution, clarifying question fallback - #64
Open
prinskumar-tigergraph wants to merge 1 commit into
Conversation
…ion, clarifying question fallback - When a question refers to something from earlier in the conversation, resolve it from ## Conversation and use the full name in retrieval args. If history has multiple candidates and it is unclear which is meant, ask the user one short clarifying question instead of guessing. - For each unstructured retrieval step, set the question to that clause only as a standalone search query. Do not pass the full multi-part question, a clause already covered by another step, or an unresolved reference from conversation history. - When a question has multiple clauses, assign each clause to its own retrieval step; plan additional RAG steps for any clause not yet covered. - Synthesizer: answer each part of a multi-part question from its matching source; do not mix structured notes with document-passage answers. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Improves the agentic planner and react agent to handle three scenarios that previously produced wrong or incomplete answers:
1. Multi-clause questions
When a question has multiple parts (e.g. "What is X? Also, what does the report say about Y?"), each clause is now assigned to its own retrieval step with a standalone search query. Previously the full compound question was passed to every retrieval tool, causing irrelevant chunks to be returned.
2. Conversation context resolution
When a follow-up question refers to something mentioned earlier (e.g. "その計画", "that plan", "its report"), the agent resolves the referent from
## Conversationand uses the full name in every retrieval call. If the conversation history contains multiple candidates and it is unclear which one is meant, the agent asks the user one short clarifying question instead of guessing.3. Multi-part answer synthesis
The synthesizer now answers each part of a multi-part question from its matching source — structured-query results for typed graph facts, document passages for report/document content. Structured notes are not quoted as what a named report says.
Files changed
common/llm_services/base_llm.py— 7 lines changed (1 commit)What is NOT in this PR
graphrag__gsql__*tool routing (that is instatic_query_registration)tool_registry.py,KGAdmin.tsx,ui.py, or any code filesTest scenarios verified