Skip to content

Conversation

stephentoub
Copy link
Member

@stephentoub stephentoub commented Jul 30, 2025

Microsoft Reviewers: Open in CodeFlow

@stephentoub stephentoub requested a review from a team as a code owner July 30, 2025 01:41
@github-actions github-actions bot added the area-ai Microsoft.Extensions.AI libraries label Jul 30, 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 several OpenAI conversion helper methods to enable bidirectional conversion between Microsoft.Extensions.AI types and OpenAI types. The changes enhance interoperability by providing methods to convert chat messages, responses, and completions in both directions.

Key changes include:

  • Added conversion methods for ChatMessage collections to/from OpenAI types
  • Added conversion from ChatResponse to OpenAI ChatCompletion
  • Refactored common conversion logic into shared helper methods

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
OpenAIConversionTests.cs Comprehensive test coverage for new conversion methods including edge cases and error handling
OpenAIResponsesChatClient.cs Refactored message conversion logic into reusable methods and improved raw representation handling
OpenAIClientExtensions.cs Added shared helper methods for parsing function call content from JSON
OpenAIChatClient.cs Enhanced content conversion methods and improved raw representation processing
OpenAIAssistantsChatClient.cs Updated to use new shared function call parsing methods
MicrosoftExtensionsAIResponsesExtensions.cs Added new extension methods for converting between response types
MicrosoftExtensionsAIChatExtensions.cs Added comprehensive bidirectional conversion methods for chat messages and completions

Copy link
Contributor

@rogerbarreto rogerbarreto left a comment

Choose a reason for hiding this comment

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

LGTM

@stephentoub stephentoub enabled auto-merge (squash) July 31, 2025 02:17
@stephentoub stephentoub merged commit 65c679b into dotnet:main Jul 31, 2025
6 checks passed
This was referenced Aug 14, 2025
This was referenced Aug 27, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Aug 30, 2025
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.

3 participants