Skip to content

Revise reasoning effort values in OpenAIPromptExecutionSettings - #14285

Open
Rui Hiraoka (rui-hira) wants to merge 1 commit into
microsoft:mainfrom
rui-hira:patch-1
Open

Revise reasoning effort values in OpenAIPromptExecutionSettings#14285
Rui Hiraoka (rui-hira) wants to merge 1 commit into
microsoft:mainfrom
rui-hira:patch-1

Conversation

@rui-hira

Copy link
Copy Markdown

Updated the documentation for reasoning effort values to include 'none' and 'xhigh'.

Motivation and Context

The reasoning_effort values currently documented for the GPT-5 series include none, minimal, low, medium, high, xhigh, and max, with support varying by model. The current remarks list only low, medium, high, and minimal, so callers have no indication that none (and others) are valid.
none in particular is not a niche value — it is required for some Chat Completions scenarios on newer models.

Description

This property is object and REST level, none and xhigh are also available.
https://learn.microsoft.com/en-us/rest/api/microsoft-foundry/azureopenai/chat?view=rest-microsoft-foundry-v1#openaireasoningeffort
image

Contribution Checklist

Updated the documentation for reasoning effort values to include 'none' and 'xhigh'.
@rui-hira
Rui Hiraoka (rui-hira) requested a review from a team as a code owner August 13, 2026 07:49
Copilot AI lite review requested due to automatic review settings August 13, 2026 07:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates the .NET OpenAI connector’s execution settings documentation to expand the documented reasoning_effort values, aiming to reflect newer model/API capabilities.

Changes:

  • Updated OpenAIPromptExecutionSettings.ReasoningEffort XML remarks to include additional string values ("none", "xhigh").

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 26 to 30
/// Constrains effort on reasoning for reasoning models.
/// Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.
/// Possible values are:
/// <para>- <see cref="string"/> values: <c>"low"</c>, <c>"medium"</c>, <c>"high"</c>, <c>"minimal"</c>;</para>
/// <para>- <see cref="string"/> values: <c>"none"</c>, <c>"minimal"</c>, <c>"low"</c>, <c>"medium"</c>, <c>"high"</c>, <c>"xhigh"</c>;</para>
/// <para>- <see cref="ChatReasoningEffortLevel"/> object;</para>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

MAF Automated Review — Iteration 1

Result: Findings reported
Scope: full PR (1 commit(s)): ccfd59be36f0
Model: claude-opus-4.8

Overview

This PR revises a single XML-doc line to broaden the documented set of reasoning_effort string values, adding "none" and "xhigh". No executable code, serialization, or API signature changed, so there is no runtime regression and no security impact. However, the changed line now lists these values under <see cref="string"/> values, while the sole string consumer (GetEffortLevel) accepts only low/medium/high/minimal and throws NotSupportedException for anything else — creating a doc-vs-runtime contract mismatch that can steer callers into a request-time exception.

Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
1 verified finding remained after source verification (1 medium) across 1 file. Details are attached to the affected lines below.

Affected areas: dotnet/src/Connectors/Connectors.OpenAI/Settings/OpenAIPromptExecutionSettings.cs

/// Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.
/// Possible values are:
/// <para>- <see cref="string"/> values: <c>"low"</c>, <c>"medium"</c>, <c>"high"</c>, <c>"minimal"</c>;</para>
/// <para>- <see cref="string"/> values: <c>"none"</c>, <c>"minimal"</c>, <c>"low"</c>, <c>"medium"</c>, <c>"high"</c>, <c>"xhigh"</c>;</para>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This line now documents "none" and "xhigh" as accepted string values, but the string-handling path in GetEffortLevel (ClientCore.ChatCompletion.cs:568-578) maps only "low", "medium", "high", and "minimal" and throws NotSupportedException for any other string. A caller who follows this doc and sets ReasoningEffort = "none" (or "xhigh") will get a runtime NotSupportedException when the request is built (same path for OpenAI and Azure OpenAI via AzureClientCore.ChatCompletion.cs:56). Please either restrict the documented string list to the values the switch actually accepts ("minimal", "low", "medium", "high") and note that extended values such as "none"/"xhigh" must be passed via a ChatReasoningEffortLevel object, or extend GetEffortLevel to accept "none"/"xhigh" so the code matches the documented contract.

@rui-hira

Copy link
Copy Markdown
Author

Need to revise this validation to include current parameters so please do not merge this before the validator is fixed.

protected static ChatReasoningEffortLevel? GetEffortLevel(OpenAIPromptExecutionSettings executionSettings)
{
var effortLevelObject = executionSettings.ReasoningEffort;
if (effortLevelObject is null)
{
return null;
}
if (effortLevelObject is ChatReasoningEffortLevel effort)
{
return effort;
}
if (effortLevelObject is string textEffortLevel)
{
return textEffortLevel.ToUpperInvariant() switch
{
"LOW" => ChatReasoningEffortLevel.Low,
"MEDIUM" => ChatReasoningEffortLevel.Medium,
"HIGH" => ChatReasoningEffortLevel.High,
"MINIMAL" => new("minimal"),
_ => throw new NotSupportedException($"The provided reasoning effort '{textEffortLevel}' is not supported.")
};
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants