Clarify the error for image inputs being unsupported#14
Conversation
… that does not support image inputs
The error message should be self-explanatory.
| } catch ComposedPromptError.unsupportedOS { | ||
| error?.pointee = FMComposedPromptAddImageErrorUnsupportedOS | ||
| return false | ||
| } catch ComposedPromptError.unsupportedSDK { | ||
| error?.pointee = FMComposedPromptAddImageErrorUnsupportedSDK |
There was a problem hiding this comment.
Should this really be within the responsibilities of the C bindings? This is not really bridging anything from the Swift framework. Is it at all possible to detect OS/SDK mismatches from the Python side?
There was a problem hiding this comment.
I wish we didn't have to maintain this piping code in the Swift package, but I couldn't quite find any viable alternatives that include the image input functionality for macOS 27 users, without breaking builds of the package for users still using the macOS 26 SDK. Looked into accessing the symbols dynamically using dlsym, but it doesn't seem to work well with Swift structs like Attachment. We could also maintain two versions of our package (one using the macOS 27 symbols, one without), but it might then just mean more friction when installing the package. Have any other ideas?
Ultimately, we can always remove this code if we don't feel good about adding this in our bindings, but it'll just mean that it might be harder for a user to understand why image attachments are unsupported, especially in edge cases such as when they're using a macOS 26 SDK on a macOS 27 machine. We could consider other mitigations like logging on pip install.
When trying to use image inputs, we now use a different error for those two cases: