Closed amir-ziaei closed 2 weeks ago
You can pass the bedrockOptions
parameter if you want to configure the bedrock library: https://sdk.vercel.ai/providers/ai-sdk-providers/amazon-bedrock#provider-instance
Agree this should be easier. I'll leave the issue open since configuration has come up multiple times for Bedrock.
Maybe this relevant? https://github.com/vercel/ai/pull/2409
The bedrockOptions
parameter solves this.
Context
The
createAmazonBedrock
function from the@ai-sdk/amazon-bedrock
package currently requires AWS credentials (access key ID and secret access key) to be provided explicitly via the options object or through environment variables. This implementation necessitates duplicating credentials in the project's.env
file, rather than leveraging the AWS profile configuration at the system level.Reproduction Steps
@ai-sdk/amazon-bedrock
package.AWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
are NOT defined.createAmazonBedrock
function to create a Bedrock instance, without passing a config object.Expected Behavior
createAmazonBedrock
to respect the AWS credentials set at the profile level.Actual Behavior
The
BedrockRuntimeClient
does not resolve credentials from the AWS profile configuration. Instead, it mandates the credentials to be provided either through the options object or environment variables, forcing users to duplicate their credentials in the.env
file of their project. Failure to comply results in an error:Proposed Change
Either:
BedrockRuntimeClient
.BedrockRuntimeClient
handle the credentials resolving.Code example
Additional context
@ai-sdk/amazon-bedrock
version0.0.9