/** * 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; metadata?: Record; extensionOptions?: Record; }; /** * Generic provider options (without providerType) */ export type GenericProviderOptions = Omit; /** * 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(options: UniversalProviderOptions | ProviderSpecificOptions, providerType: T["providerType"]): T | GenericProviderOptions; /** * Merge default values with user-provided options */ static mergeWithDefaults(options: UniversalProviderOptions, defaults: Partial): UniversalProviderOptions; }