Skip to content

feat(generate_image)!: update to support current Bedrock models #97

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mrityunjayshukla
Copy link

@mrityunjayshukla mrityunjayshukla commented Jun 23, 2025

Description

Enhance generate_image tool to support current Bedrock models

  • Replace legacy stability.stable-diffusion-xl-v1 with current models
  • Removed steps and style_preset from the request model, as they are no longer required by the new versions of Stability or Amazon text-to-image AI models.
  • Added region_name support in tool request
  • Add support for different model families (Stability AI and Amazon)
  • Implement model validation to check for legacy models
  • Add proper error handling for different response formats
  • Enhance test coverage

BREAKING CHANGE: This update removes support for legacy models and changes
the request format for different model families. Users will need to update
their model_id parameter to use currently supported models.

Will do a follow up PR to update the documentation.

Related Issues

#75

Documentation PR

Will do a follow up PR to update the documentation.

Type of Change

  • Bug fix
  • New Tool
  • Breaking change
  • Other (please describe)

Testing

  1. Unit tests, formatter and linters has passed.
  2. Generated invocation to various bedrock supported models in scope in different aws regions - generating images using (Amazon Titan V1 and V2, Nova Canvas, SD Ultra, SD Core and SD 3.5).
=== Testing Default Model Selection ===
No model_id provided. Using automatically selected model: amazon.titan-image-generator-v1
✅ SUCCESS - Default model selection worked
Selected model: The generated image has been saved locally to output/a_beautiful_mountain_landscape_with.png. 

=== Getting available models in us-west-2 ===
Found 5 text-to-image models in us-west-2:
- amazon.titan-image-generator-v1
- amazon.titan-image-generator-v2:0
- stability.sd3-5-large-v1:0
- stability.stable-image-core-v1:1
- stability.stable-image-ultra-v1:1

=== Testing each model individually ===
Testing model amazon.titan-image-generator-v1...
✅ SUCCESS - amazon.titan-image-generator-v1 (11.99s)
Testing model amazon.titan-image-generator-v2:0...
✅ SUCCESS - amazon.titan-image-generator-v2:0 (13.12s)
Testing model stability.sd3-5-large-v1:0...
✅ SUCCESS - stability.sd3-5-large-v1:0 (10.02s)
Testing model stability.stable-image-core-v1:1...
✅ SUCCESS - stability.stable-image-core-v1:1 (9.93s)
Testing model stability.stable-image-ultra-v1:1...
✅ SUCCESS - stability.stable-image-ultra-v1:1 (13.89s)

=== Test Summary ===
Total models tested: 6
Successful tests: 6
Failed tests: 0
Results saved to: /Users/mrshukla/Documents/gitworkspace/strands-agents/tools/output/model_tests/test_results.json

=== Testing Default Model Selection in us-east-1 ===
No model_id provided. Using automatically selected model: amazon.titan-image-generator-v1
✅ SUCCESS - Default model selection worked
Selected model: The generated image has been saved locally to output/a_beautiful_mountain_landscape_with_6.png. 

=== Getting available models in us-east-1 ===
Found 3 text-to-image models in us-east-1:
- amazon.titan-image-generator-v1
- amazon.titan-image-generator-v2:0
- amazon.nova-canvas-v1:0

=== Testing each model individually ===
Testing model amazon.titan-image-generator-v1...
✅ SUCCESS - amazon.titan-image-generator-v1 (12.68s)
Testing model amazon.titan-image-generator-v2:0...
✅ SUCCESS - amazon.titan-image-generator-v2:0 (12.75s)
Testing model amazon.nova-canvas-v1:0...
✅ SUCCESS - amazon.nova-canvas-v1:0 (9.6s)


  • hatch fmt --linter
  • hatch fmt --formatter
  • hatch test --all

Checklist

  • I have read the CONTRIBUTING document

  • I have added 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

  • My changes generate no new warnings

  • Any dependent changes have been merged and published

  • By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

 - Replace legacy stability.stable-diffusion-xl-v1 with current models
 - Add support for different model families (Stability AI and Amazon)
 - Implement model validation to check for legacy models
 - Add proper error handling for different response formats
 - Enhance test coverage with 20 comprehensive tests

 BREAKING CHANGE: This update removes support for legacy models and changes
 the request format for different model families. Users will need to update
 their model_id parameter to use currently supported models.
@mrityunjayshukla mrityunjayshukla requested a review from a team as a code owner June 23, 2025 12:38
cagataycali
cagataycali previously approved these changes Jun 25, 2025
Copy link
Member

@cagataycali cagataycali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me!

Thanks for investing time to improving the generate_image tool! Approving and leaving team to have a second look! 🚀

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.

2 participants