-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(bedrock): add profile
argument to client
#648
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks! Just a minor comment on the docs
README.md
Outdated
or if you want to use a profile and region | ||
|
||
```py | ||
import os | ||
from anthropic import AnthropicBedrock | ||
|
||
PROFILE_NAME = os.getenv("PROFILE_NAME") | ||
REGION_NAME = os.getenv("REGION_NAME") | ||
|
||
client = AnthropicBedrock(aws_profile=PROFILE_NAME, aws_region=REGION_NAME) | ||
|
||
message = client.messages.create( | ||
max_tokens=1024, | ||
messages=[ | ||
{ | ||
"role": "user", | ||
"content": "Hello!", | ||
} | ||
], | ||
model="anthropic.claude-3-sonnet-20240229-v1:0", | ||
) | ||
print(message) | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I think this example is slightly too big, having either a list of supported additional client arguments or a small snippet like this would be best imo:
The bedrock client supports the following arguments for authentication
AnthropicBedrock(
aws_profile='...',
aws_region='us-east'
... etc
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done ✅ @RobertCraigie thank you!
README.md
Outdated
AnthropicBedrock( | ||
aws_profile='...', | ||
aws_region='us-east' | ||
... etc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah sorry I wasn't clear in my comment, I intended for ... etc
to be replaced with an exhaustive list of the supported options
... etc | |
aws_secret_key='...', | |
aws_access_key='...', | |
aws_session_token='...', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh fine, sorry, i did it @RobertCraigie
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
profile
argument to client
Add profile option to Bedrock client for profile selection
This update introduces a profile option to the Bedrock client, allowing users to select which profile to use when interacting with the Bedrock client.
In my scenario, I use SSO to access the AWS account. When attempting to run the code locally, it initially failed. By passing the profile_name in the boto3.Session(), the issue was resolved.