Graph RAG
Build a graph-augmented RAG system with document extraction, facts, entities, and weighted search.
Install the SDK
Cloud mode only needs the TypeGraph SDK. Self-hosted mode uses the pgvector adapter, an embedder, and an LLM. Bridge constructors are not part of the public setup path.
Initialize With an LLM
graphExtraction: true runs the configured extractor. In Cloud, TypeGraph manages extraction infrastructure. In self-hosted mode, pass vectorStore, embedding, optional searchEmbedding, and llm.
Create a Graph-Enabled Bucket
Buckets are named namespaces for documents and event artifacts. Enable graph extraction at the bucket level when most writes to that bucket should produce entities and facts.
Ingest Documents With Graph Extraction
Document ingestion produces chunks and embeddings. When graph extraction is enabled, TypeGraph also extracts entities, facts, and provenance links from the document content.
Search With Graph Weighting
resources controls what can be returned. weights.graph controls how strongly graph evidence influences ranking. Use explain: true while tuning graph behavior.
Graph-Augmented RAG Pipeline
Use promptBuilder to produce the LLM-ready response.prompt. The graph contributes facts and entity context, while document chunks remain the grounded text evidence.