/**
 * @license
 * Copyright 2025 OElite Platform
 * SPDX-License-Identifier: Apache-2.0
 */
import { BaseProvider } from './baseProvider.js';
import { ProviderType } from './types.js';
/**
 * AWS Bedrock provider implementation
 * Supports foundation models via Amazon Web Services Bedrock
 */
export class BedrockProvider extends BaseProvider {
    static DEFAULT_REGION = 'us-east-1';
    constructor(config) {
        super({
            ...config,
            type: ProviderType.AWS_BEDROCK,
            region: config.region || BedrockProvider.DEFAULT_REGION,
        });
    }
    async doInitialize() {
        // Check for AWS credentials
        const accessKeyId = process.env['AWS_ACCESS_KEY_ID'] || this.config.apiKey;
        const secretAccessKey = process.env['AWS_SECRET_ACCESS_KEY'];
        if (!accessKeyId || !secretAccessKey) {
            throw new Error('AWS credentials not found. Set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables.');
        }
        const region = this.config.region || BedrockProvider.DEFAULT_REGION;
        console.log(`AWS Bedrock configured for region: ${region}`);
    }
    isConfigured() {
        const accessKeyId = process.env['AWS_ACCESS_KEY_ID'] || this.config.apiKey;
        const secretAccessKey = process.env['AWS_SECRET_ACCESS_KEY'];
        return !!accessKeyId && !!secretAccessKey;
    }
    async getAvailableModels() {
        // AWS Bedrock supports multiple model providers
        // This is a simplified list - in production, you'd query the Bedrock API
        const models = [
            {
                id: 'anthropic.claude-3-5-sonnet-20241022-v2:0',
                name: 'Claude 3.5 Sonnet (Bedrock)',
                provider: ProviderType.AWS_BEDROCK,
                description: 'Claude 3.5 Sonnet via AWS Bedrock',
                capabilities: {
                    supportsVision: true,
                    supportsStreaming: true,
                    supportsFunctionCalling: true,
                    maxTokens: 8192,
                    contextWindow: 200000,
                },
            },
            {
                id: 'anthropic.claude-3-haiku-20240307-v1:0',
                name: 'Claude 3 Haiku (Bedrock)',
                provider: ProviderType.AWS_BEDROCK,
                description: 'Fast and compact Claude model via AWS Bedrock',
                capabilities: {
                    supportsVision: false,
                    supportsStreaming: true,
                    supportsFunctionCalling: true,
                    maxTokens: 4096,
                    contextWindow: 200000,
                },
            },
            {
                id: 'meta.llama3-70b-instruct-v1:0',
                name: 'Llama 3 70B (Bedrock)',
                provider: ProviderType.AWS_BEDROCK,
                description: 'Meta Llama 3 70B via AWS Bedrock',
                capabilities: {
                    supportsVision: false,
                    supportsStreaming: true,
                    supportsFunctionCalling: false,
                    maxTokens: 2048,
                    contextWindow: 8192,
                },
            },
        ];
        return models;
    }
    async doHealthCheck() {
        // Simple health check - verify credentials are present
        if (!this.isConfigured()) {
            throw new Error('AWS Bedrock not properly configured');
        }
    }
    async createCompletion(_model, _messages, _options) {
        throw new Error('AWS Bedrock provider requires AWS SDK integration. Please use the AWS SDK to interact with Bedrock models.');
    }
    // eslint-disable-next-line require-yield
    async *createStreamingCompletion(_model, _messages, _options) {
        throw new Error('AWS Bedrock provider requires AWS SDK integration. Please use the AWS SDK to interact with Bedrock models.');
    }
    /**
     * Get AWS Bedrock configuration
     */
    getBedrockConfig() {
        return {
            region: this.config.region || BedrockProvider.DEFAULT_REGION,
            accessKeyId: process.env['AWS_ACCESS_KEY_ID'] || this.config.apiKey,
            hasCredentials: this.isConfigured(),
        };
    }
}
//# sourceMappingURL=bedrockProvider.js.map