Skip to content

Update OpenAIResponsesChatClient to handle streaming code interpreter content#7267

Merged
stephentoub merged 2 commits intodotnet:mainfrom
stephentoub:fixcodeint
Feb 6, 2026
Merged

Update OpenAIResponsesChatClient to handle streaming code interpreter content#7267
stephentoub merged 2 commits intodotnet:mainfrom
stephentoub:fixcodeint

Conversation

@stephentoub
Copy link
Member

@stephentoub stephentoub commented Feb 5, 2026

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.

Microsoft Reviewers: Open in CodeFlow

… 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.
@stephentoub stephentoub requested a review from a team as a code owner February 5, 2026 13:16
Copilot AI review requested due to automatic review settings February 5, 2026 13:16
@github-actions github-actions bot added the area-ai Microsoft.Extensions.AI libraries label Feb 5, 2026
Copy link
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 updates the OpenAI Responses chat client to handle streaming code interpreter content by yielding deltas incrementally rather than emitting the code in bulk only at the end of the response. This enables real-time streaming of code generation, improving the user experience.

Changes:

  • Added streaming support for code interpreter delta updates, creating CodeInterpreterToolCallContent for each delta as it arrives
  • Extracted the Python media type string into a reusable constant (PythonMediaType)
  • Added comprehensive test coverage to verify delta streaming behavior and proper coalescing of deltas into final responses

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIResponsesChatClient.cs Added handling for StreamingResponseCodeInterpreterCallCodeDeltaUpdate to yield deltas incrementally; inlined code interpreter content creation logic (removing helper method); updated OutputItemDone handler to only yield result content (assuming deltas handled the call content)
src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIClientExtensions.cs Extracted Python media type string into a constant PythonMediaType
src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIAssistantsChatClient.cs Updated to use the new PythonMediaType constant
test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIResponseClientTests.cs Updated existing tests with exact code assertions; added new comprehensive test CodeInterpreterTool_Streaming_YieldsCodeDeltas to verify streaming delta behavior and proper coalescing

@stephentoub stephentoub merged commit 56292e7 into dotnet:main Feb 6, 2026
6 checks passed
@stephentoub stephentoub deleted the fixcodeint branch February 6, 2026 22:47
joperezr pushed a commit that referenced this pull request Feb 10, 2026
… 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
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 <[email protected]>

* 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 <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: stephentoub <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* Add ImageGenerationToolCallContent and ImageGenerationToolResultContent to JSON serialization infrastructure (#7275)

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: stephentoub <[email protected]>

* Mark all of MicrosoftExtensionsAIChatExtensions as experimental

---------

Co-authored-by: Stephen Toub <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: stephentoub <[email protected]>
Co-authored-by: Jeff Handley <[email protected]>
Co-authored-by: Jeff Handley <[email protected]>
@github-actions github-actions bot locked and limited conversation to collaborators Mar 9, 2026
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