@juspay/neurolink
Version:
Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio
48 lines (47 loc) • 2 kB
TypeScript
/**
* @file Implements the ContextBuilder class for creating rich evaluation context.
*/
import type { LanguageModelV3CallOptions } from "@ai-sdk/provider";
import type { EnhancedEvaluationContext, EvaluationResult, GenerateResult } from "../types/index.js";
/**
* Builds the enhanced context required for a RAGAS-style evaluation.
* This class gathers data from the generation options and results to create a
* rich snapshot of the interaction, which is then used by the evaluator.
*/
export declare class ContextBuilder {
private attemptNumber;
private previousEvaluations;
private extractTextFromContent;
/**
* Builds the full evaluation context for a single evaluation attempt.
*
* @param options The original `TextGenerationOptions` used for the request.
* @param result The `GenerateResult` from the provider.
* @returns An `EnhancedEvaluationContext` object ready for evaluation.
*/
buildContext(options: LanguageModelV3CallOptions, result: GenerateResult): EnhancedEvaluationContext;
/**
* Records the result of an evaluation and increments the internal attempt counter.
* This is used to build up the `previousEvaluations` array for subsequent retries.
*
* @param evaluation The `EvaluationResult` from the last attempt.
*/
recordEvaluation(evaluation: EvaluationResult): void;
/**
* Resets the internal state of the context builder. This should be called
* before starting a new, independent evaluation sequence.
*/
reset(): void;
/**
* Analyzes the user's query to determine intent and complexity.
* @param query The user's input query.
* @returns A QueryIntentAnalysis object.
*/
private analyzeQuery;
/**
* Maps the tool execution format from GenerateResult to the canonical ToolExecution type.
* @param result The result from the generate call.
* @returns An array of ToolExecution objects.
*/
private mapToolExecutions;
}