Skip to content
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

AWS Bedrock support #388

Open
mnicstruwig opened this issue Dec 18, 2024 · 1 comment
Open

AWS Bedrock support #388

mnicstruwig opened this issue Dec 18, 2024 · 1 comment

Comments

@mnicstruwig
Copy link
Contributor

mnicstruwig commented Dec 18, 2024

Hi Jack 👋 ,

Probably a long-shot (given the large API differences), but are there any plans to support AWS Bedrock?

Given Amazon's investment into Anthropic, we've seen an uptick in interest in using Bedrock to run LLMs on their existing cloud infrastructure, and we'd like to continue using magentic.

Probably something better for Litellm?

@jackmpcollins
Copy link
Owner

jackmpcollins commented Dec 18, 2024

You could try it via the LitellmChatModel since they seem to support it https://docs.litellm.ai/docs/providers/bedrock

From the docs here https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html , the request (including messages) and response are different between the different models hosted on Bedrock. So magentic would need to know how to map from/to each of these, which would probably be easiest as a different ChatModel for each.

If Anthropic on Bedrock is all you need, you could create a copy of the AnthropicChatModel and just replace the Anthropic client with AnthropicBedrock client. https://docs.anthropic.com/en/api/claude-on-amazon-bedrock#making-requests
here:

self._client = anthropic.Anthropic(api_key=api_key, base_url=base_url)
self._async_client = anthropic.AsyncAnthropic(
api_key=api_key, base_url=base_url
)

Other models on Bedrock might similarly be accessible through their provider's SDK, which could be a nice way to implement this because then those providers would also be supported in magentic. This is currently only the case for OpenAI on Azure.

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

No branches or pull requests

2 participants