RecursiveChunkingConfiguration Configuration
RecursiveChunkingConfiguration Configuration documentation for Java SDK
RecursiveChunkingConfiguration
Recursive hierarchical chunking strategy with configurable separators and overlap
Properties
| Name | Type | Description | Notes |
|---|---|---|---|
| chunkSize | Integer | Maximum size of a chunk (should be ≤ context window) | |
| chunkOverlap | Integer | Sliding overlap between chunks | |
| separators | List<String> | Hierarchical separator list (order = preference) | [optional] |
| keepStrategy | SeparatorKeepStrategy | How to handle separators after splitting. KEEP_NONE is deprecated and behaves as KEEP_END. | |
| separatorIsRegex | Boolean | Whether separators are regex patterns | [optional] |
| lengthMeasurement | LengthMeasurement | How to measure chunk length |
Usage Example
import ai.pairsys.goodmem.client.model.*;
RecursiveChunkingConfiguration config = new RecursiveChunkingConfiguration()
.chunkSize(512)
.chunkOverlap(64)
.keepStrategy(SeparatorKeepStrategy.KEEP_END)
.lengthMeasurement(LengthMeasurement.CHARACTER_COUNT);
// With custom separators
RecursiveChunkingConfiguration customConfig = new RecursiveChunkingConfiguration()
.chunkSize(1024)
.chunkOverlap(128)
.addSeparatorsItem("\n\n")
.addSeparatorsItem("\n")
.addSeparatorsItem(". ")
.keepStrategy(SeparatorKeepStrategy.KEEP_END)
.lengthMeasurement(LengthMeasurement.CHARACTER_COUNT);