- Notifications
You must be signed in to change notification settings - Fork845
Expose M.E.AI.OpenAI input message conversions#6601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Internally we have helpers that convert from M.E.AI chat messages to the various OpenAI object models. To ease interop when a developer gets M.E.AI messages from another library and then wants to submit them on their own to OpenAI, this just exposes those helpers publicly.
There was a problem hiding this 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 internal helper methods to convert M.E.AI chat messages into OpenAI SDK types by making them accessible via public extensions and updating existing client implementations.
- Add public extensions
AsOpenAIChatMessagesandAsOpenAIResponseItems - Change
ToOpenAIChatMessagesandToOpenAIResponseItemsfrom private to internal and adjust their signatures - Update
OpenAIChatClientandOpenAIResponseChatClientto use default JSON options and call the new internal methods - Add comprehensive tests for the new extensions; remove a duplicate test file
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIConversionTests.cs | New tests coveringAsOpenAIChatMessages andAsOpenAIResponseItems |
| test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIAIFunctionConversionTests.cs | Removed redundant conversion tests |
| src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIResponseChatClient.cs | MadeToOpenAIResponseItems internal; added pragma for SA1202 |
| src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIClientExtensions.cs | AddedAsOpenAIChatMessages &AsOpenAIResponseItems extensions |
| src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIChatClient.cs | UpdatedToOpenAIChatMessages signature and removed JSON options parameter |
Comments suppressed due to low confidence (1)
src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIResponseChatClient.cs:20
- [nitpick] Disabling SA1202 suppresses warnings about element ordering; consider reordering members to follow access-order conventions instead of disabling the rule.
#pragma warning disable SA1202 // Elements should be ordered by access194d9db intodotnet:mainUh oh!
There was an error while loading.Please reload this page.
Internally we have helpers that convert from M.E.AI chat messages to the various OpenAI object models. To ease interop when a developer gets M.E.AI messages from another library and then wants to submit them on their own to OpenAI, this just exposes those helpers publicly.
Internally we have helpers that convert from M.E.AI chat messages to the various OpenAI object models. To ease interop when a developer gets M.E.AI messages from another library and then wants to submit them on their own to OpenAI, this just exposes those helpers publicly.
Uh oh!
There was an error while loading.Please reload this page.
Internally we have helpers that convert from M.E.AI chat messages to the various OpenAI object models. To ease interop when a developer gets M.E.AI messages from another library and then wants to submit them on their own to OpenAI, this just exposes those helpers publicly.
Microsoft Reviewers:Open in CodeFlow