Search works best on focused passages, not whole files. Chunking lets a query match the paragraph or table row range that answers it instead of retrieving a 50-page document.
What the chunker preserves
Ragrails chunks Markdown semantically before embedding:Inputs
The SDK and REST API accept a Markdown string or a list of document dictionaries. The CLI reads JSON document files from an input directory.Configuration
The same three sizing controls exist across SDK, CLI, REST, and the high-level ingest pipeline.
Overlap helps when a sentence or thought lands near a boundary. Keep it around 10% of
chunk_size unless retrieval quality tests show a reason to change it.
Metadata and output shape
Every chunk includes text for display, enriched text for embedding, and metadata for filtering, citations, and maintenance.embed_text prepends available title, heading path, and description to the visible chunk text. Use text for citations and UI display; use embed_text when sending chunks to embedding providers.
Chunking does not parse YAML frontmatter. Pass
title, description, source_kind, and other metadata explicitly, or preserve them from extraction outputs.Tables
Markdown tables get table-specific metadata. If a table is larger thanchunk_size, Ragrails splits it into row groups and repeats the table header in each chunk.
table_id, row_start, and row_end when you need table-aware citations or when you want to merge adjacent retrieved table chunks in an answer layer.
Ingest pipeline
When you call high-level ingestion, chunking is the stage between extraction and embedding. Pass chunking options through thechunking object.
Possible errors
Interface validation errors raise immediately in SDK and REST. Per-document core failures are returned in the resulterrors list when some inputs can still be processed. See Errors for the shared shapes.

