FastChunker uses chonkie-core for SIMD-accelerated boundary detection, enabling chunking speeds of 100+ GB/s.
Initialization
- Python
- JavaScript
Parameters
int
default:"4096"
Target chunk size in bytes (not tokens)
str
default:"\\n.?"
Single-byte delimiter characters to split on
str
default:"None"
Multi-byte pattern to split on (overrides delimiters if set)
bool
default:"False"
If True, keep the delimiter/pattern at the start of the next chunk instead of the end of the current chunk
bool
default:"False"
If True, split at the START of consecutive delimiter runs instead of the middle
bool
default:"False"
If True, search forward for a delimiter when none is found in the backward search window
Basic Usage
- Python
- JavaScript
Examples
Sentence-Based Chunking
Sentence-Based Chunking
Pattern-Based Chunking (SentencePiece)
Pattern-Based Chunking (SentencePiece)
Handling Consecutive Delimiters
Handling Consecutive Delimiters
Forward Fallback Search
Forward Fallback Search
Batch Processing
Batch Processing
High-Throughput Pipeline
High-Throughput Pipeline
Comparison with Other Chunkers
When to Use FastChunker
Use FastChunker when:- Processing large volumes of text (>100KB documents)
- Building high-throughput pipelines
- Byte-level precision is acceptable
- You don’t need exact token counts
- You need precise token counts for LLM context limits
- Working with small documents (< 1KB)
- Complex semantic boundaries are required
Return Type
FastChunker returns chunks asChunk objects:
The
token_count field is always 0 in FastChunker output.
If you need token counts, use the tokenizer separately or choose a different chunker.