100 lines
2.6 KiB
TypeScript
100 lines
2.6 KiB
TypeScript
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
import type { OpenAIModelGraderInput } from "./OpenAIModelGraderInput";
|
|
import type { OpenAISimilarityMetric } from "./OpenAISimilarityMetric";
|
|
import type { OpenAIStringCheckOp } from "./OpenAIStringCheckOp";
|
|
|
|
export type OpenAIGrader =
|
|
| {
|
|
type: "string_check";
|
|
name: string;
|
|
/**
|
|
* Operation: eq (exact match), ne (not equal), like (contains, case-sensitive), ilike (contains, case-insensitive)
|
|
*/
|
|
operation: OpenAIStringCheckOp;
|
|
/**
|
|
* Template to extract value from model output
|
|
*/
|
|
input: string;
|
|
/**
|
|
* Expected value to compare against
|
|
*/
|
|
reference: string;
|
|
}
|
|
| {
|
|
type: "text_similarity";
|
|
name: string;
|
|
/**
|
|
* Metric: bleu, fuzzy_match, gleu, meteor, rouge_1-5, rouge_l
|
|
*/
|
|
evaluation_metric: OpenAISimilarityMetric;
|
|
/**
|
|
* Template to extract text from model output
|
|
*/
|
|
input: string;
|
|
/**
|
|
* Reference text for similarity comparison
|
|
*/
|
|
reference: string;
|
|
}
|
|
| {
|
|
type: "score_model";
|
|
name: string;
|
|
/**
|
|
* Model for scoring (e.g., "gpt-4o", "o3-mini")
|
|
*/
|
|
model: string;
|
|
/**
|
|
* System/user messages defining scoring rubric
|
|
*/
|
|
input: Array<OpenAIModelGraderInput>;
|
|
/**
|
|
* Score range for normalization (e.g., [0.0, 1.0])
|
|
*/
|
|
range: [number, number] | null;
|
|
}
|
|
| {
|
|
type: "label_model";
|
|
name: string;
|
|
/**
|
|
* Model for classification
|
|
*/
|
|
model: string;
|
|
/**
|
|
* All possible output labels
|
|
*/
|
|
labels: Array<string>;
|
|
/**
|
|
* Labels considered successful/passing
|
|
*/
|
|
passing_labels: Array<string>;
|
|
/**
|
|
* Messages defining classification criteria
|
|
*/
|
|
input: Array<OpenAIModelGraderInput>;
|
|
}
|
|
| {
|
|
type: "python";
|
|
name: string;
|
|
/**
|
|
* Python code implementing custom scoring logic
|
|
*/
|
|
source: string;
|
|
/**
|
|
* Optional Docker image for sandboxed execution
|
|
*/
|
|
image_tag: string | null;
|
|
}
|
|
| {
|
|
type: "multi";
|
|
/**
|
|
* Math expression using grader names (e.g., "0.8 * accuracy + 0.2 * fluency")
|
|
* Supports: +, -, *, /, ^, min, max, abs, floor, ceil, exp, sqrt, log
|
|
*/
|
|
calculate_output: string;
|
|
/**
|
|
* Named graders to combine
|
|
*/
|
|
graders: { [key in string]: OpenAIGrader };
|
|
name: string;
|
|
};
|