Map ReasoningEffort.None and ExtraHigh to "none" and "xhigh" in OpenAI IChatClient implementations#7319
Open
Map ReasoningEffort.None and ExtraHigh to "none" and "xhigh" in OpenAI IChatClient implementations#7319
Conversation
…ions Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix mapping for None reasoning effort in OpenAI ichatclient impls
Map ReasoningEffort.None to Minimal in OpenAI IChatClient implementations
Feb 19, 2026
stephentoub
reviewed
Feb 19, 2026
src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIResponsesChatClient.cs
Outdated
Show resolved
Hide resolved
stephentoub
reviewed
Feb 19, 2026
src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIResponsesChatClient.cs
Outdated
Show resolved
Hide resolved
…oningEffortLevel("none") instead of Minimal
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Copilot
AI
changed the title
Map ReasoningEffort.None to Minimal in OpenAI IChatClient implementations
Map ReasoningEffort.None to "none" in OpenAI IChatClient implementations
Feb 19, 2026
…nstead of High Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Copilot
AI
changed the title
Map ReasoningEffort.None to "none" in OpenAI IChatClient implementations
Map ReasoningEffort.None and ExtraHigh to "none" and "xhigh" in OpenAI IChatClient implementations
Feb 19, 2026
stephentoub
reviewed
Feb 19, 2026
test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIResponseClientTests.cs
Outdated
Show resolved
Hide resolved
…g InlineData Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
stephentoub
approved these changes
Feb 19, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Updates OpenAI IChatClient implementations in Microsoft.Extensions.AI.OpenAI to correctly translate ReasoningEffort.None and ReasoningEffort.ExtraHigh to OpenAI API-compatible string values, and adjusts unit tests accordingly.
Changes:
- Map
ReasoningEffort.Noneto"none"(instead of falling through tonull) in both chat-completions and responses clients. - Map
ReasoningEffort.ExtraHighto"xhigh"(instead of clamping toHigh) in both clients. - Update OpenAI OpenAI test suites to validate the new JSON values via existing theory-based tests.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIChatClient.cs | Updates ReasoningEffort → ChatReasoningEffortLevel mapping for None/ExtraHigh. |
| src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIResponsesChatClient.cs | Updates ReasoningEffort → ResponseReasoningEffortLevel mapping for None/ExtraHigh. |
| test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIChatClientTests.cs | Adjusts theory data to expect "none"/"xhigh" for chat-completions request JSON. |
| test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIResponseClientTests.cs | Adjusts theory data to expect "none"/"xhigh" for responses request JSON; removes an older fact test. |
test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIResponseClientTests.cs
Show resolved
Hide resolved
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.
ReasoningEffort.NoneandReasoningEffort.ExtraHighwere not mapping to their correct OpenAI API values.Nonewas falling through to the wildcard default and mapping tonull(indistinguishable from "not specified"), andExtraHighwas mapping toHigh. SinceChatReasoningEffortLevelandResponseReasoningEffortLevelare string-based extensible enum types, we construct new instances with the appropriate string values for cases where no static property is exposed.Changes
OpenAIChatClient.cs: MapReasoningEffort.None→new ChatReasoningEffortLevel("none"),ReasoningEffort.ExtraHigh→new ChatReasoningEffortLevel("xhigh")OpenAIResponsesChatClient.cs: MapReasoningEffort.None→new ResponseReasoningEffortLevel("none"),ReasoningEffort.ExtraHigh→new ResponseReasoningEffortLevel("xhigh")None/"none"andExtraHigh/"xhigh"as[InlineData]on the existing parameterized theory tests💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.
Microsoft Reviewers: Open in CodeFlow