ds-sfcoe-ailabs
Version:
AI-powered code review tool with static analysis integration for comprehensive code quality assessment.
43 lines (42 loc) • 1.48 kB
TypeScript
import { AIProvider, AIProviderType } from './index.js';
/**
* Factory class for creating AI provider instances
*
* Centralizes the creation of AI provider implementations based on
* provider type. Supports OpenAI, Azure OpenAI, and Anthropic providers
* with proper configuration and authentication setup.
*
* @example
* ```typescript
* const provider = AIProviderFactory.createProvider(
* AIProviderType.OpenAI,
* 'sk-...',
* 'gpt-4'
* );
* const response = await provider.generateResponse('Review this code');
* ```
*/
export default class AIProviderFactory {
/**
* Gets an AI provider instance
*
* @param type - The type of AI provider to create
* @param token - The API token for the provider
* @param model - The model name to use
* @param apiEndpoint - Optional API endpoint URL for the provider
* @param apiVersion - Optional API version for the provider
* @returns An instance of the specified AI provider
* @throws Error when the provider type is unsupported
* @example
* ```typescript
* const provider = AIProviderFactory.getInstance(
* AIProviderType.OpenAI,
* 'sk-abc123',
* 'gpt-4',
* 'https://api.openai.com/v1'
* );
* const response = await provider.generateResponse('Review code');
* ```
*/
static getInstance(type: AIProviderType, token: string, model: string, apiEndpoint?: string, apiVersion?: string): AIProvider;
}