Merged
Conversation
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
… limitation Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add reasoning configuration to ChatOptions
Add ReasoningOptions to ChatOptions
Feb 2, 2026
stephentoub
reviewed
Feb 2, 2026
src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ChatOptions.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ReasoningEffort.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ReasoningOptions.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIChatClient.cs
Outdated
Show resolved
Hide resolved
Member
…nal, simplify ToOpenAIChatReasoningEffortLevel Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
stephentoub
reviewed
Feb 2, 2026
src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ChatOptions.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ReasoningEffort.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ReasoningEffort.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ReasoningEffort.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ReasoningOptions.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ReasoningEffort.cs
Outdated
Show resolved
Hide resolved
test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/ChatCompletion/ChatOptionsTests.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Member
|
cc: @PederHP |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds reasoning configuration options to the ChatOptions class, enabling developers to control how much computational effort AI models should apply when generating responses and how reasoning content should be included.
Changes:
- Introduced
ReasoningEffortenum (None, Low, Medium, High, ExtraHigh) andReasoningOutputenum (None, Summary, Detailed) to the abstractions layer - Added
ReasoningOptionsclass withEffortandOutputproperties, plus internalClone()method for copy semantics - Integrated reasoning options into
ChatOptionswith proper cloning support in the copy constructor - Implemented OpenAI-specific mappings in both
OpenAIChatClient(reasoning effort only) andOpenAIResponsesChatClient(both effort and output) - Added comprehensive test coverage including unit tests, JSON serialization tests, and integration tests that verify expected JSON output
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ReasoningEffort.cs | New enum defining reasoning effort levels (None, Low, Medium, High, ExtraHigh) |
| src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ReasoningOutput.cs | New enum defining reasoning output modes (None, Summary, Detailed) |
| src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ReasoningOptions.cs | New sealed class containing reasoning configuration with internal Clone() method |
| src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ChatOptions.cs | Added Reasoning property and clone logic in copy constructor |
| src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIChatClient.cs | Maps ReasoningEffort to OpenAI ChatReasoningEffortLevel (ExtraHigh maps to High) |
| src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIResponsesChatClient.cs | Maps both ReasoningEffort and ReasoningOutput to OpenAI Response API types |
| src/Libraries/Microsoft.Extensions.AI.Abstractions/Microsoft.Extensions.AI.Abstractions.json | API baseline manifest updated with new stable APIs |
| test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/ChatCompletion/ReasoningOptionsTests.cs | Comprehensive unit tests for ReasoningOptions including JSON serialization |
| test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/ChatCompletion/ChatOptionsTests.cs | Updated tests to verify Reasoning property and cloning behavior |
| test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIChatClientTests.cs | Tests verifying correct JSON generation for reasoning effort in Chat API |
| test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIResponseClientTests.cs | Tests verifying correct JSON generation for reasoning effort and output in Response API |
| test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/TestJsonSerializerContext.cs | Added JSON serialization support for new types |
src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ReasoningEffort.cs
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ReasoningOutput.cs
Outdated
Show resolved
Hide resolved
eiriktsarpalis
approved these changes
Feb 3, 2026
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.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.
ReasoningEffortenum with None, Low, Medium, High, ExtraHigh valuesReasoningOutputenum with None, Summary, Full values (renamed Detailed → Full)ReasoningOptionsclass with Effort and Output propertiesReasoningproperty toChatOptionsclassChatOptionscopy constructor to clone Reasoning[Experimental]attribute and add to stable JSON fileClone()method internalToOpenAIChatReasoningEffortLevelmethodReasoningOutput.Detailed→ReasoningOutput.Fullfor clarityOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.
Microsoft Reviewers: Open in CodeFlow