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

112 lines (111 loc) 3.81 kB
/** * @file EvaluatorRegistry - Registry for evaluation strategies. * Extends BaseRegistry to provide dynamic strategy registration and lookup. */ import { BaseRegistry } from "../core/infrastructure/index.js"; import type { EvaluationStrategyFunction, EvaluationStrategyMetadata } from "../types/index.js"; /** * Registry for evaluation strategies. * Allows dynamic registration and retrieval of evaluation strategies. * * @example * ```typescript * // Register a custom strategy * EvaluatorRegistry.getInstance().registerStrategy( * 'custom-ragas', * async () => ({ * evaluate: async (options, result) => { ... } * }), * { * name: 'Custom RAGAS', * description: 'Custom RAGAS implementation', * requiresLLM: true, * defaultModel: 'gpt-4', * defaultProvider: 'openai', * version: '1.0.0', * features: ['custom-metrics'] * } * ); * * // Get a strategy * const strategy = await EvaluatorRegistry.getInstance().getStrategy('ragas'); * ``` */ export declare class EvaluatorRegistry extends BaseRegistry<EvaluationStrategyFunction, EvaluationStrategyMetadata> { private static instance; private constructor(); /** * Gets the singleton instance of the EvaluatorRegistry. */ static getInstance(): EvaluatorRegistry; /** * Resets the singleton instance (useful for testing). */ static resetInstance(): void; /** * Registers all built-in evaluation strategies. * This is called automatically on first access. */ protected registerAll(): Promise<void>; /** * Registers an evaluation strategy with the registry. * * @param id - Unique identifier for the strategy * @param factory - Factory function that creates the strategy * @param metadata - Metadata about the strategy */ registerStrategy(id: string, factory: () => Promise<EvaluationStrategyFunction>, metadata: EvaluationStrategyMetadata): void; /** * Gets an evaluation strategy by ID. * * @param id - The strategy identifier * @returns The evaluation strategy function * @throws {NeuroLinkFeatureError} If the strategy is not found */ getStrategy(id: string): Promise<EvaluationStrategyFunction>; /** * Checks if a strategy exists in the registry. * * @param id - The strategy identifier * @returns true if the strategy exists */ hasStrategy(id: string): Promise<boolean>; /** * Lists all registered strategies with their metadata. * * @returns Array of strategy IDs and their metadata */ listStrategies(): Promise<Array<{ id: string; metadata: EvaluationStrategyMetadata; }>>; /** * Gets the metadata for a specific strategy. * * @param id - The strategy identifier * @returns The strategy metadata or undefined if not found */ getStrategyMetadata(id: string): Promise<EvaluationStrategyMetadata | undefined>; /** * Unregisters a strategy from the registry. * * @param id - The strategy identifier * @returns true if the strategy was removed, false if it didn't exist */ unregisterStrategy(id: string): Promise<boolean>; /** * Gets strategies that support a specific feature. * * @param feature - The feature to filter by * @returns Array of strategy IDs that support the feature */ getStrategiesWithFeature(feature: string): Promise<string[]>; /** * Gets strategies that use a specific provider. * * @param provider - The provider to filter by * @returns Array of strategy IDs that use the provider */ getStrategiesByProvider(provider: string): Promise<string[]>; } export declare const getEvaluatorRegistry: () => EvaluatorRegistry;