Skip to content

Conversation

ericstj
Copy link
Member

@ericstj ericstj commented Aug 26, 2025

Fixes #6639

This adds a prototype implementation of ImageGenerationTool with support in OpenAI provider.

To use this requires using the OpenAI Responses chat client with OpenAI provider (not Azure OpenAI).

Still required:

  • Add tests for tool (currently testing with a sample)
  • Polish and document API
  • Refine implementation in OpenAI to ensure its minimally fragile (despite usage of reflection) - test with AOT
  • Refine content update coalescing methods after testing in sample
Microsoft Reviewers: Open in CodeFlow

@Copilot Copilot AI review requested due to automatic review settings August 26, 2025 15:41
@ericstj ericstj requested a review from a team as a code owner August 26, 2025 15:41
@github-actions github-actions bot added the area-ai Microsoft.Extensions.AI libraries label Aug 26, 2025
Copy link
Contributor

@Copilot 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 adds a prototype implementation of ImageGenerationTool with support in the OpenAI provider, enabling AI services to perform image generation when specified as a tool.

  • Introduces ImageGenerationTool as a marker tool class that can be configured with ImageGenerationOptions
  • Adds experimental APIs for applying chat response updates to existing responses with configurable coalescing options
  • Implements reflection-based handling of OpenAI's internal image generation response types in the OpenAI provider

Reviewed Changes

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

Show a summary per file
File Description
ImageGenerationTool.cs New tool class for enabling image generation capabilities
ChatResponseUpdateCoalescingOptions.cs Configuration options for how response updates are merged
ChatResponseExtensions.cs Extension methods for applying updates to chat responses
OpenAIResponsesChatClient.cs OpenAI provider implementation with image generation support via reflection
OpenAIJsonContext.cs Added JSON serialization support for new types
ChatResponseUpdate.cs Fixed documentation reference
ChatResponseUpdateExtensionsTests.cs Comprehensive tests for new update coalescing functionality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-ai Microsoft.Extensions.AI libraries
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Text to Image: Support image generation as an AITool
1 participant