Skip to content

Conversation

@ReubenBond
Copy link
Member

Motivation and Context

The current Responses implementation does not match the streaming output produced by Responses.

Description

This PR migrates from the OpenAI SDK types to generated types for Responses and aligns output with the expected output.

The Responses HTTP API surface is still not fully covered, but this PR does not change that, and we can address it in a subsequent PR. Currently, only the CreateResponse API is supported.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Copilot AI review requested due to automatic review settings October 17, 2025 18:14
@github-actions github-actions bot changed the title Improve fidelity of OpenAI Responses hosting .NET: Improve fidelity of OpenAI Responses hosting Oct 17, 2025
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 migrates from the OpenAI SDK types to generated types for Responses, improving fidelity with streaming output. The changes restructure the responses implementation to use custom generated models instead of the OpenAI SDK types, while maintaining the same CreateResponse API functionality.

Key changes:

  • Replaced OpenAI SDK types with generated types for response handling
  • Implemented new converter classes for transforming between agent responses and generated models
  • Restructured streaming response processing with new event generation approach

Reviewed Changes

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

Show a summary per file
File Description
ResponseConverterExtensions.cs New converter for transforming agent responses to Response models
RequestConverterExtensions.cs New converter for extracting input messages from CreateResponse
AfItemResourceGenerator.cs New generator for creating item resources from streaming agent updates
SingletonOptionsMonitor.cs Utility class for singleton options monitoring
ModelConversionExtensions.cs Extension methods for converting between model types
IIdGenerator.cs Interface and extensions for generating various types of IDs
DefaultIdGenerator.cs Default implementation of ID generator with Foundry-style IDs
CompositeDisposable.cs Utility class for aggregating multiple disposable objects
AsyncEnumerableExtensions.cs Extension methods for async enumerable operations
AIAgentResponsesProcessor.cs Refactored processor to use generated types instead of OpenAI SDK
AssemblyInfo.cs Added InternalsVisibleTo for test assembly access
Microsoft.Agents.AI.Hosting.OpenAI.csproj Updated package references and removed unused warnings
HostApplicationBuilderExtensions.cs New extension for configuring OpenAI Responses support
EndpointRouteBuilderExtensions.Responses.cs Simplified endpoint mapping with new generated types
Program.cs Added OpenAI Responses configuration to sample
Directory.Packages.props Added System.ClientModel package reference

@stephentoub
Copy link
Member

Does this replace #1542 ?

@ReubenBond
Copy link
Member Author

Does this replace #1542 ?

Yes

@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 22, 2025
@stephentoub stephentoub added this pull request to the merge queue Oct 22, 2025
Merged via the queue into main with commit 103c7e7 Oct 22, 2025
14 checks passed
@ReubenBond ReubenBond deleted the rebond/responses_adapter/1 branch October 22, 2025 18:17
ReubenBond added a commit to ReubenBond/agent-framework that referenced this pull request Oct 28, 2025
* Improve conformance of OpenAI Responses API serving

* Update dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/Responses/AgentRunResponseExtensions.cs

Co-authored-by: Stephen Toub <[email protected]>

* Update dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/Responses/AgentRunResponseExtensions.cs

Co-authored-by: Stephen Toub <[email protected]>

* Sort packages

* Relax adherence where acceptable

* nit

* PromptCacheKey is not obsolete

* format

---------

Co-authored-by: Stephen Toub <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants