import { TranslateChunksComplete, TranslateChunksEvent } from "./translate.js"; import { LanguageModel } from "ai"; //#region src/accumulator.d.ts /** * Accumulated state from processing translation stream events. */ interface AccumulatorState { /** * The completion event, if received. */ readonly complete?: TranslateChunksComplete; /** * Sum of quality scores from chunk events. */ readonly totalQualityScore: number; /** * Number of chunks that had quality scores. */ readonly qualityScoreCount: number; /** * Count of wins per model during best-of-N selection. */ readonly modelWinCounts: ReadonlyMap; } /** * Creates the initial accumulator state. * * @returns A fresh accumulator state with zeroed counters. */ declare function createInitialAccumulatorState(): AccumulatorState; /** * Accumulates a translation stream event into the state. * * This is a pure function that returns a new state without modifying the input. * * @param state The current accumulator state. * @param event The event to accumulate. * @returns A new state with the event accumulated. */ declare function accumulateEvent(state: AccumulatorState, event: TranslateChunksEvent): AccumulatorState; /** * Returns the key with the highest value in a map. * * @param map A map of keys to numeric values. * @returns The key with the highest value, or undefined if the map is empty. */ declare function maxByValue(map: ReadonlyMap): K | undefined; //#endregion export { AccumulatorState, accumulateEvent, createInitialAccumulatorState, maxByValue };