@vfarcic/dot-ai
Version:
AI-powered development productivity platform that enhances software development workflows through intelligent automation and AI-driven assistance
73 lines • 2.5 kB
TypeScript
/**
* AI Provider Factory
*
* Creates AI provider instances based on configuration.
* Supports environment-based provider selection and extensible provider architecture.
*
* Phase 1 Implementation (PRD 73): anthropic, openai, google
* Architecture supports future expansion to 19+ Vercel AI SDK providers
*/
import { AIProvider, AIProviderConfig } from './ai-provider.interface';
/**
* Factory for creating AI provider instances
*
* Usage:
* ```typescript
* // Explicit provider selection
* const provider = AIProviderFactory.create({
* provider: 'anthropic',
* apiKey: process.env.ANTHROPIC_API_KEY
* });
*
* // Auto-detect from environment
* const provider = AIProviderFactory.createFromEnv();
* ```
*/
export declare class AIProviderFactory {
/**
* Create an AI provider instance with explicit configuration
*
* @param config Provider configuration
* @returns Configured AI provider instance
* @throws Error if provider type is unsupported or configuration is invalid
*/
static create(config: AIProviderConfig): AIProvider;
/**
* Create provider from environment variables
*
* Detects provider from AI_PROVIDER env var (defaults to 'anthropic')
* and loads corresponding API key from environment.
*
* If no API keys are configured, returns a NoOpAIProvider that allows
* the MCP server to start but returns helpful errors when AI is needed.
*
* @returns Configured AI provider instance or NoOpProvider if no keys available
*/
static createFromEnv(): AIProvider;
/**
* Check if a provider is available (has API key configured)
*
* @param provider Provider type to check
* @returns true if provider has API key configured
*/
static isProviderAvailable(provider: string): boolean;
/**
* Get list of available providers (implemented + have API keys configured)
*
* @returns Array of available provider types
*/
static getAvailableProviders(): string[];
/**
* Check if a provider is implemented in current phase
*
* @param provider Provider type to check
* @returns true if provider is implemented
*/
static isProviderImplemented(provider: string): boolean;
}
/**
* Convenience function to create AI provider from environment
* Maintains backward compatibility with existing code
*/
export declare function createAIProvider(): AIProvider;
//# sourceMappingURL=ai-provider-factory.d.ts.map