Skip to content

Graph (GraphRAG)

CiteNexus can build an entity graph over your corpus and retrieve through it — but the graph is navigation over evidence, never a citation itself. Every graph hit resolves back down to a cited Evidence Unit before an answer is generated.

Declare the graph signal. ingest() only marks the graph dirty — co-mention edges are corpus-wide, so a per-ingest full rebuild would not scale. The rebuild is lazy on the read path: the first graph retrieval after an ingest brings the index up to date before it loads, so ask() always sees a graph consistent with every committed ingest.

rag = CiteNexus("./citenexus-data", embedder=..., generator=...,
signals=["embedding", "text", "graph"])
rag.ingest("annual-report.pdf")
response = rag.ask("How is the CFO connected to the audit committee?")
  • Co-mention (default, deterministic). Nodes and edges are derived from tokens that co-occur across Evidence Units — no model needed, fully reproducible.
  • LLM-distilled (when injected). Provide a graph distiller (via from_config, config.graph_distill) and LLMGraphDistiller extracts grounded entities and typed relations, each carrying an eu_ref back to its source unit; it degrades to the co-mention graph if distillation fails.

GraphRetriever matches query tokens to node labels and returns the nodes’ underlying Evidence Units as candidates (retrieval signal graph), which then go through the same fusion → grounding path as every other retriever. Import the pieces from citenexus.graph (GraphStore, GraphRetriever, LLMGraphDistiller).