The ingest pipeline
Upload a document and the API extracts its text, splits it into overlapping chunks, embeds each chunk, and stores the vectors in Chroma. The document’s metadata and status live in FerretDB; the vectors live on thevoicera_oss_chroma_data volume. Every organisation shares one rag_docs collection (rag/chroma_store.py); isolation comes from the per-org directory each store is opened in, not from the collection name.
Defaults, from apps/api/app/rag/ingest_pipeline.py:
Ingestion is asynchronous. A document moves through
processing → ready, or failed.
Per-organisation collections
Chunks are scoped to the organisation that uploaded them. A retrieval never crosses that boundary, so two tenants sharing a deployment cannot read each other’s documents.The two retrieval modes
Setmode on the agent’s knowledge_base block. They behave very differently.
- context
- tool
Retrieve on every turn, prepend to the message.Before the model sees the caller’s message, the runtime retrieves the top matching chunks and augments the message with them.
- Predictable — grounding is always present.
- Costs one retrieval per turn, and spends tokens even when the turn needed no lookup.
- Good for narrow agents where nearly every question is about the documents.
apps/runtime/services/knowledge/: context_processor.py is a Pipecat frame processor for context mode, tool.py builds the tool definition for tool mode, and setup.py wires whichever the agent selected.
Attaching documents to an agent
top_k is the accuracy-versus-cost dial: more chunks give the model more to work with and cost more tokens per turn.
The runtime parses this block more permissively than the API validates it — an unknown
mode falls back to context, and top_k is clamped. A document written straight into FerretDB can therefore behave differently from one created through the API.Retrieval at call time
Retrieval goes through the API rather than the runtime reaching into Chroma directly:Managing documents
Requirements and limits
The dashboard’s Knowledge Base screen is backed by the API — it lists, previews, uploads, and deletes documents through
/knowledge. The API remains the complete surface; the screen covers the common operations. See Dashboard tour.