Skip to content

fix: support Gemini HEIC and HEIF image inputs - #3148

Merged
marklysze merged 3 commits into
ag2ai:mainfrom
uuzzrm:fix/gemini-heic-heif-image-inputs
Aug 11, 2026
Merged

marklysze merged 3 commits into
ag2ai:mainfrom
uuzzrm:fix/gemini-heic-heif-image-inputs

Conversation

@uuzzrm

@uuzzrm uuzzrm commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Why are these changes needed?

ImageInput accepts Gemini-compatible HEIC and HEIF MIME types at runtime, but ImageMediaType omits them from its Literal alias. That makes the public ImageInput(data=..., media_type=...) overload reject valid phone image formats during static checking. Add both MIME types and cover the public factory path in a regression test.

Related issue number

Closes #3147

Checks

  • I have included any doc changes needed for https://docs.ag2.ai/. No documentation changes are needed for this type-alias fix.
  • I have added tests (if relevant) corresponding to the changes introduced in this PR.
  • I have made sure all auto checks have passed.

Local tests were not run because the local workspace has no available AG2 test environment and the filesystem volume is full. The added test uses the public API and asserts that both MIME types are present in the runtime alias; upstream CI is needed for final verification.

AI assistance

  • I understand the changes in this PR and can explain them in my own words.
  • I have verified that the PR description accurately reflects the actual diff.
  • If AI assistance was used, I reviewed, tested, and validated the generated code/text before submitting.

AI assistance was used to research issue #3147, draft the patch and regression test, and inspect the final diff. I reviewed the changes and will respond to maintainer feedback; the remaining validation checkbox is intentionally left open until CI runs.

@github-actions github-actions Bot added the area:core Agent runtime core: ag2/*.py, ag2/events, ag2/response, ag2/streams label Aug 10, 2026
@CLAassistant

CLAassistant commented Aug 10, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Widening ImageMediaType let ImageInput(path="photo.heic") pass static
checking, but the extension map still had no entry for .heic/.heif, so
the call raised ValueError at runtime. Issue ag2ai#3147 calls this path out
explicitly as the common case for a phone photo.

Co-Authored-By: Claude Opus 5 <[email protected]>

@marklysze marklysze left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice one, thanks @uuzzrm!

@marklysze
marklysze enabled auto-merge August 11, 2026 05:17
@marklysze
marklysze added this pull request to the merge queue Aug 11, 2026
@uuzzrm

uuzzrm commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

@marklysze Thanks for the approval. The current head c91e0116 is clean and the focused change is ready. If everything still looks good on your side, could you merge it when convenient?

Merged via the queue into ag2ai:main with commit 0566450 Aug 11, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core Agent runtime core: ag2/*.py, ag2/events, ag2/response, ag2/streams

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ImageMediaType omits image/heic and image/heif, which Gemini accepts

3 participants