Skip to content

feat: claude models usage, but from bedrock #487

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

marcelovicentegc
Copy link

@marcelovicentegc marcelovicentegc commented Feb 3, 2025

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 🙏

@abi
Copy link
Owner

abi commented Feb 3, 2025

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.

@marcelovicentegc
Copy link
Author

marcelovicentegc commented Feb 3, 2025

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:

  1. Environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and/or AWS_SESSION_TOKEN
  2. Shared credential file (~/.aws/credentials)
  3. AWS config file (~/.aws/config)
  4. Container credential provider (if deployed on AWS)
  5. 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 🤗

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 🙏 (PS: Done!)

@@ -29,6 +31,7 @@ class Llm(Enum):
CLAUDE_3_5_SONNET_2024_10_22 = "claude-3-5-sonnet-20241022"
GEMINI_2_0_FLASH_EXP = "gemini-2.0-flash-exp"
O1_2024_12_17 = "o1-2024-12-17"
BEDROCK_CLAUDE_3_5_SONNET_2024_06_20 = "anthropic.claude-3-5-sonnet-20240620-v1:0"
Copy link
Author

@marcelovicentegc marcelovicentegc Feb 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not using the latest Claude 3.5 sonnet here (v2, 2024-10-22) because I still don't have access to it on AWS to test it - but should work either way.

@abi we could work on creating a dropdown menu or something on the front-end to allow users to select the model they want to use based on what's available on their environment. Let me know if something like this is already on the radar. It occurs to me that this would be specially useful for Bedrock since equivalent models such as DeepSeek R1 will be available there any time soon.

@abi
Copy link
Owner

abi commented Feb 4, 2025

Thanks! I'll take a look soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants