Repository navigation
Add Foundation Models 27 request options - #352
Merged
Merged
Conversation
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.
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.
This PR lands #311 by @qoli, with fixes on top.
GenerationOptionsgains the Foundation Models 27toolCallingModeproperty andToolCallingModetype, thesamplingModeproperty, and the initializers that take them. A newContextOptionstype 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:
toolCallingModeandmaximumToolRoundstogether, write each one only when it isn't the default, and still read transcripts that don't have them.samplingModetonilininit(samplingMode:temperature:maximumResponseTokens:), as Foundation Models 27 does. To keepGenerationOptions()unambiguous,init(sampling:temperature:maximumResponseTokens:)now requires itssamplingargument, as it does in Foundation Models 27. Calls that omitsamplingnow resolve to thesamplingModeinitializer.toolCallingMode. OnlySystemLanguageModel,PrivateCloudComputeLanguageModel, andFoundationLanguageModelpass it to Foundation Models, and other providers ignore it. The README also says that no API acceptsContextOptionsyet.