UNPKG

@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

103 lines (102 loc) 3.61 kB
/** * @file EvaluatorFactory - Factory for creating evaluator instances. * Extends BaseFactory to provide dynamic evaluator creation with configuration support. */ import { BaseFactory } from "../core/infrastructure/index.js"; import type { EvaluationConfig, EvaluatorPreset } from "../types/index.js"; import { Evaluator } from "./index.js"; /** * Factory for creating Evaluator instances with various configurations. * Supports presets for common use cases and custom configurations. * * @example * ```typescript * const factory = EvaluatorFactory.getInstance(); * * // Create with default configuration * const evaluator = await factory.create('default'); * * // Create with a preset * const strictEvaluator = await factory.create('strict'); * * // Create with custom config * const customEvaluator = await factory.create('default', { * threshold: 9, * evaluationModel: 'gpt-4', * provider: 'openai' * }); * ``` */ export declare class EvaluatorFactory extends BaseFactory<Evaluator, EvaluationConfig> { private static instance; private constructor(); /** * Gets the singleton instance of the EvaluatorFactory. */ static getInstance(): EvaluatorFactory; /** * Resets the singleton instance (useful for testing). */ static resetInstance(): void; /** * Registers all built-in evaluator configurations. * This is called automatically on first access. */ protected registerAll(): Promise<void>; /** * Creates an evaluator instance with the specified preset and optional config overrides. * * @param presetOrName - The preset name or alias * @param config - Optional configuration overrides * @returns A configured Evaluator instance */ createEvaluator(presetOrName?: string, config?: EvaluationConfig): Promise<Evaluator>; /** * Creates an evaluator with a fully custom configuration (not based on a preset). * * @param config - The evaluation configuration * @returns A configured Evaluator instance */ createCustomEvaluator(config: EvaluationConfig): Evaluator; /** * Gets information about a preset by name or alias. * * @param presetOrName - The preset name or alias * @returns The preset information or undefined if not found */ getPresetInfo(presetOrName: string): Promise<EvaluatorPreset | undefined>; /** * Lists all available presets with their descriptions. * * @returns Array of preset information */ listPresets(): Promise<Array<{ name: string; aliases: string[]; preset: EvaluatorPreset; }>>; /** * Validates an evaluation configuration. * * @param config - The configuration to validate * @throws {NeuroLinkFeatureError} If the configuration is invalid */ validateConfig(config: EvaluationConfig): void; /** * Registers a custom evaluator preset. * * @param name - Unique name for the preset * @param config - The evaluation configuration for this preset * @param aliases - Alternative names for the preset * @param description - Human-readable description */ registerPreset(name: string, config: EvaluationConfig, aliases?: string[], description?: string): void; /** * Unregisters a preset from the factory. * * @param name - The preset name to remove * @returns true if the preset was removed, false if it didn't exist */ unregisterPreset(name: string): boolean; } export declare const getEvaluatorFactory: () => EvaluatorFactory;