Skip to main content
Retrieval-augmented generation (RAG) answers a question by retrieving passages from your documents and handing them to a language model. The quality of those answers depends on the shape of what you indexed. Chunks split on a fixed character count cut across sentences and merge unrelated sections, which weakens both retrieval and the answers built on it. A parse gives you the document’s real structure, so you can chunk on section boundaries, keep tables and their captions whole, and carry each chunk’s page and position for citation. This guide turns a parse into retrieval-ready chunks. For how the structure is produced, see how parsing works.

Prerequisites

  • A completed parse job.
  • The structured result for element structure, or the markdown format when you want ready-to-index text.

Chunk on section boundaries

Headings mark where one topic ends and the next begins, and their level records the section hierarchy. Walking the elements and starting a new chunk at each Title or SectionHeader keeps a section’s content together and splits where the document itself splits. Carrying the current heading path onto each chunk gives every chunk a breadcrumb of where it sits.

Keep tables whole

A table loses its meaning when a fixed-size splitter cuts it in half. Because a table is a single element, you can keep it intact as its own chunk, and pair it with a nearby caption for context. Serializing the grid to Markdown or to rows keeps the structure a language model can read.
Python

Carry provenance for citation

Each element carries its bbox, and the page it sits on is the page you are walking. Keeping these on a chunk lets an answer cite the page it came from and lets a reviewer find the exact region on the source. Attach them as metadata when you index a chunk.
Python
For chunks you feed straight to a language model, the markdown format is often enough on its own, since it already renders headings, lists, and tables. Reach for the structured result when you need per-element control over chunk boundaries and metadata.

The parsed document

The element model these chunks are built from.

Datasources

How Meibel indexes and retrieves over prepared content.