parea-ai
Version:
Client SDK library to connect to Parea AI.
57 lines (56 loc) • 2.06 kB
TypeScript
import { EvaluatedLog, EvaluationResult } from '../types';
/**
* Manages the context for experiments using the Singleton pattern.
*/
declare class ExperimentContext {
private static instance;
private context;
private constructor();
/**
* Gets the singleton instance of ExperimentContext.
* @returns The ExperimentContext instance.
*/
static getInstance(): ExperimentContext;
/**
* Runs a callback function within the context of an experiment.
* @param experimentUUID - The UUID of the experiment.
* @param callback - The function to run within the experiment context.
* @returns The result of the callback function.
*/
runInContext<T>(experimentUUID: string, callback: () => T): T;
/**
* Adds a score to the experiment context.
* @param experimentUUID - The UUID of the experiment.
* @param score - The evaluation result to add.
*/
addScore(experimentUUID: string, score: EvaluationResult): void;
/**
* Adds a score to the experiment context.
* @param experimentUUID - The UUID of the experiment.
* @param scores - The evaluation results to add.
*/
addScores(experimentUUID: string, scores: EvaluationResult[]): void;
/**
* Adds a log to the experiment context.
* @param experimentUUID - The UUID of the experiment.
* @param log - The evaluated log to add.
*/
addLog(experimentUUID: string, log: EvaluatedLog): void;
/**
* Retrieves the scores for a specific experiment.
* @param experimentUUID - The UUID of the experiment.
* @returns An array of evaluation results.
*/
getScores(experimentUUID: string): EvaluationResult[];
/**
* Retrieves the logs for a specific experiment.
* @param experimentUUID - The UUID of the experiment.
* @returns An array of evaluated logs.
*/
getLogs(experimentUUID: string): EvaluatedLog[];
}
/**
* The singleton instance of ExperimentContext.
*/
export declare const experimentContext: ExperimentContext;
export {};