stanfordnlp/dspy

Support for AWS Credentials Input in dspy.Bedrock

Closed this issue · 3 comments

I would like to request support for providing AWS credentials directly as input parameters in the dspy.Bedrock function

Current Behavior:

Currently, the dspy.Bedrock function supports setting the AWS region and Profile but does not allow for AWS credentials (access key and secret access key) to be provided directly. The only method available is to use an AWS profile through the profile_name option, which assumes credentials are managed via the AWS credentials file.

Desired Behavior:

To enhance flexibility and use cases, I propose adding parameters to the dspy.Bedrock function that accept AWS credentials directly. This would allow users to specify:

aws_access_key_id
aws_secret_access_key

Thank you

Hi @joanacmesquitaf , feel free to add a PR to dspy.Bedrock as needed.

Additionally, this can also be configured by setting environment variables. Relevant example in this issue

Hello,

Just opened a PR: #1421

I was trying to use it within a Databricks cluster with AWS credentials configured. The configured AWS credentials dont have access to Bedrock. I trying setting new AWS credentials using environment variables as you suggested but the configured AWS credentials are being used instead of the new AWS credentials in the environment variables. The only solution seems passing the new AWS credentials as input to the classes.

Thank you

okhat commented

Thanks for opening this! We released DSPy 2.5 yesterday. I think the new dspy.LM and the underlying dspy.ChatAdapter will probably resolve this problem.

Here's the (very short) migration guide, it should typically take you 2-3 minutes to change the LM definition and you should be good to go: https://github.com/stanfordnlp/dspy/blob/main/examples/migration.ipynb

Please let us know if this resolves your issue. I will close for now but please feel free to re-open if the problem persists.