import { Glossary } from "./glossary.cjs"; import { TranslationIssue } from "./evaluation.cjs"; import { LanguageModel } from "ai"; //#region src/select.d.ts /** * A translation candidate to be evaluated. */ interface Candidate { /** * The translated text. */ readonly text: string; /** * Optional metadata associated with this candidate (e.g., model info). */ readonly metadata?: T; } /** * A candidate with evaluation results and ranking. */ interface RankedCandidate extends Candidate { /** * The evaluation score (0-1). */ readonly score: number; /** * Issues found in the translation. */ readonly issues: readonly TranslationIssue[]; /** * The rank of this candidate (1-based, 1 is best). */ readonly rank: number; } /** * Options for the {@link selectBest} function. */ interface SelectBestOptions { /** * The target language of the translation. */ readonly targetLanguage: Intl.Locale | string; /** * The source language of the original text. */ readonly sourceLanguage?: Intl.Locale | string; /** * A glossary of terms that should be used consistently. */ readonly glossary?: Glossary; /** * An optional `AbortSignal` to cancel the selection. */ readonly signal?: AbortSignal; } /** * The result of the {@link selectBest} function. */ interface SelectBestResult { /** * The best candidate based on evaluation scores. */ readonly best: RankedCandidate; /** * All candidates with their evaluation results, sorted by rank. */ readonly all: readonly RankedCandidate[]; } /** * Evaluates multiple translation candidates and selects the best one. * * @param evaluatorModel The language model to use for evaluation. * @param original The original text that was translated. * @param candidates The translation candidates to evaluate. * @param options Selection options. * @returns A promise that resolves to the selection result. * @throws {RangeError} If no candidates are provided. */ declare function selectBest(evaluatorModel: LanguageModel, original: string, candidates: readonly Candidate[], options: SelectBestOptions): Promise>; //#endregion export { Candidate, RankedCandidate, SelectBestOptions, SelectBestResult, selectBest };