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

feat: Add Bedrock provider #1008

Closed
wants to merge 9 commits into from
Closed

Conversation

unexge
Copy link
Contributor

@unexge unexge commented Jan 31, 2025

This PR adds Amazon Bedrock provider using aws-sdk-bedrockruntime crate and Converse API. It's in draft state yet. I plan to add some unit tests and perform some manual testing. I haven't used the UI app at all so far, and not sure if I need to make any changes there, if so I can do a follow-up PR.

@michaelneale
Copy link
Collaborator

@unexge very nice! running the tests now

@unexge
Copy link
Contributor Author

unexge commented Feb 1, 2025

Added Bedrock to provider and truncate agent tests and fixed a few things to make it pass, now it looks good. You will need to set up some AWS credentials to run those tests in the CI though.

Screen.Recording.2025-02-01.at.17.58.07.mov

@unexge unexge changed the title Add Bedrock provider feat: Add Bedrock provider Feb 1, 2025
@unexge unexge marked this pull request as ready for review February 1, 2025 18:02
Copy link
Collaborator

@ahau-square ahau-square left a comment

Choose a reason for hiding this comment

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

thanks for the contribution! doing a little bit of testing on my side now as well


let message = from_bedrock_message(&message)?;
let provider_usage = ProviderUsage::new(model_name.to_string(), usage);

Copy link
Collaborator

Choose a reason for hiding this comment

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

can you add some kind of debug trace here that emits the payload, response, and usage? it helps us debug sessions by writing to the logs. elsewhere we've used the emit_debug_trace function in super::utils but the payload here is a bit different

Ok((message, provider_usage))
}
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

might be better to move these bedrock formatting helpers into providers/formats/bedrock.rs, similar to what we have for openai, google, anthropic

@ahau-square
Copy link
Collaborator

I went ahead and made the above changes I requested in this PR: #1069

@ahau-square
Copy link
Collaborator

merged the changes in here: #1069

@ahau-square ahau-square closed this Feb 5, 2025
@unexge unexge deleted the add-bedrock-provider branch February 6, 2025 10:24
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.

3 participants