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

fix(amazon-bedrock): image conversion in tool use #5364

Closed
wants to merge 2 commits into from

Conversation

dreamorosi
Copy link
Contributor

This PR fixes #5133.

This PR improves the handling of different content types in the amazon-bedrock package when working with tool usage and the experimental toToolResultContent function.

Specifically, the PR updates the logic that converts results to Bedrock messages by adding support for handling both text and image content.

Before this PR, as reported in the linked issue, this logic always assumed the result content was a text string and converted it to a JSON string, causing hallucinations.

@shaper
Copy link
Contributor

shaper commented Mar 26, 2025

Continuing this work with your commits to track credit in #5390

@shaper shaper closed this Mar 26, 2025
@dreamorosi
Copy link
Contributor Author

Thank you for looking at the PR, and sorry for not adding tests - I was unsure if the current test suite was enough because I saw it already tested for images, but after looking at your PR I agree I should have.

Will keep it in mind for the next PR.

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.

Tool result content is incorrectly serialized as a string when calling bedrock
2 participants