chunk-engine
Chunking Modes

section

Group all content under a heading into a single chunk.

View raw

section keeps everything under a heading together in one chunk — the heading plus its paragraphs, lists, and tables. It's the go-to mode for building a document search index where each result should be a self-contained section.

from py_chunks import get_chunks

chunks = get_chunks("handbook.docx", mode="section")

content_type

Section chunks carry the content_type section. Metadata typically includes the section heading and heading path so you can show breadcrumbs in results.

Section chunks are capped at roughly 2,000 characters; longer sections are split so no single chunk becomes unwieldy for embedding.

When to use it

  • Document search indexes where a hit should return a whole section.
  • RAG where you want enough surrounding context to answer, but scoped to one topic.
  • Navigation / outline features keyed on headings.

On this page