Add reasoning_effort control to the LLM server - #263
Merged
Merged
Conversation
Adds an OpenAI-compatible reasoning_effort field to the chat completions request and a --reasoning-default server flag, so callers can set the thinking budget of reasoning models. The value maps to chat-template keyword arguments (reasoning_effort, reasoning_strength, enable_thinking) and is applied through applyChatTemplate(additionalContext:). --no-thinking becomes an alias for --reasoning-default none. A request that omits the field keeps the template's own default.
stikves
force-pushed
the
sukru/reasoning-effort
branch
from
September 20, 2026 16:45
c8a280b to
1a51f94
Compare
Make --no-thinking an alias for --reasoning-default none and reject the contradictory combination of --no-thinking with a non-none default. Gate the legacy /no_think literal injection on the resolved effort being none instead of an independent noThinking flag, so the two paths cannot disagree. Drop the ungrounded reasoning_strength template var (no template in the repo consumes it); keep reasoning_effort and enable_thinking. Add resolution/precedence tests for disablesThinking and resolveDefault, including the contradictory-flags case.
stikves
marked this pull request as ready for review
September 22, 2026 18:00
Lewis300
approved these changes
Sep 22, 2026
tjia1818
reviewed
Sep 22, 2026
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.
Adds an OpenAI-compatible
reasoning_effortcontrol so callers can set the thinking budget of reasoning models through the chat completions API or a server default.What this adds
ChatCompletionRequest.reasoning_effort(optional string). Canonical values arenone,low,medium,high; model-specific values pass through.ReasoningEffort, which maps the value to chat-template keyword arguments and applies request-over-default precedence.applyChatTemplate(additionalContext:).--reasoning-default <level>sets the server-wide default.--no-thinkingis now an alias for--reasoning-default none.Behavior
A request that omits the field with no default set is unchanged, so current behavior is preserved. A reasoning model picks up the value when its chat template reads one of
reasoning_effort,reasoning_strength, orenable_thinking; other models keep their existing output.Testing
ReasoningEffortTestscovers the resolver mapping, precedence, and request decoding.xcodebuild -scheme coreai-models-Package.Opening as a draft for early review. A FoundationModels-path variant (using
ContextOptions.reasoningLevel) can follow as a separate change.