Skip to content

Conversation

@stephentoub
Copy link
Member

@stephentoub stephentoub commented Sep 12, 2025

Primarily to enable ChatResponseFormat.ForJsonSchema<T> to be used with the OpenAI response format properties

Microsoft Reviewers: Open in CodeFlow

@stephentoub stephentoub requested a review from a team as a code owner September 12, 2025 21:43
@Copilot Copilot AI review requested due to automatic review settings September 12, 2025 21:43
@stephentoub stephentoub added the area-ai Microsoft.Extensions.AI libraries label Sep 12, 2025
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 exposes response format conversions for OpenAI types by adding public extension methods to convert Microsoft.Extensions.AI response formats to OpenAI-specific format types. This enables ChatResponseFormat.ForJsonSchema<T> to be used with OpenAI response format properties.

Key changes:

  • Added public extension methods for converting between Microsoft.Extensions.AI and OpenAI response format types
  • Refactored existing internal conversion logic into reusable internal static methods
  • Added comprehensive test coverage for the new conversion methods

Reviewed Changes

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

Show a summary per file
File Description
MicrosoftExtensionsAIChatExtensions.cs Added public extension method to convert ChatResponseFormat to OpenAI ChatResponseFormat
MicrosoftExtensionsAIResponsesExtensions.cs Added public extension method to convert ChatResponseFormat to OpenAI ResponseTextFormat
OpenAIChatClient.cs Refactored response format conversion logic into reusable internal static method
OpenAIResponsesChatClient.cs Refactored response format conversion logic into reusable internal static method
OpenAIConversionTests.cs Added comprehensive tests for both new conversion extension methods
CHANGELOG.md Added entry documenting the new response format conversion functionality

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

@stephentoub stephentoub merged commit 9a68639 into dotnet:main Sep 15, 2025
6 checks passed
@stephentoub stephentoub deleted the openaiformat branch September 15, 2025 12:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-ai Microsoft.Extensions.AI libraries

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants