fix(bedrock): use boto3 client for AWS region detection#1207
Open
micheallam130 wants to merge 2 commits intoanthropics:mainfrom
Open
fix(bedrock): use boto3 client for AWS region detection#1207micheallam130 wants to merge 2 commits intoanthropics:mainfrom
micheallam130 wants to merge 2 commits intoanthropics:mainfrom
Conversation
- Use boto3.client('bedrock').meta.region_name instead of
boto3.Session().region_name to properly detect AWS region
from ~/.aws/config when using AWS_PROFILE
- Add NoRegionError exception handling as fallback
- Fixes issue anthropics#892
The deepcopy_minimal function was not properly handling tuples that contain mutable objects like dicts. When a tuple containing a dict was passed, the dict inside would be mutated in place. This fix adds tuple handling to recursively copy contents within tuples. Fixes issue anthropics#1202
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes issue #892 - Bedrock client failing to detect AWS region correctly when using AWS_PROFILE.
Changes
boto3.client("bedrock").meta.region_nameinstead ofboto3.Session().region_nameto properly detect AWS region from~/.aws/configwhen usingAWS_PROFILENoRegionErrorexception handling as fallbackus-east-1Testing
This fix allows the Bedrock client to correctly detect the AWS region from the user's AWS configuration when using
AWS_PROFILEenvironment variable.