fastrag#
fastrag — SDK for building RAG chatbots from dynamic sources.
- class fastrag.Document(id, source_id, content, step_config_hash='', embedding=None, metadata=<factory>, cached=False)[source]#
Bases:
objectA text-based unit processed along the pipeline.
The same type represents a whole parsed document and a chunk of one;
metadataandstep_config_hashcarry lineage rather than a separate subtype per stage.- Parameters:
- step_config_hash#
Hash of the upstream transform’s configuration, used for cache invalidation.
- Type:
- metadata#
Extended metadata tracking lineage, chunk offsets, URL filters, and parser outputs. Reserved keys include
source_uriandcontent_type(the originatingSource’s URI and media type) andcontent_format(aContentFormatvalue describing what kind of stringcontentis) — all three stamped bybuild_document()so no parser can forget them.
Modules
Benchmarking: load a dataset, score a pipeline against it, compare runs. |
|
Exception hierarchy. |
|
fastrag.ingestion — lazy, event-emitting ingestion pipeline. |
|
|
|
|
|
Extensible source-preserving normalization separate from ingestion parsers. |
|
Querying: turning retrieved documents and a question into a generated answer. |
|
Retrieval: turning one query into the documents that answer it. |
|
Serving: a FastAPI app that persists chats and streams grounded answers. |
|
|