@juspay/neurolink
Version:
The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002
29 lines (28 loc) • 1.26 kB
TypeScript
import type { EnhancedEvaluationContext, EvaluationResult, GetPromptFunction } from "../types/index.js";
/**
* Implements a RAGAS-style evaluator that uses a "judge" LLM to score the
* quality of an AI response based on rich, contextual information.
*/
export declare class RAGASEvaluator {
private evaluationModel;
private providerName;
private threshold;
private promptBuilder;
private promptGenerator?;
constructor(evaluationModel?: string, providerName?: string, threshold?: number, promptGenerator?: GetPromptFunction);
/**
* Evaluates an AI-generated response using a model-based approach.
*
* @param context The rich, contextual information for the evaluation.
* @returns A promise that resolves to a detailed `EvaluationResult`.
*/
evaluate(context: EnhancedEvaluationContext): Promise<EvaluationResult>;
/**
* Parses the raw JSON string from the judge LLM into a structured `EvaluationResult` object.
* It includes error handling to gracefully manage malformed JSON.
*
* @param rawResponse The raw string response from the evaluation model.
* @returns A structured object containing the evaluation scores and feedback.
*/
private parseEvaluationResponse;
}