Skip to content

Python: fix(ag-ui): convert input_image parts to image content - #8737

Merged
Eduard van Valkenburg (eavanvalkenburg) merged 1 commit into
microsoft:mainfrom
anishmehta24:fix/ag-ui-input-image-content
Sep 28, 2026
Merged

Eduard van Valkenburg (eavanvalkenburg) merged 1 commit into
microsoft:mainfrom
anishmehta24:fix/ag-ui-input-image-content

Conversation

@anishmehta24

Copy link
Copy Markdown
Contributor

Motivation & Context

_convert_agui_content_to_framework only treats binary, image, audio, video and document parts as media. An input_image part fell through to the text fallback, so the model received the Python repr of the dict as text instead of the image:

_convert_agui_content_to_framework([{"type": "input_image", "source": {"type": "url", "url": "https://example.com/img.png"}}])
# [Content(type="text", text="{'type': 'input_image', 'source': {...}}")]

_normalize_snapshot_content in the same file already maps input_image to a media part, so the two paths disagreed.

Description & Review Guide

  • What are the major changes? Treat an input_image part as image before the media check, so it goes through _parse_multimodal_media_part like other images.
  • What is the impact of these changes? Image parts sent as input_image reach the model as image content.
  • What do you want reviewers to focus on? It reuses the existing image handling, so URL, base64 and binary-id sources all work the same as for image.

Related Issue

No existing issue.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible

Test: test_convert_content_input_image_is_media_not_text in tests/ag_ui/test_message_adapters.py; it fails on main. The ag-ui tests pass and the repo's pre-commit checks are clean.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@agent-framework-automation agent-framework-automation Bot added the python Usage: [Issues, PRs], Target: Python label Sep 24, 2026
Merged via the queue into microsoft:main with commit 9bca1ba Sep 28, 2026
50 checks passed

This branch was previously deployed

1 inactive deployment
github-app-auth — 41cc8a7f Deployed Sep 24, 2026 by anishmehta24 via team_check #5248
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants