agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
32 lines • 1.41 kB
TypeScript
/**
* fixedWithOverlap — cut every `chars` characters, overlapping by `overlapChars`.
*
* Pattern: Strategy (one of `Splitter`).
* Role: rag/ layer. The fallback for text with no structure to read:
* transcripts, OCR output, scraped bodies with the markup gone.
* Emits: N/A.
*
* It is the least informed strategy and it is honest about that: it cuts where
* the counter says, which will sometimes be mid-sentence. The overlap is what
* makes that survivable — a sentence broken at a boundary is whole in the next
* chunk. Prefer `byHeading` or `byParagraph` whenever the document gives you
* anything to work with.
*
* Cuts are nudged to the nearest word boundary within a small window, so the
* common case does not split a word in half. The offsets move with the nudge;
* they always index the source.
*/
import type { Splitter } from '../types.js';
export interface FixedWithOverlapOptions {
/** Characters per chunk. Default 1000. */
readonly chars?: number;
/** Backward overlap. Default 150. */
readonly overlapChars?: number;
/**
* How far to look for a word boundary before accepting a mid-word cut.
* Default 40 characters. Set 0 to cut exactly on the count.
*/
readonly wordWindow?: number;
}
export declare function fixedWithOverlap(options?: FixedWithOverlapOptions): Splitter;
//# sourceMappingURL=fixedWithOverlap.d.ts.map