Add ImageGenerationToolCallContent and ImageGenerationToolResultContent to JSON serialization infrastructure#7275
Merged
stephentoub merged 2 commits intomainfrom Feb 9, 2026
Conversation
…nt to JSON serialization infrastructure Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add ImageGenerationToolCallContent and ImageGenerationToolResultContent
Add ImageGenerationToolCallContent and ImageGenerationToolResultContent to JSON serialization infrastructure
Feb 8, 2026
stephentoub
approved these changes
Feb 8, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds missing JSON polymorphic/source-gen registrations for image generation tool content types so they can round-trip through AIContent and work in NativeAOT scenarios.
Changes:
- Registered
ImageGenerationToolCallContent/ImageGenerationToolResultContentinAIJsonUtilities.DefaultOptionspolymorphic configuration with type discriminators. - Added
[JsonSerializable]entries for both types to the source-generatedJsonContext. - Added targeted unit tests and expanded the existing derived-type roundtrip test set.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Libraries/Microsoft.Extensions.AI.Abstractions/Utilities/AIJsonUtilities.Defaults.cs | Registers the two image generation tool content types for polymorphic serialization and source generation. |
| test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/Contents/ImageGenerationToolCallContentTests.cs | Verifies default/property behavior and polymorphic JSON roundtrip via AIContent. |
| test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/Contents/ImageGenerationToolResultContentTests.cs | Verifies Outputs behavior and both concrete + polymorphic JSON roundtrips. |
| test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/Contents/AIContentTests.cs | Extends derived-type serialization roundtrip coverage to include the new types. |
ericstj
approved these changes
Feb 9, 2026
Member
ericstj
left a comment
There was a problem hiding this comment.
LGTM. Thanks for adding more tests to cover these.
joperezr
pushed a commit
that referenced
this pull request
Feb 10, 2026
…nt to JSON serialization infrastructure (#7275) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
joperezr
added a commit
that referenced
this pull request
Feb 11, 2026
* Merged PR 57712: Getting ready for 10.3 release Getting ready for 10.3 release ---- #### AI description (iteration 1) #### PR Classification This pull request implements release preparation changes for the 10.3 release. #### PR Summary The PR bumps dependency versions and adjusts configuration settings to ready the repository for the upcoming release while streamlining build pipeline tasks. - **`eng/Version.Details.xml` & `eng/Versions.props`**: Update dependency versions from 9.0.12 to 9.0.13 (including net10 and LTS versions) and set release stabilization flags (`StabilizePackageVersion=true`, `DotNetFinalVersionKind=release`). - **`azure-pipelines.yml`**: Remove the entire code coverage stage and its related dependency from the post-build steps. - **`.github/skills/prepare-release/SKILL.md`**: Add documentation with instructions for preparing an internal release branch. - **`Directory.Build.props` & `NuGet.config`**: Add NU1507 warning suppression and remove the package source mapping section to align with internal feed usage. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot --> * Fix OpenAI responses streaming to preserve encrypted reasoning content (#7266) Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update OpenAIResponsesChatClient to handle streaming code interpreter content (#7267) * Update OpenAIResponsesChatClient to handle streaming code interpreter content Right now it outputs it but in a bulk fashion only at the end of the response item. This makes it yield the deltas instead. * Dedup code block * Update OpenTelemetry semantic convention version references from 1.38 to 1.39 (#7274) * Initial plan * Update OpenTelemetry semantic convention version comments from 1.38 to 1.39 Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com> * MEAI: Update Experimental / Preview Features (#7235) * Remove [Experimental] attribute from IChatReducer * Annotate APIs that use experimental OpenAI APIs. Remove prerelease label. * Fix typo Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Remove project-wide OpenAI experimental suppressions. Finish annotating. * Use granular constants for openai experimental diagnostics * Update API baselines * Remove unused const * Remove redundant [Experimental] attributes for OpenAI Responses members * Update ApiChief baselines for MEAI --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Add ImageGenerationToolCallContent and ImageGenerationToolResultContent to JSON serialization infrastructure (#7275) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com> * Mark all of MicrosoftExtensionsAIChatExtensions as experimental --------- Co-authored-by: Stephen Toub <stoub@microsoft.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com> Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com> Co-authored-by: Jeff Handley <Jeff.Handley@microsoft.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
ImageGenerationToolCallContentandImageGenerationToolResultContentwere missing from the JSON serialization infrastructure, preventing polymorphic serialization throughAIContentreferences and breaking NativeAOT scenarios.Changes
Added type registrations in
AIJsonUtilities.Defaults.cs:AddAIContentType()for both types with discriminator IDs"imageGenerationToolCall"and"imageGenerationToolResult"[JsonSerializable]attributes toJsonContextfor source generation supportAdded comprehensive tests:
ImageGenerationToolCallContentTests.cs- validates properties and polymorphic serializationImageGenerationToolResultContentTests.cs- validates properties including nestedOutputslist and polymorphic serializationAIContentTests.Serialization_DerivedTypes_Roundtripsto include both typesExample
Follows the same pattern as other experimental content types (
CodeInterpreterToolCallContent,McpServerToolCallContent, etc.).Original prompt
This pull request was created from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
Microsoft Reviewers: Open in CodeFlow