Added raw_chunks parameter to search methods #1886
Open
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.
Description
Added a new
--raw-chunks
flag to expose the raw context data retrieved from the vector store before it's processed by the LLM. This feature enhances debugging and transparency by allowing users to see the exact information being used to generate responses across all search methods (local, global, and drift). Most importantly, users now have the flexibility to control when they want to see the raw context - by simply adding the--raw-chunks
flag to their query command, they can view the actual chunks of information being passed to the LLM.Query Command
graphrag query --method local --query "" --root graph_index --raw-chunks
graphrag query --method global --query "" --root graph_index --raw-chunks
graphrag query --method drift --query "" --root graph_index --raw-chunks
Related Issues
Proposed Changes
Added user-controlled raw context display:
--raw-chunks
CLI flag for optional context viewingAdded
RawChunksCallback
class inquery.py
to handle the display of raw chunks with structured formatting for:Modified search implementation files:
factory.py
: Addedraw_chunks
parameter to search engine factory methodsmain.py
: Implemented--raw-chunks
CLI flagquery.py
: Added raw chunks handling for all search typessearch.py
: Updated search implementations (for local, global, drift ) to support raw chunks displayEnhanced DRIFT search to show context at each step:
Checklist
Additional Notes
--raw-chunks
flag, maintaining backward compatibility