You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR is the last of three that bring in #273 by @qoli. It adds LanguageModelSession.init(model:dynamicInstructions:history:), following Foundation Models 27. The session evaluates the dynamic instructions before every request to the model, including the request that continues a response after tool calls, and sends the resolved instructions and tools in that request's context (#292). The resolved instructions never become part of the session's transcript.
On OS 27, SystemLanguageModel and the other Foundation Models adapters pass the dynamic instructions to Foundation Models directly. On OS 26, SystemLanguageModel throws the new SystemLanguageModel.Error.dynamicInstructionsUnavailable, because Foundation Models there can't resolve them again for the request after tool calls.
The fallback is also selected on OS 27 when the package is compiled with Swift 6.3, because the native branch is excluded by compiler(>=6.4). Document that case; otherwise an OS 27 user can unexpectedly receive the stated error despite satisfying this note.
This message is misleading for binaries built with Swift 6.3: the compiler(>=6.4) gate above makes this case throw even when the device is already on OS 27. Mention the build-toolchain requirement so users on OS 27 know that upgrading only the runtime is insufficient.
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
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 is the last of three that bring in #273 by @qoli. It adds
LanguageModelSession.init(model:dynamicInstructions:history:), following Foundation Models 27. The session evaluates the dynamic instructions before every request to the model, including the request that continues a response after tool calls, and sends the resolved instructions and tools in that request's context (#292). The resolved instructions never become part of the session's transcript.On OS 27,
SystemLanguageModeland the other Foundation Models adapters pass the dynamic instructions to Foundation Models directly. On OS 26,SystemLanguageModelthrows the newSystemLanguageModel.Error.dynamicInstructionsUnavailable, because Foundation Models there can't resolve them again for the request after tool calls.On top of @qoli's work, this PR:
session.toolsandsession.instructionsare empty for these sessionsdecodingFailurethrown before OS 27 with the new error