(config: ChunkingConfig)
| 10 | protected lengthFunction: (text: string) => number; |
| 11 | |
| 12 | constructor(config: ChunkingConfig) { |
| 13 | this.chunkSize = config.chunkMaxLength; |
| 14 | this.chunkOverlap = config.chunkOverlap; |
| 15 | this.keepSeparator = true; |
| 16 | this.lengthFunction = (text: string) => text.length; |
| 17 | |
| 18 | if (this.chunkOverlap >= this.chunkSize) { |
| 19 | throw new Error('Cannot have chunkOverlap >= chunkSize'); |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | protected async splitText(text: string): Promise<string[]> { |
| 24 | throw new Error('splitText method must be implemented in subclass'); |
nothing calls this directly
no outgoing calls
no test coverage detected