Fixed Size Chunking

Split documents into character-limited chunks with configurable overlap.

FixedSizeChunking splits document text into chunks of at most chunk_size characters and keeps words intact when possible.

ParameterTypeDefaultDescription
chunk_sizeint5000Maximum characters per chunk. Use a positive value.
overlapint0Characters repeated between adjacent chunks. Use 0 <= overlap < chunk_size.

Pass chunk_size > 0 and 0 <= overlap < chunk_size. The constructor raises ValueError when overlap >= chunk_size, but a negative overlap can pass validation and produce invalid chunks.