/** * Character-count text chunker: recursively splits text on separators from * coarsest to finest (paragraph, line, space, Unicode code point) and re-merges * adjacent pieces up to chunkSize, carrying chunkOverlap between successive * chunks. The finest grain is a code point, not a UTF-16 unit, so an astral * character cannot be emitted as a lone surrogate. Incoming text is passed * through {@link toWellFormedUnicode} so pre-existing lone surrogates become * U+FFFD before chunking; every emitted chunk is well-formed. The length * function may be async; chunkOverlap must be < chunkSize or the constructor * throws. Pieces that still exceed chunkSize are emitted and logged as a * warning. */ /** Parameters for {@link RecursiveCharacterTextSplitter}. */ export interface RecursiveCharacterTextSplitterParams { chunkSize?: number; chunkOverlap?: number; separators?: string[]; keepSeparator?: boolean; lengthFunction?: (text: string) => number | Promise; } /** * Recursively splits text on progressively finer separators until chunks fit `chunkSize`, * merging small pieces with overlap handling (character-length; default keepSeparator: true). */ export declare class RecursiveCharacterTextSplitter { private chunkSize; private chunkOverlap; private separators; private keepSeparator; private lengthFunction; constructor(fields?: RecursiveCharacterTextSplitterParams); private splitOnSeparator; private joinDocs; private mergeSplits; private _splitText; splitText(text: string): Promise; }