anthropic-sdk-python
anthropic-sdk-python copied to clipboard
Feature: Support for access aws bedrock through role arn directly and retrieve the AKSK from boto3.Session directly
Currently, if we want to access the aws bedrock through role arn, we should
bedrock_role="arn:aws:iam::xxxx:role/bedrock-access-role"
credentials = boto3.client('sts').assume_role(RoleArn=bedrock_role,RoleSessionName='assume-role')
client = AnthropicBedrock(aws_region="us-west-2", aws_access_key=credentials['Credentials']['AccessKeyId'], aws_secret_key=credentials['Credentials']['SecretAccessKey'])
Should we support access aws bedrock through role arn directly? such as
client = AnthropicBedrock(aws_region="us-west-2", aws_role_arn="arn:aws:iam::xxxx:role/bedrock-access-role")
Another feature is that we could get the AKSK and region from boto3.Session directly, and those data from the credential file under the default .aws folder.
c= boto3.Session()
cr=c.get_credentials().get_frozen_credentials()
cr.access_key
cr.secret_key
c.region_name
If one of them could be approved, May I push the related PR?