Chunking Component
Chunking Component prepares documents so an agent can search them. It splits each document into chunks (for example, one for each section of a manual) and, if you connect a vector database, stores them there so they can later be searched by meaning. It can also put tables and images into chunks of their own and add a short summary to each chunk.
Use it in the flow that loads your documents into a knowledge base, before an agent answers questions about them.
When to use it
- Loading product manuals, internal policies or contracts into a knowledge base.
- Preparing a service’s documentation for a support assistant.
- Separating the price tables of a catalogue so they are kept whole.
- Adding shared data to every chunk, such as the department or the document version.
Configuration
| Connection | What to connect |
|---|---|
| Data | The documents to split: text, messages, data or files, for example from a component that reads files. |
| Vector Store | Optional. The vector database where the chunks are stored, for example PGVector, Qdrant or Chroma DB. |
| Model | Optional. An AI model, needed for Generate Chunk Summaries. |
| Field | What it does |
|---|---|
| Use Hirarchichal Document Structure | Splits the document following its structure: one chunk per section. If the document already arrives with its sections identified, it respects them; otherwise it detects them from the titles (headings, numbered sections, lines in capitals). If it finds no titles, it splits the document into chunks of Chunk Size characters. Default: on. |
| Chunk Size | The maximum size of each chunk, in characters. Default: 1000. |
| Chunk Overlap | How many characters each chunk shares with the next, so ideas are not cut in half. Default: 200. |
| Chunking Strategy | How the text is cut when there is no structure to follow: Recursive (default) splits at paragraphs, lines and sentences; Character splits at blank lines; Token counts the size in tokens instead of characters. |
| Enable Table Extraction | Detects tables and keeps them whole in chunks of their own, without splitting them. Default: off. |
| Enable Image Extraction | Detects the document’s images, saves them as conversation files and links them to the chunks. Default: off. |
Two ways of splitting. With Use Hirarchichal Document Structure on, the component works by section and does not apply Chunk Overlap, table and image extraction, adaptive splitting or summaries. To use those options, turn it off: the document is then split by size, with Chunk Size and Chunk Overlap.
Advanced options
| Field | What it does |
|---|---|
| Enable Adaptive Chunking | Adjusts the size of each chunk to how dense the text is: smaller for dense text, larger for light text. Turning it on hides Chunk Size and Chunk Overlap and shows Minimum Chunk Size (default 300), Maximum Chunk Size (default 2000) and Content Density Threshold (0 to 1, default 0.6; the higher it is, the smaller the chunks of dense text). |
| Generate Chunk Summaries | Adds a one- or two-sentence summary to each chunk, written by the AI model connected to Model. Default: off. |
| System Prompt | Extra instructions for the summaries, for example the language they should be written in. |
| Custom Metadata | Data added to every chunk, such as the department, the customer or the document version. |
| Table/Image Context Characters | Appears when table or image extraction is on. How many characters of the surrounding text are kept with them. Default: 500. |
Output
Structured Chunks: a summary of the process as a message, with the number of documents and chunks, their sizes, the titles of the detected sections, how many tables and images were extracted and how many chunks were stored in the vector database. If something fails, the message states the error.
Example
The insurer Grupo Ancla wants its assistant to answer questions about its policy terms. In a loading flow, it connects the component that reads the policy PDFs to Data and a PGVector database to Vector Store. It keeps Use Hirarchichal Document Structure on so that each numbered clause ends up in its own chunk, and writes the policy type in Custom Metadata. Its agent then queries that knowledge base to answer customers.