Skip to content

Adopt Foundation Models OS 27 surfaces: image attachments, capabilities, context size - #206

Open
james-333i wants to merge 1 commit into
huggingface:mainfrom
james-333i:feat/foundation-models-os27
Open

Adopt Foundation Models OS 27 surfaces: image attachments, capabilities, context size#206
james-333i wants to merge 1 commit into
huggingface:mainfrom
james-333i:feat/foundation-models-os27

Conversation

@james-333i

Copy link
Copy Markdown

This updates the Foundation Models adapter for OS 27 while keeping the package building unchanged on Xcode 26.

Image input: Transcript image segments were previously dropped when converting to a FoundationModels transcript. On OS 27 they now map to Transcript.Segment.attachment with an ImageAttachment, built directly for URL sources and via ImageIO decoding for data sources. Verified end to end on an iPhone running iOS 27 (image prompt answered by the on-device model).

Capabilities and context: SystemLanguageModel now exposes contextSize (back-deployed by Apple to OS 26) and supportsImageInput, which reports the OS 27 vision capability and returns false on earlier OS versions.

Generation options: the adapter now sets maximumResponseTokens on FoundationModels.GenerationOptions. The property has existed since OS 26 but was never assigned, so response token limits were silently ignored on the Foundation Models backend. Verified on device: a capped request now terminates at the limit.

The OS 27 references are behind #if compiler(>=6.4) with runtime availability checks, so Xcode 26 builds still compile and the deployment floor is unchanged

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.

1 participant