refactor: Gracefully handle images sent to non-vision models#223
Merged
refactor: Gracefully handle images sent to non-vision models#223
Conversation
Signed-off-by: Eden Reich <eden.reich@gmail.com>
ig-semantic-release-bot bot
added a commit
that referenced
this pull request
Dec 12, 2025
## [0.22.8](v0.22.7...v0.22.8) (2025-12-12) ### ♻️ Improvements * Gracefully handle images sent to non-vision models ([#223](#223)) ([06fb970](06fb970)) ### 👷 CI * Setup infer workflow ([#222](#222)) ([2c235be](2c235be)) ### 🔧 Miscellaneous * **deps:** Bump claude code to its latest for development ([9c4a7ee](9c4a7ee))
Contributor
|
🎉 This PR is included in version 0.22.8 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Summary
Changes image handling behavior from returning an error to stripping image content and proceeding with text-only messages. This provides better UX by allowing requests to continue when users accidentally include images with non-vision models.
Changes
1. Behavior Change
2. New Method:
StripImageContent()providers/message_helpers.go3. Updated Route Handler
api/routes.goto use the new stripping logic4. Comprehensive Tests
TestMessage_StripImageContentintests/multimodal_test.goBenefits
Technical Details
When
EnableVisionis true and a non-vision model receives image content:The
StripImageContent()method handles the OpenAPI message format where content can be:Testing
Run the tests with:
task testThe new tests verify: