import type { BaseProvider, ProviderRequest, ProviderResponse } from "./types"; import { ProviderRegistry } from "./registry"; /** * Configuration for initializing providers */ export interface ProviderAdapterConfig { anthropic?: { apiKey: string; [key: string]: unknown; }; openai?: { apiKey: string; [key: string]: unknown; }; gemini?: { apiKey: string; [key: string]: unknown; }; tavily?: { apiKey: string; endpoint?: string; [key: string]: unknown; }; whoisxml?: { apiKey: string; cacheTTL?: number; [key: string]: unknown; }; } /** * Provider Adapter - Central manager for all providers * * This class simplifies provider initialization and provides a unified * interface for executing requests across different provider types. * * @example * ```typescript * const adapter = new ProviderAdapter({ * anthropic: { apiKey: process.env.ANTHROPIC_API_KEY }, * openai: { apiKey: process.env.OPENAI_API_KEY }, * tavily: { apiKey: process.env.TAVILY_API_KEY } * }); * * // Execute a request * const result = await adapter.execute('anthropic', { * input: 'Analyze this text...', * options: { model: 'claude-sonnet-4-5-20250929' } * }); * ``` */ export declare class ProviderAdapter { private readonly registry; constructor(config?: ProviderAdapterConfig); /** * Initialize providers based on configuration */ private initializeProviders; /** * Execute a request using the specified provider * * @param providerName - Name of the provider to use * @param request - Request to execute * @returns Provider response * * @throws Error if provider not found or request fails */ execute(providerName: string, request: ProviderRequest): Promise; /** * Get the underlying provider registry * Useful for advanced use cases like adding custom providers */ getRegistry(): ProviderRegistry; /** * Check if a provider is available */ hasProvider(name: string): boolean; /** * List all available providers */ listProviders(): string[]; /** * Register a custom provider * * @example * ```typescript * class CustomProvider extends BaseProvider { * constructor(config) { * super('custom', 'ai', config); * } * * async execute(request) { * // Implementation * } * } * * adapter.registerProvider(new CustomProvider({ apiKey: 'xxx' })); * ``` */ registerProvider(provider: BaseProvider): void; /** * Get a provider instance directly */ getProvider(name: string): BaseProvider; } /** * Create a provider adapter with simplified configuration * * @param config - Provider configuration * @returns Configured ProviderAdapter instance * * @example * ```typescript * const adapter = createProviderAdapter({ * anthropic: { apiKey: process.env.ANTHROPIC_API_KEY }, * openai: { apiKey: process.env.OPENAI_API_KEY } * }); * ``` */ export declare function createProviderAdapter(config: ProviderAdapterConfig): ProviderAdapter; //# sourceMappingURL=adapter.d.ts.map