API reference#
Every public symbol has exactly one canonical module. The top-level
fastrag package re-exports the handful used in almost every script —
Document, ContentFormat,
Pipeline,
Policy,
Source — and both forms are equivalent.
Names reachable only through a _-prefixed module are internal and may
change without notice; see Architecture for why.
Symbol |
Canonical module |
|---|---|
Every exception |
fastrag.ingestion is the ingestion pipeline. Two types it produces or
depends on are shared beyond ingestion, so each lives at the top level
instead of under fastrag.ingestion: Document (parsed/chunked/embedded by
ingestion, but also what retrieval, querying, serving, and benchmarking will
consume) at fastrag.models, and VectorStore (written at ingest time, read
at query time) at fastrag.vector_store.
Symbol |
Canonical module |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fastrag.normalization interprets parsed content into source-preserving trees.
Symbol |
Canonical module |
|---|---|
|
fastrag.retrieval turns a query into the documents that answer it, on top
of a VectorStore opened by the caller.
Symbol |
Canonical module |
|---|---|
|
|
|
|
|
|
|
|
|
fastrag.query turns a retrieved-and-rendered prompt into a generated
answer. QueryEngine composes a Retriever, a PromptTemplate, and a
ChatModel into one ask/stream surface; chat models live under their own
fastrag.query.llm subpackage, the same shape as embedders under
fastrag.ingestion.steps.embedding.
Symbol |
Canonical module |
|---|---|
|
|
|
|
|
fastrag.query.chat persists the conversations a serving layer builds on
top of QueryEngine: anonymous sessions, the chats inside them, and the
messages inside those. Storage only — no FastAPI, no HTTP types, no SSE.
Symbol |
Canonical module |
|---|---|
|
|
|
fastrag.benchmark scores a retrieval or query pipeline against a QA
dataset: load a QADataset, run every sample through a Benchmark against
a Retriever (retrieval metrics) or a QueryEngine (generation and
operational metrics too), and compare runs with Comparison.
Symbol |
Canonical module |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fastrag.serve is the FastAPI app that exposes a QueryEngine plus a
ChatStore as the /v1 chats API over SSE. The app owns no database engine
and no ORM session — it is a thin adapter over the two collaborators a
caller hands to create_app().
Symbol |
Canonical module |
|---|---|
|
|
|
|
|
|
|
The full tree, generated from docstrings:
fastrag — SDK for building RAG chatbots from dynamic sources. |