Skip to main content
The Ragrails SDK has two main workflows. rag.ingest() builds a searchable knowledge base from your sources. rag.query() searches that knowledge base. rag.chat() builds on retrieval by sending retrieved context to your configured LLM and returning a grounded answer. Start with the workflows when you want the shortest path. Use the pipeline stage pages when you need to inspect output, tune behavior, or run one part directly.

Configure Once

Constructor defaults are SDK-only. They do not write .ragrails.toml and they do not affect CLI or REST defaults.
The constructor uses vector_store={"provider": ...} plus top-level collection=. Per-call stage methods use vector_db=, collection=, url=, and options= when overriding one call.

Workflows

Ingest

Extract sources, chunk them, embed them, and store them in a vector database.

Query

Retrieve matching chunks or generate grounded answers from the indexed knowledge base.

Pipeline

The pipeline stages are the lower-level building blocks behind the workflows.

Overview

See how extraction, chunking, embedding, storing, retrieval, chat, and maintenance fit together.

Extraction

Load documents, websites, APIs, or direct Markdown before indexing.

Chunking

Split normalized Markdown into searchable passages.

Embedding

Convert chunks into vectors with your embedding model.

Storing

Write embedded chunks to the configured vector database.

Retrieval

Find the chunks most relevant to a user query.

Chat

Use retrieved context to answer with an LLM.

Knowledge Base Maintenance

Update or remove stored chunks so answers stay current.

Stage Flow

Result Objects

Ragrails returns dataclass result objects. The data flowing between stages is plain dictionaries so you can inspect, persist, or transform it.

Install

For website extraction:
Use SDK Quickstart for a copy-paste run, then use Pipeline Overview to choose the right SDK entry point.