Skip to content

Add Foundation Models 27 request options - #352

Merged
mattt merged 5 commits into
mainfrom
mattt/foundation-models-27-options
Oct 18, 2026
Merged

mattt merged 5 commits into
mainfrom
mattt/foundation-models-27-options

Conversation

@mattt

@mattt mattt commented Oct 17, 2026

Copy link
Copy Markdown
Collaborator

This PR lands #311 by @qoli, with fixes on top. GenerationOptions gains the Foundation Models 27 toolCallingMode property and ToolCallingMode type, the samplingMode property, and the initializers that take them. A new ContextOptions type holds the schema-in-prompt and reasoning-level settings. On OS 27, the models that run through Foundation Models pass the tool-calling mode to it.

On top of #311, this PR:

  • Resolves the conflict with Let callers set how many tool rounds a response takes #331. Transcripts code toolCallingMode and maximumToolRounds together, write each one only when it isn't the default, and still read transcripts that don't have them.
  • Defaults samplingMode to nil in init(samplingMode:temperature:maximumResponseTokens:), as Foundation Models 27 does. To keep GenerationOptions() unambiguous, init(sampling:temperature:maximumResponseTokens:) now requires its sampling argument, as it does in Foundation Models 27. Calls that omit sampling now resolve to the samplingMode initializer.
  • Corrects the README, which said other providers could read toolCallingMode. Only SystemLanguageModel, PrivateCloudComputeLanguageModel, and FoundationLanguageModel pass it to Foundation Models, and other providers ignore it. The README also says that no API accepts ContextOptions yet.
  • Documents that the new options follow the Foundation Models 27 API.

qoli and others added 5 commits October 17, 2026 16:31
init(samplingMode:temperature:maximumResponseTokens:) now defaults
samplingMode to nil, as Foundation Models 27 does. To keep
GenerationOptions() and GenerationOptions(temperature:) unambiguous,
init(sampling:temperature:maximumResponseTokens:) now requires its
sampling argument, as the Foundation Models 27 declaration does; calls
that omitted it resolve to the samplingMode initializer.

The new options document that they follow the Foundation Models 27
API, and a pair of tests compiles the same code against both modules.
The request options section said other providers could read
toolCallingMode. Only SystemLanguageModel, PrivateCloudComputeLanguageModel,
and FoundationLanguageModel pass it to Foundation Models on OS 27;
other providers ignore it. The section also says that no API accepts
ContextOptions yet, and the extensions list drops samplingMode,
which Foundation Models back-deploys to OS 26.
@mattt
mattt merged commit 69f7a8c into main Oct 18, 2026
11 checks passed
@mattt
mattt deleted the mattt/foundation-models-27-options branch October 18, 2026 00:24
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