judgeval
Version:
Judgment SDK for TypeScript/JavaScript
46 lines (45 loc) • 2.02 kB
TypeScript
import { Example, ExampleOptions } from '../example.js';
type SaveFileType = 'json' | 'csv' | 'yaml';
export declare class EvalDataset {
examples: Example[];
private _alias;
private _id;
constructor(examples?: Example[]);
addExample(e: Example): void;
get length(): number;
get alias(): string | null;
set alias(value: string | null);
get id(): string | null;
set id(value: string | null);
/**
* Adds examples from a JSON file.
* Assumes the JSON file has a top-level key "examples" containing an array of example objects.
* @param filePath Path to the JSON file.
*/
addFromJson(filePath: string): void;
/**
* Adds examples from a YAML file.
* Assumes the YAML file has a top-level key "examples" containing an array of example objects.
* @param filePath Path to the YAML file.
*/
addFromYaml(filePath: string): void;
/**
* Adds examples from a CSV file.
* @param filePath Path to the CSV file.
* @param headerMapping Dictionary mapping Example headers (keys) to custom headers in the CSV (values).
* @param primaryDelimiter Main delimiter used in CSV file. Defaults to ",".
* @param secondaryDelimiter Secondary delimiter for list fields (context, retrieval_context, etc.). Defaults to ";".
*/
addFromCsv(filePath: string, headerMapping: {
[key in keyof ExampleOptions]?: string;
}, primaryDelimiter?: string, secondaryDelimiter?: string): void;
/**
* Saves the dataset as a file.
* @param fileType The file type to save as ('json', 'csv', 'yaml').
* @param dirPath The directory path to save the file to.
* @param saveName Optional: The name of the file (without extension). Defaults to a timestamp.
* @param secondaryDelimiter Optional: The delimiter used for joining list fields in CSV output. Defaults to ";".
*/
saveAs(fileType: SaveFileType, dirPath: string, saveName?: string, secondaryDelimiter?: string): void;
}
export {};