RAG

Retrieval pipeline

How uploaded documents become grounded context for answers.

Indexing

Indexing transforms OCR-extracted pages into overlapping chunks, attaches page-span metadata, and creates embeddings. Page and document summaries are generated alongside the chunks. The goal is to preserve enough page context for citations while keeping retrieval precise.

From question to answer

At query time the pipeline routes the question, retrieves evidence with hybrid search, fuses the rankings, and streams a cited answer. Each stage is shown below.

Rendering diagram…
The retrieval pipeline. A router picks chunks or summaries; hybrid search and rank fusion select the final evidence.

Answer generation

  • Retrieved chunks are passed to the model as bounded, labeled sources.
  • The answer must stay inside the evidence provided by the document.
  • Citations are validated against source text and keep the answer page-linked.