import { S as Score, V as ValidateName, a as ScorerOptions, b as Scorer } from '../name-validation.d-BKPGh6r3.js'; export { c as ScoreWithName, d as ScorerLike } from '../name-validation.d-BKPGh6r3.js'; import './aggregations.js'; type Simplify = { [K in keyof T]: T[K]; } & {}; type ScorerReturnValue = number | boolean | Score; type AwaitedValue = T extends Promise ? U : T; type InferScorerMetadata = AwaitedValue extends Score ? TMetadata : Record; type NormalizeScorerReturn> = T extends Promise ? Promise> : Score; /** * Creates a scorer to be used in evals. * * Scorers need to return a number or a boolean. If returning a number, it is * suggested that this number is between 0 and 1. * * @example * const scorer = createScorer('exact-match', * (args: { output: string; expected: string; }) => { * return args.output === args.expected ? true : false; * } * ); * * @example * // With aggregation for trials * import { PassAtK } from '@axiomhq/ai/scorers/aggregations'; * const scorer = createScorer('tool-called', * (args: { output: string }) => args.output.includes('tool') ? 1 : 0, * { aggregation: PassAtK({ threshold: 0.8 }) } * ); */ declare function createScorer = {}, TInput = [TArgs] extends [{ input: infer I; }] ? I : unknown, TExpected = [TArgs] extends [{ expected: infer E; }] ? Exclude : unknown, TOutput = [TArgs] extends [{ output: infer O; }] ? Exclude : never, TExtra extends Record = Simplify>, TReturn extends ScorerReturnValue | Promise = ScorerReturnValue | Promise, TName extends string = string>( /** * The name of the scorer */ name: ValidateName, /** * The scorer function. Can be sync or async. */ fn: (args: TArgs) => TReturn, /** * Optional configuration for the scorer, including aggregation for trials. */ options?: ScorerOptions): [TOutput] extends [never] ? never : Scorer, NormalizeScorerReturn>>; export { Score, createScorer as Scorer, ScorerOptions, Scorer as ScorerType };