* fix(bedrock): improve AWS credential handling and add model definitions - Change error to warning when AWS credentials are missing in environment - Allow fallback to system configuration (aws config files or instance profiles) - Remove hardcoded region and profile parameters in Bedrock client - Add Claude 3.7 Sonnet and DeepSeek R1 model definitions for Bedrock - Update config manager to properly handle Bedrock provider * chore: cleanup and format and small refactor --------- Co-authored-by: Ray Krueger <raykrueger@gmail.com>
34 lines
907 B
JavaScript
34 lines
907 B
JavaScript
import { createAmazonBedrock } from '@ai-sdk/amazon-bedrock';
|
|
import { fromNodeProviderChain } from '@aws-sdk/credential-providers';
|
|
import { BaseAIProvider } from './base-provider.js';
|
|
|
|
export class BedrockAIProvider extends BaseAIProvider {
|
|
constructor() {
|
|
super();
|
|
this.name = 'Bedrock';
|
|
}
|
|
|
|
/**
|
|
* Override auth validation - Bedrock uses AWS credentials instead of API keys
|
|
* @param {object} params - Parameters to validate
|
|
*/
|
|
validateAuth(params) {}
|
|
|
|
/**
|
|
* Creates and returns a Bedrock client instance.
|
|
* See https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html
|
|
* for AWS SDK environment variables and configuration options.
|
|
*/
|
|
getClient(params) {
|
|
try {
|
|
const credentialProvider = fromNodeProviderChain();
|
|
|
|
return createAmazonBedrock({
|
|
credentialProvider
|
|
});
|
|
} catch (error) {
|
|
this.handleError('client initialization', error);
|
|
}
|
|
}
|
|
}
|