agsamantha/node_modules/langsmith/dist/evaluation/string_evaluator.d.ts

31 lines
1 KiB
TypeScript
Raw Normal View History

2024-10-02 15:15:21 -05:00
import { Example, Run, ScoreType, ValueType } from "../schemas.js";
import { EvaluationResult, RunEvaluator } from "./evaluator.js";
export interface GradingFunctionResult {
key?: string;
score?: ScoreType;
value?: ValueType;
comment?: string;
correction?: Record<string, unknown>;
}
export interface GradingFunctionParams {
input: string;
prediction: string;
answer?: string;
}
export interface StringEvaluatorParams {
evaluationName?: string;
inputKey?: string;
predictionKey?: string;
answerKey?: string;
gradingFunction: (params: GradingFunctionParams) => Promise<GradingFunctionResult>;
}
export declare class StringEvaluator implements RunEvaluator {
protected evaluationName?: string;
protected inputKey: string;
protected predictionKey: string;
protected answerKey?: string;
protected gradingFunction: (params: GradingFunctionParams) => Promise<GradingFunctionResult>;
constructor(params: StringEvaluatorParams);
evaluateRun(run: Run, example?: Example): Promise<EvaluationResult>;
}