Skip to content

Conversation

@LiJay0704
Copy link

What problem does this PR solve?

Currently, when using the CropResize tool in qwen2vl_assistant_tooluse.py, the agent fails with a ModelServiceError: InvalidParameter. The error message indicates that an image modal cannot be placed in an assistant message.

This happens because the CropResize.call method returns a ContentItem(image=output_path), which the agent framework then incorrectly tries to send as part of the assistant's turn, violating the model's API rules.

How does this PR solve the problem?

This PR fixes the issue by commenting out the line that returns the ContentItem with an image.

  • Before: The tool returned [ContentItem(image=...), ContentItem(text=...)].
  • After: The tool now only returns [ContentItem(text=...)], which correctly provides the path to the generated image within the text message.

This change aligns the tool's behavior with the API's requirements, allowing the interaction to complete successfully while still providing the user with the necessary information about the generated file.

@LiJay0704
Copy link
Author

img_v3_02qg_d6e3b442-c0c1-4354-9279-f3aff4ea09fg
之前会导致图片中的问题

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.

1 participant