Expand description
Graph RAG (Retrieval-Augmented Generation) Service.
Provides hybrid search that combines traditional semantic/text search with knowledge graph expansion for enhanced memory recall.
§Architecture
User Query: "How do we handle auth?"
│
▼
GraphRAGService.search_with_expansion()
│
├──▶ RecallService.search() → 10 memories (semantic)
│
└──▶ EntityExtractorService.extract_from_query("auth")
│
▼
["AuthService", "JWT", "OAuth"]
│
▼
GraphService.traverse(depth=2)
│
▼
Related entities + their source_memory_ids
│
▼
5 additional memories via graph
│
▼
Merge + Re-rank (boost graph-based by config.expansion_boost)
│
▼
Return 15 memories with provenance§Example
ⓘ
use subcog::services::{GraphRAGService, GraphRAGConfig, ExpansionConfig};
let service = GraphRAGService::new(recall, graph, config);
let results = service.search_with_expansion(
"authentication patterns",
&SearchFilter::new(),
ExpansionConfig::default(),
)?;
for hit in results.memories {
println!("{}: {} (provenance: {:?})", hit.memory.id, hit.score, hit.provenance);
}Structs§
- Expansion
Config - Configuration for a specific expansion operation.
- GraphRAG
Config - Configuration for Graph RAG service.
- GraphRAG
Service - Service for hybrid search combining semantic search with graph expansion.
- Graph
Search Hit - A search result with provenance information.
- Graph
Search Results - Results from a Graph RAG search.
Enums§
- Search
Provenance - Indicates how a memory was discovered.