Skip to content

Python: Azure AI mapping HostedImageGenerationTool to ImageGenTool - #3263

Merged
Giles Odigwe (giles17) merged 6 commits into
microsoft:mainfrom
giles17:foundry_image_gen_fix
Jan 23, 2026
Merged

Python: Azure AI mapping HostedImageGenerationTool to ImageGenTool#3263
Giles Odigwe (giles17) merged 6 commits into
microsoft:mainfrom
giles17:foundry_image_gen_fix

Conversation

@giles17

@giles17Giles Odigwe (giles17) commented Jan 17, 2026

Copy link
Copy Markdown
Contributor

Motivation and Context

This PR fixes the Azure AI image generation sample by adding the missing handler for HostedImageGenerationTool in the Azure AI integration layer and updating the sample to use the correct content types for image generation results.

Changes:

  • Added HostedImageGenerationTool to ImageGenTool mapping in Azure AI integration
  • Updated sample to use ImageGenerationToolResultContent instead of DataContent for extracting image data
  • Changed image save location from script directory to OS temporary directory
  • Updated model name from gpt-image-1-mini to gpt-image-1 in tool options (the Image Generation tool is empowered by the gpt-image-1 model.)

Description

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

CopilotAI review requested due to automatic review settings January 17, 2026 02:06
@markwallace-microsoftMark Wallace (markwallace-microsoft) added the python Usage: [Issues, PRs], Target: Python label Jan 17, 2026
@github-actionsgithub-actionsBot changed the title azureai image gen sample fixPython: azureai image gen sample fixJan 17, 2026
@markwallace-microsoft

Mark Wallace (markwallace-microsoft) commented Jan 17, 2026

Copy link
Copy Markdown
Contributor

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/azure-ai/agent_framework_azure_ai
_shared.py30112359%103–104, 107–109, 112–117, 119, 150, 152, 154, 156, 201, 289–292, 295–297, 300–301, 311, 318–320, 346–355, 360, 408, 424–426, 428–445, 453–456, 461–462, 466–473, 478–479, 485–488, 490, 510–512, 515–516, 518, 530, 532–533, 536–539, 542, 544–545, 547–555, 557, 593, 595–598, 600, 606, 612, 616, 631, 634–635, 637
TOTAL17478271784%

Python Unit Test Overview

TestsSkippedFailuresErrorsTime
3186213 💤0 ❌0 🔥1m 5s ⏱️

CopilotAI 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.

Pull request overview

This PR fixes the Azure AI image generation sample by adding the missing handler for HostedImageGenerationTool in the Azure AI integration layer and updating the sample to use the correct content types for image generation results.

Changes:

  • Added HostedImageGenerationTool to ImageGenTool mapping in Azure AI integration
  • Updated sample to use ImageGenerationToolResultContent instead of DataContent for extracting image data
  • Changed image save location from script directory to OS temporary directory
  • Updated model name from gpt-image-1-mini to gpt-image-1 in tool options

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

FileDescription
python/samples/getting_started/agents/azure_ai/azure_ai_with_image_generation.pyUpdated sample to use correct content types and save location; however, uses incorrect option keys
python/packages/azure-ai/agent_framework_azure_ai/_shared.pyAdded handler to map HostedImageGenerationTool to Azure AI's ImageGenTool

@giles17Giles Odigwe (giles17) changed the title Python: azureai image gen sample fixPython: Azure AI mapping HostedImageGenerationTool to ImageGenToolJan 17, 2026
@giles17
Giles Odigwe (giles17) marked this pull request as draft January 20, 2026 16:09
@giles17
Giles Odigwe (giles17) marked this pull request as ready for review January 20, 2026 19:24
Comment threadpython/packages/azure-ai/agent_framework_azure_ai/_shared.py Outdated
@giles17
Giles Odigwe (giles17) added this pull request to the merge queueJan 23, 2026
Merged via the queue into microsoft:main with commit a97bc32Jan 23, 2026
23 checks passed
Aris Nguyen (arisng) pushed a commit to arisng/agent-framework that referenced this pull request Feb 2, 2026
…icrosoft#3263)
* azureai image gen sample fix
* mypy fixes
* addressed comments + mapping updates
* image model fix
* content type fix
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pythonUsage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@giles17@markwallace-microsoft@eavanvalkenburg@dmytrostruk@moonbox3