Skip to content

Documents and RAG

RAG lets an agent retrieve passages from documents it can access, then use them in its answer. There are two stages: index documents, at the request of a user or an automated process, then retrieve useful passages for each question.

01From documents to indexed passagesUpload through the interface or an automated process
UserUpload through the interface
Automated processUpload through API
BackendDocument indexing
Receive the uploadStore the original, record metadata and create the indexing job
RAG-IngestorRead the original, extract text and split it into passages
RAG-EmbedEmbed passages and write them to the vector database
Embedding modelText → vectors
Called by RAG-Embed
DatabaseJob orchestration
Metadata
Vector databaseVectors, passages
and references
Object storageOriginal files
Indexing continues after upload

The database coordinates jobs for both workers. RAG-Ingestor prepares passages there, then RAG-Embed builds their index. A document becomes searchable once this processing is complete.

02Answer with authorised passagesRetrieve from documents already indexed
User or applicationQuestion to the agent
Answer and sources
BackendAgent and RAG retrieval
1 · EmbedProduce the question embedding
2 · RetrieveFind relevant and authorised passages
3 · Build contextCombine question, instructions and excerpts
4 · AnswerGenerate the answer and cite sources
ModelsEmbedding for retrieval
Chat for answering
Vector databaseVectors, passages
and references
DatabaseDocument permissions
and metadata
Retrieval returns passages already indexed

The chat model receives the selected excerpts, question and agent instructions. Workers are not involved in each question. Original documents remain available through the cited sources.

The question embedding model must be compatible with the one used for indexed passages. Changing the model may require reindexing those documents.

Storage roles

Resource Contents Role in RAG
Database Jobs, state and document metadata Orchestrate processing, keep permissions and passages waiting for embedding
Vector database Vectors, passage text and references Retrieve relevant passages for a question
Object storage Original files Read documents during ingestion and allow source consultation

Text, scans and OCR

RAG ingestion extracts native text and does not automatically invoke an agent’s AI OCR. A mixed PDF retains its native text with a partial coverage diagnostic, while a fully scanned document without usable text is rejected. Specialised OCR belongs to conversation and Studio workflows, with the selected model’s capabilities and resources.

Deployment

Indexing depends on both workers, storage and the embedding model. Getting started leads you to the wizard to choose the default embedding.

A remote embedding provider receives the text to embed. A remote chat provider receives the passages selected for the answer. These exchanges are part of the deployment flows.

Install workers · Inference · Storage