llms/bedrock: Fixed error when using Claude3 model and giving MessageContent with images #713
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The problem want to solve with this PR
This PR concerns the execution of a prompt to recognize images using llms/bedrock's Claude3 model. In this PR, I would like to address some errors that occur when executing the following code.
The code itself is simple, interpreting the image/png image given in the embedding as text.
The errors that occur are the following two types of errors that occur when executing this code.
2024/03/22 11:23:14 operation error Bedrock Runtime: InvokeModel, https response error StatusCode: 400, RequestID: 0fa522ef-9201-4f62-9f69-f40ff9046896, ValidationException: messages.0.content.0.image.source: Input tag 'image' found using 'type' does not match any of the expected tags: 'base64'
2024/03/22 11:37:33 operation error Bedrock Runtime: InvokeModel, https response error StatusCode: 400, RequestID: 5741321f-54e4-4ef0-9351-d28eb104ee07, ValidationException: messages: roles must alternate between "user" and "assistant", but found multiple "user" roles in a row
The specifications for this area are described in the following document.
https://docs.anthropic.com/claude/reference/claude-on-amazon-bedrock
https://docs.anthropic.com/claude/reference/messages_post
PR Checklist
memory: add interfaces for X, Y
orutil: add whizzbang helpers
).Fixes #123
).golangci-lint
checks.