export interface Episode { context: string; continuation: string; } export type TrainingItem = string | Episode; export declare const isEpisode: (it: TrainingItem) => it is Episode; /** One turn of a dialogue, attributed to a speaker. The speaker is only ever * used to decide MERGING (see `mergeSpeakerTurns`); it is never deposited. */ export interface SpeakerTurn { speaker: string; text: string; } /** Build the accumulated-context episodes of a turn sequence: each successive * turn is the continuation of ALL the turns before it joined together. This is * the same cumulative-context shape a multi-turn conversation deposits, so the * store learns to continue a growing context. * * The "\n" below is a CORPUS choice, not a protocol. oasst2 turns are * paragraphs, and reading them back with the newlines kept is how this corpus * reads naturally; a different corpus may join with nothing, and * test/13-conversation.test.mjs does exactly that. Neither has to match the * other, because Sema never scans content for turn boundaries — those are * offsets the Conversation API carries beside the bytes (see Mind.addTurn's * "ON SEPARATORS" note). The newline here is simply part of the text this * store learnt, so anything replaying this corpus feeds it back as part of * the turn: `addTurn(conv, "\n" + turnText)`. It is not a convention the * engine, the API, or the tests have to agree on. */ export declare function accumulate(turns: string[]): Episode[]; /** Collapse consecutive same-speaker turns into one, joining with a space, and * return the bare texts in order. A turn with no speaker never merges with its * neighbour: an unlabelled row is of unknown origin, and joining two of them * would invent a contribution that may span two speakers. * * Load-bearing for corpora that split one contribution across several indexed * utterances (an artifact of the collection UI). Left unmerged, the cumulative * walk deposits a turn boundary in the middle of one speaker's contribution * and teaches it as a hand-off. Measured share of turns absorbed by merging: * TM-1 17.7%, TM-2 11.9%, TM-3 0.8%, TM-4 0.0%. */ export declare function mergeSpeakerTurns(turns: SpeakerTurn[]): string[]; /** Dedup + trim a concept's items: drop empty/degenerate pairs and exact * repeats so a concept never deposits the same form twice. */ export declare function refineItems(items: TrainingItem[]): TrainingItem[]; /** Content size of a training item in UTF-8 bytes — the same quantity the * scaling suite (14-scaling.test.mjs) measures as KB/s: for an episode the * context plus the continuation, for a bare experience its own text. */ export declare const itemBytes: (it: TrainingItem) => number;