@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
90 lines (89 loc) • 3.14 kB
TypeScript
/**
* Universal Provider Options Interface (Phase 1: Factory Pattern)
* Based on TypeScript factory pattern best practices for AI provider abstraction
*/
import type { BaseContext, ContextConfig } from "./context.js";
/**
* Base configuration interface for all AI providers
* Uses Parameter Object Pattern for flexible, extensible configuration
*/
export type UniversalProviderOptions = {
prompt?: string;
model?: string;
temperature?: number;
maxTokens?: number;
systemPrompt?: string;
enableAnalytics?: boolean;
enableEvaluation?: boolean;
context?: BaseContext;
contextConfig?: Partial<ContextConfig>;
metadata?: Record<string, unknown>;
extensionOptions?: Record<string, unknown>;
};
/**
* Generic provider options (without providerType)
*/
export type GenericProviderOptions = Omit<UniversalProviderOptions, "providerType">;
/**
* Provider-specific configuration extensions
* Discriminated union pattern for type-safe provider configs
*/
export type OpenAIProviderOptions = UniversalProviderOptions & {
providerType: "openai";
organization?: string;
seed?: number;
topP?: number;
};
export type GoogleAIProviderOptions = UniversalProviderOptions & {
providerType: "google-ai";
topK?: number;
candidateCount?: number;
stopSequences?: string[];
};
export type AnthropicProviderOptions = UniversalProviderOptions & {
providerType: "anthropic";
topK?: number;
stopSequences?: string[];
};
export type BedrockProviderOptions = UniversalProviderOptions & {
providerType: "bedrock";
inferenceProfileArn?: string;
region?: string;
};
/**
* Discriminated union for type-safe provider configuration
* Enables compile-time type checking for provider-specific options
*/
export type ProviderSpecificOptions = OpenAIProviderOptions | GoogleAIProviderOptions | AnthropicProviderOptions | BedrockProviderOptions;
/**
* Factory configuration interface
* Supports both universal and provider-specific parameters
*/
export type ProviderFactoryConfig = {
providerName: string;
modelName?: string;
options?: UniversalProviderOptions | ProviderSpecificOptions;
enableMCP?: boolean;
};
/**
* Parameter normalization utilities
* Converts between different parameter formats for backward compatibility
*/
export declare class ParameterNormalizer {
/**
* Normalize legacy parameter formats to universal format
*/
static normalizeToUniversal(optionsOrPrompt: UniversalProviderOptions | string): UniversalProviderOptions;
/**
* Retrieve the provider type if it exists, otherwise return null
*/
private static getProviderType;
/**
* Extract provider-specific parameters safely
*/
static extractProviderOptions<T extends ProviderSpecificOptions>(options: UniversalProviderOptions | ProviderSpecificOptions, providerType: T["providerType"]): T | GenericProviderOptions;
/**
* Merge default values with user-provided options
*/
static mergeWithDefaults(options: UniversalProviderOptions, defaults: Partial<UniversalProviderOptions>): UniversalProviderOptions;
}