Simple RAG
Set up semantic search with document ingestion and vector-based retrieval.
Install the SDK
Start by installing the TypeGraph SDK. Cloud mode only needs the SDK package. Self-hosted mode also needs a database adapter, an embedder, and an LLM when graph extraction is enabled.
Initialize TypeGraph
TypeGraph Cloud API keys resolve your Cloud organization and schema. Your application tenant is still supplied as tenantId during initialization. In self-hosted mode, vectorStore + embedding + searchEmbedding + llm is enough for 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.