Repository navigation
feat(session): accept images in prompts on iOS 27 - #42
Merged
Merged
Conversation
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.
Closes #25.
respond,streamResponse,tokenCount, and the hooks now accept{ text, images: [{ uri, label? }] }as well as a plain string. Images go to the model throughAttachment(imageURL:). This works with structured output and streaming.file://URIs are accepted. Any other scheme, or a file that does not exist, rejects with the newINVALID_PROMPTcode, and the error names the image index.visionrejects withUNSUPPORTED_CAPABILITY. On iOS 26, a prompt with images rejects withUNSUPPORTED_PLATFORM.NativePrompt { text, images }struct instead ofstring, so nitrogen output is regenerated.ImageReferencefor tools is not included. Tools are defined by JSON schemas, so that needs its own design.Verification
I ran the example app on the iOS 27 simulator (AFM 3 Core,
visioncapable) against a generated receipt image.respondwith imagestreamResponsewith image{ merchant: 'BLUE CAFE', total: 4.5 }tokenCounthttps://URIINVALID_PROMPTbefore reaching nativeINVALID_PROMPTfrom nativebun run typecheck,bun run test(92 pass),bun run test:swift(8 suites, including the newPromptImageFileTests), and biome all pass.I did not run the iOS 26 runtime. The text path now goes through
Prompt(text)instead ofString, using API that has existed since iOS 26.0.