Compare commits

...

2 Commits

Author SHA1 Message Date
Ralph Khreish
30eac026c2 chore: cleanup and format and small refactor 2025-06-20 16:03:48 +03:00
Ray Krueger
9d431b4b03 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
2025-06-20 16:00:45 +03:00
6 changed files with 35 additions and 14 deletions

View File

@@ -0,0 +1,5 @@
---
"task-master-ai": patch
---
Improves Amazon Bedrock support

View File

@@ -596,9 +596,9 @@ async function runInteractiveSetup(projectRoot) {
!process.env.AWS_ACCESS_KEY_ID || !process.env.AWS_ACCESS_KEY_ID ||
!process.env.AWS_SECRET_ACCESS_KEY !process.env.AWS_SECRET_ACCESS_KEY
) { ) {
console.error( console.warn(
chalk.red( chalk.yellow(
'Error: AWS_ACCESS_KEY_ID and/or AWS_SECRET_ACCESS_KEY environment variables are missing. Please set them before using custom Bedrock models.' 'Warning: AWS_ACCESS_KEY_ID and/or AWS_SECRET_ACCESS_KEY environment variables are missing. Will fallback to system configuration. (ex: aws config files or ec2 instance profiles)'
) )
); );
setupSuccess = false; setupSuccess = false;

View File

@@ -496,7 +496,14 @@ function getParametersForRole(role, explicitRoot = null) {
*/ */
function isApiKeySet(providerName, session = null, projectRoot = null) { function isApiKeySet(providerName, session = null, projectRoot = null) {
// Define the expected environment variable name for each provider // Define the expected environment variable name for each provider
if (providerName?.toLowerCase() === 'ollama') {
// Providers that don't require API keys for authentication
const providersWithoutApiKeys = [
CUSTOM_PROVIDERS.OLLAMA,
CUSTOM_PROVIDERS.BEDROCK
];
if (providersWithoutApiKeys.includes(providerName?.toLowerCase())) {
return true; // Indicate key status is effectively "OK" return true; // Indicate key status is effectively "OK"
} }

View File

@@ -1,4 +1,20 @@
{ {
"bedrock": [
{
"id": "us.anthropic.claude-3-7-sonnet-20250219-v1:0",
"swe_score": 0.623,
"cost_per_1m_tokens": { "input": 3, "output": 15 },
"allowed_roles": ["main", "fallback"],
"max_tokens": 65536
},
{
"id": "us.deepseek.r1-v1:0",
"swe_score": 0,
"cost_per_1m_tokens": { "input": 1.35, "output": 5.4 },
"allowed_roles": ["research"],
"max_tokens": 65536
}
],
"anthropic": [ "anthropic": [
{ {
"id": "claude-sonnet-4-20250514", "id": "claude-sonnet-4-20250514",

View File

@@ -21,18 +21,10 @@ export class BedrockAIProvider extends BaseAIProvider {
*/ */
getClient(params) { getClient(params) {
try { try {
const { const credentialProvider = fromNodeProviderChain();
profile = process.env.AWS_PROFILE || 'default',
region = process.env.AWS_DEFAULT_REGION || 'us-east-1',
baseURL
} = params;
const credentialProvider = fromNodeProviderChain({ profile });
return createAmazonBedrock({ return createAmazonBedrock({
region, credentialProvider
credentialProvider,
...(baseURL && { baseURL })
}); });
} catch (error) { } catch (error) {
this.handleError('client initialization', error); this.handleError('client initialization', error);

View File

@@ -266,6 +266,7 @@ describe('Validation Functions', () => {
expect(configManager.validateProvider('perplexity')).toBe(true); expect(configManager.validateProvider('perplexity')).toBe(true);
expect(configManager.validateProvider('ollama')).toBe(true); expect(configManager.validateProvider('ollama')).toBe(true);
expect(configManager.validateProvider('openrouter')).toBe(true); expect(configManager.validateProvider('openrouter')).toBe(true);
expect(configManager.validateProvider('bedrock')).toBe(true);
}); });
test('validateProvider should return false for invalid providers', () => { test('validateProvider should return false for invalid providers', () => {