Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request adds comprehensive support for function result content types in the OpenAI Responses API client and enables per-request model ID overrides across all OpenAI clients. The implementation includes extensive test coverage for various content types in tool call results.
Key changes:
- Added support for
AIContenttypes (TextContent,DataContent,UriContent,HostedFileContent) as function results in the Responses API - Implemented per-request
ModelIdoverride capability inChatOptionsfor Chat Completion, Responses, and Embedding clients - Updated to OpenAI SDK 2.6.0 and added
HasTopLevelMediaTypemethod toHostedFileContent
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| OpenAIResponsesChatClient.cs | Adds serialization logic for AIContent types in tool call results, implements model override via JsonPatch, and reorders annotation handling |
| OpenAIClientExtensions.cs | Adds PatchModelIfNotSet helper method for setting model in JsonPatch when not already set |
| OpenAIChatClient.cs | Adds model override support using PatchModelIfNotSet |
| OpenAIEmbeddingGenerator.cs | Adds model override support using PatchModelIfNotSet |
| OpenAIJsonContext.cs | Adds JSON serialization support for FunctionToolCallOutputElement list |
| HostedFileContent.cs | Adds HasTopLevelMediaType method to check media type prefix |
| OpenAIResponseClientTests.cs | Adds 33 new unit tests covering model overrides, tool result content types, and edge cases |
| OpenAIResponseClientIntegrationTests.cs | Adds 5 integration tests for tool call results with various content types |
| OpenAIChatClientTests.cs | Adds 2 unit tests for model override in streaming and non-streaming scenarios |
| Microsoft.Extensions.AI.OpenAI.csproj | Adds SCME0001 warning suppression and removes unused injector properties |
| General.props | Updates OpenAI package version to 2.6.0 |
| CHANGELOG.md files | Documents new features and fixes |
| API baseline file | Adds new HasTopLevelMediaType API to manifest |
src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIResponsesChatClient.cs
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIResponsesChatClient.cs
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIResponsesChatClient.cs
Outdated
Show resolved
Hide resolved
dmytrostruk
approved these changes
Nov 1, 2025
In addition to updating the dependency, it now enables us to do additional things:
- Propagate ChatOptions/EmbeddingGeneratorOptions.ModelID to allow overriding the model per-request.
- Propagate AIContent results of tool invocations using non-string tool results.
- Add support for container file annotations.
- Fixed handling of GetResponse{Streaming}Async to use RequestOptions
- Remove hacky serialization code around ResponseCreationOptions.
A previous PR added HostedFileContent.Name/MediaType, but we missed adding HasTopLevelMediaType (which both DataContent and UriContent have). I had a need for that here, so included it.
4da8c05 to
080abae
Compare
jeffhandley
approved these changes
Nov 1, 2025
jeffhandley
pushed a commit
to jeffhandley/extensions
that referenced
this pull request
Nov 1, 2025
* Update to OpenAI 2.6.0
In addition to updating the dependency, it now enables us to do additional things:
- Propagate ChatOptions/EmbeddingGeneratorOptions.ModelID to allow overriding the model per-request.
- Propagate AIContent results of tool invocations using non-string tool results.
- Add support for container file annotations.
- Fixed handling of GetResponse{Streaming}Async to use RequestOptions
- Remove hacky serialization code around ResponseCreationOptions.
A previous PR added HostedFileContent.Name/MediaType, but we missed adding HasTopLevelMediaType (which both DataContent and UriContent have). I had a need for that here, so included it.
* Add more tests based on code coverage gaps
* Fix handling of role in AsChatMessages
jeffhandley
pushed a commit
that referenced
this pull request
Nov 2, 2025
* Update to OpenAI 2.6.0
In addition to updating the dependency, it now enables us to do additional things:
- Propagate ChatOptions/EmbeddingGeneratorOptions.ModelID to allow overriding the model per-request.
- Propagate AIContent results of tool invocations using non-string tool results.
- Add support for container file annotations.
- Fixed handling of GetResponse{Streaming}Async to use RequestOptions
- Remove hacky serialization code around ResponseCreationOptions.
A previous PR added HostedFileContent.Name/MediaType, but we missed adding HasTopLevelMediaType (which both DataContent and UriContent have). I had a need for that here, so included it.
* Add more tests based on code coverage gaps
* Fix handling of role in AsChatMessages
This was referenced Nov 11, 2025
Merged
Merged
This was referenced Dec 1, 2025
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In addition to updating the dependency, it now enables us to do additional things:
A previous PR added HostedFileContent.Name/MediaType, but we missed adding HasTopLevelMediaType (which both DataContent and UriContent have). I had a need for that here, so included it.
Also added some more unit tests to improve code coverage for the response chat client.
And also fixes #6997.
Microsoft Reviewers: Open in CodeFlow