RAG

Retrieval pipeline

How uploaded documents become grounded context for answers.

Indexing

Indexing prefers Mistral OCR blocks and falls back to parsing page Markdown into structural units. It assembles chunks around a 450-word target with roughly 75 words of overlap at whole-unit boundaries where possible. Tables remain intact even above the target; oversized prose alone is split at paragraph, sentence, then word boundaries. Exact page spans map chunk offsets back to citation pages. Page and document summaries are generated alongside the chunks.

From question to answer

At query time the pipeline rewrites the question and applies its scope. Document-scoped questions route to summaries or hybrid search; current-page questions load only overlapping page chunks. The selected evidence then feeds a streamed, cited answer.

Rendering diagram…
The retrieval pipeline. Document scope routes to summaries or hybrid ranking; current-page scope follows a bounded page-overlap path.

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.