How Vector RAG and Graph RAG work
masterThe application supports two primary RAG methodologies:
Vector RAG
Traditional RAG that performs a vector search to find the top $N$ most relevant matches to a user's input. These matches are then used to hydrate an LLM prompt.
Graph RAG
Uses knowledge or semantic graphs to generate context via graph path traversal. It supports three query patterns:
- Graph query expansion: Prefix a query with
gq:to perform a vector search followed by expansion using a graph network.- Example:
gq: Tell me about Linux
- Example:
- Graph path query: Provide a list of concepts separated by
->to find related nodes via traversal.- Example:
linux -> macos -> microsoft windows
- Example:
- Combination: Run a graph path query followed by a graph query within that path's context.
- Example:
linux -> macos -> microsoft windows gq: Tell me about Linux
- Example:
Every Graph RAG response includes a visual graph where nodes represent sections (paragraphs) labeled with topics.