Files
claude-task-master/src/ai-providers/bedrock.js
Ralph Khreish 78112277b3 fix(bedrock): improve AWS credential handling and add model definitions (#826)
* 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>
2025-06-20 15:05:20 +02:00

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);
}
}
}