Skip to content

Stabilize CodeInterpreter and WebSearch content types#7493

Merged
jozkee merged 4 commits intomainfrom
dacantu/stabilize-codeinterpreter-websearch
Apr 29, 2026
Merged

Stabilize CodeInterpreter and WebSearch content types#7493
jozkee merged 4 commits intomainfrom
dacantu/stabilize-codeinterpreter-websearch

Conversation

@jozkee
Copy link
Copy Markdown
Member

@jozkee jozkee commented Apr 28, 2026

Remove [Experimental] from CodeInterpreterToolCallContent, CodeInterpreterToolResultContent, WebSearchToolCallContent, and WebSearchToolResultContent so IChatClient consumers can use them without MEAI001 suppression.

  • Rename WebSearchToolResultContent.Results -> Outputs to align with CodeInterpreterToolResultContent.Outputs
  • Uncomment [JsonDerivedType] on AIContent, ToolCallContent, and ToolResultContent for the four content types
  • Remove corresponding AddAIContentTypeChain runtime workarounds and [JsonSerializable] entries from AIJsonUtilities.Defaults
  • Update API baseline (Experimental -> Stable)
  • Update OpenAI WebSearch result construction to use Outputs
  • Extend Stabilization.Tests to cover the newly stabilized types
Microsoft Reviewers: Open in CodeFlow

Remove [Experimental] from CodeInterpreterToolCallContent,
CodeInterpreterToolResultContent, WebSearchToolCallContent, and
WebSearchToolResultContent so IChatClient consumers can use them
without MEAI001 suppression.

- Rename WebSearchToolResultContent.Results -> Outputs to align with
  CodeInterpreterToolResultContent.Outputs
- Uncomment [JsonDerivedType] on AIContent, ToolCallContent, and
  ToolResultContent for the four content types
- Remove corresponding AddAIContentTypeChain runtime workarounds and
  [JsonSerializable] entries from AIJsonUtilities.Defaults
- Update API baseline (Experimental -> Stable)
- Update OpenAI WebSearch result construction to use Outputs
- Extend Stabilization.Tests to cover the newly stabilized types

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 28, 2026 15:28
@jozkee jozkee requested a review from a team as a code owner April 28, 2026 15:28
@github-actions github-actions Bot added the area-ai Microsoft.Extensions.AI libraries label Apr 28, 2026
Copy link
Copy Markdown
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 stabilizes the CodeInterpreter and WebSearch content types in Microsoft.Extensions.AI.Abstractions so IChatClient consumers can use them without MEAI001 suppression, while aligning WebSearch result naming with the CodeInterpreter pattern and simplifying JSON polymorphism configuration.

Changes:

  • Removes [Experimental] from the CodeInterpreter/WebSearch tool call & result content types and updates API baseline stages to Stable.
  • Renames WebSearchToolResultContent.Results to Outputs and updates all call sites/tests accordingly.
  • Enables polymorphic JSON support via [JsonDerivedType] attributes and removes the related runtime/source-gen workarounds from AIJsonUtilities.Defaults.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/Libraries/Microsoft.Extensions.AI.Stabilization.Tests/Microsoft.Extensions.AI.Stabilization.Tests.csproj Extends stabilization test project to include CodeInterpreter and WebSearch test coverage.
test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIResponseClientTests.cs Updates WebSearch assertions to use Outputs instead of Results.
test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIResponseClientIntegrationTests.cs Updates integration assertions to use Outputs.
test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/Contents/WebSearchToolResultContentTests.cs Renames tests and JSON payload expectations from results to outputs.
src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIResponsesChatClient.cs Constructs WebSearchToolResultContent using Outputs.
src/Libraries/Microsoft.Extensions.AI.Abstractions/Utilities/AIJsonUtilities.Defaults.cs Removes temporary type registration workarounds now that types are stabilized and participate via [JsonDerivedType].
src/Libraries/Microsoft.Extensions.AI.Abstractions/Microsoft.Extensions.AI.Abstractions.json Updates API baseline stages to Stable and reflects ResultsOutputs rename.
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/WebSearchToolResultContent.cs Removes [Experimental] and renames Results property to Outputs with updated docs.
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/WebSearchToolCallContent.cs Removes [Experimental].
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/ToolResultContent.cs Enables [JsonDerivedType] for CodeInterpreter/WebSearch tool result content.
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/ToolCallContent.cs Enables [JsonDerivedType] for CodeInterpreter/WebSearch tool call content.
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/CodeInterpreterToolResultContent.cs Removes [Experimental].
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/CodeInterpreterToolCallContent.cs Removes [Experimental].
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/AIContent.cs Enables [JsonDerivedType] entries for the four stabilized content types.

@jozkee jozkee requested a review from ericstj April 28, 2026 15:47
jozkee and others added 3 commits April 28, 2026 11:06
Convert Serialization_DerivedTypes_Roundtrips tests to [Theory] with a
useBuiltInJsonContext bool parameter that selects between
AIJsonUtilities.DefaultOptions (the library's built-in JsonContext) and
TestJsonSerializerContext.Default.Options (a consumer-style source-gen
context). Now that CodeInterpreter and WebSearch content types are
stable, both paths can be exercised. Also extend the AIContent,
ToolCallContent, and ToolResultContent fixtures with the newly
stabilized types.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The Results property on WebSearchToolResultContent was renamed to
Outputs as part of stabilizing the type. Since the experimental member
shipped in 10.4.0, the renamed (removed) member trips package
validation. Suppress the diagnostic for all target frameworks via a
baseline suppression file.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
These constants no longer have any references after stabilizing the
CodeInterpreter and WebSearch content types.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jozkee jozkee requested a review from a team as a code owner April 28, 2026 21:55
Copy link
Copy Markdown
Member

@ericstj ericstj left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Member

@jeffhandley jeffhandley left a comment

Choose a reason for hiding this comment

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

👍

@jozkee jozkee merged commit a343936 into main Apr 29, 2026
6 checks passed
@jozkee jozkee deleted the dacantu/stabilize-codeinterpreter-websearch branch April 29, 2026 16:20
jeffhandley pushed a commit that referenced this pull request May 1, 2026
* Stabilize CodeInterpreter and WebSearch content types

Remove [Experimental] from CodeInterpreterToolCallContent,
CodeInterpreterToolResultContent, WebSearchToolCallContent, and
WebSearchToolResultContent so IChatClient consumers can use them
without MEAI001 suppression.

- Rename WebSearchToolResultContent.Results -> Outputs to align with
  CodeInterpreterToolResultContent.Outputs
- Uncomment [JsonDerivedType] on AIContent, ToolCallContent, and
  ToolResultContent for the four content types
- Remove corresponding AddAIContentTypeChain runtime workarounds and
  [JsonSerializable] entries from AIJsonUtilities.Defaults
- Update API baseline (Experimental -> Stable)
- Update OpenAI WebSearch result construction to use Outputs
- Extend Stabilization.Tests to cover the newly stabilized types

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Parameterize Serialization_DerivedTypes_Roundtrips over JSON context

Convert Serialization_DerivedTypes_Roundtrips tests to [Theory] with a
useBuiltInJsonContext bool parameter that selects between
AIJsonUtilities.DefaultOptions (the library's built-in JsonContext) and
TestJsonSerializerContext.Default.Options (a consumer-style source-gen
context). Now that CodeInterpreter and WebSearch content types are
stable, both paths can be exercised. Also extend the AIContent,
ToolCallContent, and ToolResultContent fixtures with the newly
stabilized types.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Suppress ApiCompat CP0002 for WebSearchToolResultContent.Results rename

The Results property on WebSearchToolResultContent was renamed to
Outputs as part of stabilizing the type. Since the experimental member
shipped in 10.4.0, the renamed (removed) member trips package
validation. Suppress the diagnostic for all target frameworks via a
baseline suppression file.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Remove unused AICodeInterpreter and AIWebSearch DiagnosticIds

These constants no longer have any references after stabilizing the
CodeInterpreter and WebSearch content types.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-ai Microsoft.Extensions.AI libraries

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants