Simple RAG
Set up semantic search with document ingestion and vector-based retrieval.
Install the SDK
Install the TypeGraph SDK, a database adapter, an embedding provider, and an LLM provider when graph extraction is enabled.
Initialize TypeGraph
Use typegraphDeploy() to provision Postgres, then create a tenant-scoped client with typegraphInit(). The same vectorStore + embedding + searchEmbedding + llm configuration supports document search, graph extraction, graph APIs, and memory APIs.
Ingest Documents
Documents are durable long-form content. Use document.ingest() for one document or an array of documents. The default bucket is created automatically; pass bucketId when you want a named collection.
Search Documents
typegraph.search() separates what to search (resources) from how to score (weights). Use promptBuilder when you want TypeGraph to assemble the top results into an LLM-ready prompt string on the response.
Example: Feed the Prompt to an LLM
Example only. TypeGraph does not require an LLM for vector-only RAG. If you want grounded answer generation, pass response.prompt to any model in your application.