diff --git a/src/rag/graph.rs b/src/rag/graph.rs index 26f4151..099437a 100644 --- a/src/rag/graph.rs +++ b/src/rag/graph.rs @@ -71,9 +71,9 @@ pub struct ExtractedRelationship { #[derive(Debug, Clone, Serialize, Deserialize)] pub struct KnowledgeGraph { pub graph: StableGraph, - /// Lowercased entity name → raw node index + /// Lowercased entity name -> raw node index pub entity_index: IndexMap, - /// DocumentId inner value → raw node indices for entities in that chunk + /// DocumentId inner value -> raw node indices for entities in that chunk pub document_entities: IndexMap>, } @@ -176,6 +176,7 @@ impl KnowledgeGraph { map.entry(node_raw).or_default().push(doc_id); } } + map } @@ -236,7 +237,6 @@ pub async fn extract_entities( .context("Entity extraction LLM call failed")?; let text = output.text.trim(); - // Strip markdown code fences if the model wraps in ```json ... ``` let json: String = if text.starts_with("```") { text.lines() .skip(1) diff --git a/src/rag/mod.rs b/src/rag/mod.rs index c22fa30..1c5c6fc 100644 --- a/src/rag/mod.rs +++ b/src/rag/mod.rs @@ -930,6 +930,7 @@ impl Rag { if kg.entity_index.is_empty() { return vec![]; } + let query_lower = query.to_lowercase(); let mut seed_nodes: Vec = kg