Skip to content

Conversation

@giles17
Copy link
Contributor

@giles17 giles17 commented Jan 17, 2026

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.

Copilot AI review requested due to automatic review settings January 17, 2026 02:06
@github-actions github-actions bot changed the title azureai image gen sample fix Python: azureai image gen sample fix Jan 17, 2026
@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Jan 17, 2026

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

Tests Skipped Failures Errors Time
3186 213 💤 0 ❌ 0 🔥 1m 3s ⏱️

Copy link
Contributor

Copilot AI left a comment

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.

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

@giles17 giles17 changed the title Python: azureai image gen sample fix Python: Azure AI mapping HostedImageGenerationTool to ImageGenTool Jan 17, 2026
@giles17 giles17 marked this pull request as draft January 20, 2026 16:09
@giles17 giles17 marked this pull request as ready for review January 20, 2026 19:24
@giles17 giles17 enabled auto-merge January 20, 2026 23:51

import aiofiles
from agent_framework import DataContent, HostedImageGenerationTool
from agent_framework import HostedImageGenerationTool, ImageGenerationToolResultContent
Copy link
Member

Choose a reason for hiding this comment

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

This content type no longer exists

@giles17 giles17 disabled auto-merge January 22, 2026 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants