-
Notifications
You must be signed in to change notification settings - Fork 183
feat: add multimodal support to AnthropicChatGenerator #2186
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
Merged
anakin87
merged 6 commits into
deepset-ai:main
from
ChinmayBansal:feat-anthropic-multimodal-support
Aug 18, 2025
Merged
feat: add multimodal support to AnthropicChatGenerator #2186
anakin87
merged 6 commits into
deepset-ai:main
from
ChinmayBansal:feat-anthropic-multimodal-support
Aug 18, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
anakin87
requested changes
Aug 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this contribution!
This PR is already good. I left some comments.
...s/anthropic/src/haystack_integrations/components/generators/anthropic/chat/chat_generator.py
Outdated
Show resolved
Hide resolved
...s/anthropic/src/haystack_integrations/components/generators/anthropic/chat/chat_generator.py
Outdated
Show resolved
Hide resolved
anakin87
requested changes
Aug 14, 2025
...s/anthropic/src/haystack_integrations/components/generators/anthropic/chat/chat_generator.py
Outdated
Show resolved
Hide resolved
...s/anthropic/src/haystack_integrations/components/generators/anthropic/chat/chat_generator.py
Outdated
Show resolved
Hide resolved
anakin87
approved these changes
Aug 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
Related Issues
AnthropicChatGenerator
#2125Proposed Changes:
This PR adds multimodal support to AnthropicChatGenerator, enabling it to handle both text and image inputs
in user messages. The implementation follows the same patterns established by the HuggingFace and Amazon
Bedrock integrations.
Key changes:
_convert_messages_to_anthropic_format()
to handleImageContent
alongsideTextContent
ImageBlockParam
with base64 image encodingTechnical details:
ImageBlockParam
with proper media type casting for Anthropic's vision APIHow did you test it?
Unit Tests:
test_convert_message_to_anthropic_format_with_image
to verify proper message conversionIntegration Tests:
test_live_run_multimodal
for real API testing (requiresANTHROPIC_API_KEY
)apple.jpg
)Code Quality:
hatch run fmt
)hatch run test:types
)Manual Verification:
Notes for the reviewer
ImageBlockParam
types for full type safetyapple.jpg
) is shared from Bedrock integration's test assetscast()
function is used for media type conversion to satisfy Anthropic's strict typingChecklist
guidelines and the
code of conduct
my PR title:
fix:
,feat:
,build:
,chore:
,ci:
,docs:
,style:
,refactor:
,perf:
,test:
.Suggested PR Title (using conventional commits):
feat: add multimodal support to AnthropicChatGenerator