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

Allow Bedrock Converse to accept native images instead of base64 (33% penalty!) #6785

Open
2 tasks
jaredmcqueen opened this issue Jan 9, 2025 · 4 comments
Open
2 tasks
Assignees
Labels
feature-request New feature or enhancement. May require GitHub community feedback. p2 This is a standard priority issue queued This issues is on the AWS team's backlog service-api This issue is due to a problem in a service API, not the SDK implementation.

Comments

@jaredmcqueen
Copy link

Describe the feature

When using the converse API, any image file attached gets base64 encoded. Unfortunately that balloons the size to 33% higher than the actual file.

For example - if i have image.png that is 4.8MB and want to send it to claude sonnet 3.5 v2, it balloons to 6.4MB!

The model returned the following errors: messages.0.content.1.image.source: image exceeds 5 MB maximum: 6737924 bytes > 5242880 bytes

base64 incurs a 33% penalty!
https://en.wikipedia.org/wiki/Data_URI_scheme

image
image

Use Case

It's frustrating to limit images to LLM calls using converse API be 3.75 MB when the actual image size threshold should be 5.0MB or higher.

Proposed Solution

allow the ability to natively pass images in without base64 encoding

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

SDK version used

@aws-sdk/client-bedrock": "^3.687.0

Environment details (OS name and version, etc.)

MacOS

@jaredmcqueen jaredmcqueen added feature-request New feature or enhancement. May require GitHub community feedback. needs-triage This issue or PR still needs to be triaged. labels Jan 9, 2025
@zshzbh zshzbh self-assigned this Jan 9, 2025
@zshzbh zshzbh added service-api This issue is due to a problem in a service API, not the SDK implementation. p2 This is a standard priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Jan 9, 2025
@zshzbh
Copy link
Contributor

zshzbh commented Jan 9, 2025

Hey @jaredmcqueen ,

Thanks for the feedback and sorry for the experience. I tried to use a 4.8MB image in Bedrock playground using Claude 3.5 and encountered the same issue. It's an issue from Bedrock service and I've reached out to bedrock team regarding this issue.

I will keep you updated!

Thanks!
Maggie

@zshzbh zshzbh added the queued This issues is on the AWS team's backlog label Jan 9, 2025
@kuhe
Copy link
Contributor

kuhe commented Jan 9, 2025

Likely not addressable unless the service starts accepting a binary protocol. That would require a model update at the least, and needs an override here in the JS SDK to select the binary protocol, since JSON is preferred in the JavaScript SDK for overall performance reasons.

@jaredmcqueen
Copy link
Author

a temporary solution could be to raise the allowed limit higher than 5.0MB. Claude natively accepts 20MB FYI.

@zshzbh
Copy link
Contributor

zshzbh commented Jan 13, 2025

Hey @jaredmcqueen ,

I got updates from service team - It is documented that 4.5MB is limit. https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Message.html

But the Bedrock UI says the limit is 5MB. Service team is going through internal discussions now and they haven't got any result yet. The temp solution would be using a smaller size image(less than 4.5MB), for example you can convert the image to a JPEG, WebP, or vector image format. I hope this can help you and I will keep you posted!

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or enhancement. May require GitHub community feedback. p2 This is a standard priority issue queued This issues is on the AWS team's backlog service-api This issue is due to a problem in a service API, not the SDK implementation.
Projects
None yet
Development

No branches or pull requests

3 participants