feat: claude models usage, but from bedrock
Hey, folks! @abi I've noticed that other people have opened PRs integrating this project with Bedrock (#322, #357 and #367) and I'm opening this PR either way to collect your feedback and whether or not its of your interest to have it merged and be one of the available integrations. Let me know! I'm willing to treat this PR carefully to match the expected standards.
Amazing project by the way. Great work putting this up :pray:
Thanks!
I am interested in supporting bedrock. How are AWS credentials set with this PR? I also noticed a lot of copied code between the bedrock function and the regular Anthropic function. It would be nice to introduce less duplicated code.
How are AWS credentials set with this PR?
They're supported through AWS's Python SDK (boto3). boto3 accepts credentials in many different ways. On this initial implementation, boto looks for the credentials implicitly on:
- Environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and/or AWS_SESSION_TOKEN
- Shared credential file (~/.aws/credentials)
- AWS config file (~/.aws/config)
- Container credential provider (if deployed on AWS)
- Instance metadata service on an Amazon EC2 instance that has an IAM role configured (if deployed on AWS)
We can make that explicit too by passing the credentials directly into the SDK's initialization method. Let me know what works the best for you :hugs:
I also noticed a lot of copied code between the bedrock function and the regular Anthropic function. It would be nice to introduce less duplicated code.
Agreed! Will patch this PR with an abstraction to handle this :pray: (PS: Done!)
Thanks! I'll take a look soon.