Conversation
…utor The executor reads request.contextOptions.reasoningLevel, maps it to a canonical effort string (light to low, moderate to medium, deep to high, custom verbatim), and injects it as a chat-template keyword argument. Callers set the reasoning budget through DynamicProfile.reasoningLevel; requests without a reasoning level are unchanged.
…nded reasoning_strength; add mapping test reasoningTemplateContext mirrors CoreAILMCommon.ReasoningEffort.templateContext (module layering blocks a direct import). Test covers ReasoningLevel to canonical-string mapping.
stikves
force-pushed
the
sukru/fm-reasoning-level
branch
from
September 23, 2026 00:52
f5942c2 to
3ea52cf
Compare
stikves
marked this pull request as ready for review
September 23, 2026 01:02
stikves
requested review from
carinapeng,
kevchengcodes,
srjoglekar246 and
tjia1818
September 23, 2026 01:02
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.
Teaches the CoreAI language model executor to honor
ContextOptions.reasoningLevel, so callers can set a reasoning model's thinking budget throughDynamicProfile.reasoningLevel(_:)(iOS/macOS 27.0).What this adds
The executor reads
request.contextOptions.reasoningLevel, maps it to a canonical effort string (.lightto low,.moderateto medium,.deepto high,.customverbatim), and injects it as a chat-template keyword argument (reasoning_effort,reasoning_strength, orenable_thinking). A chat template reads only the variables it references, so binding each is safe. Guarded by@available(FoundationModels 2.0).Behavior
A request without a reasoning level is unchanged, so current behavior is preserved. A reasoning model whose chat template reads one of these variables picks up the level; other models keep their existing output.
Testing
Builds and
swift format lint --strictpass. The mapping matches the reasoning-effort logic used on the server side and was verified on device, where a reasoning model's thinking budget scales with the level.