Skip to content

Conversation

@kevmyung
Copy link

@kevmyung kevmyung commented Dec 6, 2025

Summary

  • Add image content block handling in bedrock non-streaming responses
  • Add image delta processing in streaming event loop
  • Initialize image state in process_stream
  • Add test case for image content block processing

This enables multimodal models that accept various input types and generate images as output (e.g., Amazon Nova 2 Omni) to return generated images that
are properly parsed and included in agent responses.

Description

This PR adds support for image content blocks in model responses. Currently, the SDK handles text, toolUse, reasoningContent, and citationsContent
blocks, but image blocks returned by multimodal models are not processed.

Changes:

  • bedrock.py: Added image handling in _convert_non_streaming_to_streaming method to yield image deltas
  • streaming.py: Added image processing in handle_content_block_delta and handle_content_block_stop functions, and initialized image state in
    process_stream
  • test_streaming.py: Added test_process_stream_with_image_content to verify image block processing

The implementation follows the same pattern as other content block types, ensuring consistency and maintainability.

Related Issues

None

Documentation PR

None

Type of Change

New feature

Testing

How have you tested the change?

  • I ran hatch run prepare
  • All unit tests pass (1,609 tests)
  • All integration tests pass (17 bedrock-specific tests)
  • Verified with actual image generation using Amazon Nova 2 Omni (4.9MB PNG image successfully processed)
  • Formatter and linter checks pass

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

- Add image content block handling in bedrock non-streaming responses
- Add image delta processing in streaming event loop
- Initialize image state in process_stream
- Add test case for image content block processing

This enables Nova Omni and other multimodal models to generate images
that are properly parsed and included in agent responses.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant