fix(llm): normalize multimodal image paths to file:// URIs#1090
Merged
msluszniak merged 1 commit intomainfrom Apr 22, 2026
Merged
fix(llm): normalize multimodal image paths to file:// URIs#1090msluszniak merged 1 commit intomainfrom
msluszniak merged 1 commit intomainfrom
Conversation
The native multimodal pipeline expects image paths to be `file://` URIs. `ResourceFetcher.fetch` returns raw filesystem paths without that prefix (per its own docstring), and platform image-picker APIs typically return `file:///...` URIs, so callers can plausibly arrive at `LLMModule.generate`/`sendMessage` with either form. Today only the prefixed form works — the bare path gets `"Read image error: invalid argument"` from native, with no explanation in the error. Normalize each image path inside `LLMController.forward` so both forms are accepted, and document the new contract on the relevant JSDoc (`Message.mediaPath` and `LLMModule.forward`'s `imagePaths` parameter). Refs #1086 (item 3). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
barhanc
approved these changes
Apr 22, 2026
This was referenced Apr 22, 2026
Merged
msluszniak
added a commit
that referenced
this pull request
Apr 29, 2026
## Summary Patch release v0.8.4 — cherry-picks the following commits from `main` into `release/0.8`: - fix: graceful degradation when native libraries are unavailable (Android) (#1067) - fix(llm): normalize multimodal image paths to file:// URIs (#1090) - fix(llm): auto-shape multimodal mediaPath messages in chat template (#1089) - feat(llm): min_p and repetition_penalty sampling, per-model defaults, letterbox vision (#1099) ## Checklist - [x] Commits cherry-picked from `main` in chronological order (with `-x`) - [x] Version bumped to `0.8.4` in `packages/react-native-executorch/package.json` - [x] Adapter packages (`bare-resource-fetcher`, `expo-resource-fetcher`) untouched by cherry-picks — versions not bumped ## Docs The unversioned doc edits that landed via the #1099 cherry-pick belong on the "Next" version (i.e. `main`) and are already there from the original PR. The corresponding `docs/versioned_docs/version-0.8.x/...` updates will be done in a separate PR targeting `main` after `v0.8.4` is published to npm — that PR will also regenerate the v0.8.x api-reference snapshot so anchors for the new sampling fields resolve. --------- Co-authored-by: Radek Czemerys <7029942+radko93@users.noreply.github.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: Norbert Klockiewicz <Nklockiewicz12@gmail.com>
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.
Description
LLMController.forwardpassedimagePathsstraight through tonativeModule.generateMultimodalwith no normalization. The native side requires thefile://prefix; without it, native throws"Read image error: invalid argument"with no further context. Callers can plausibly arrive with either form:ResourceFetcher.fetchreturns raw paths withoutfile://(per its own docstring on thefetchmethod).expo-image-picker) typically returnfile:///...URIs.forward(...)works either way; the asymmetry between vision modules and multimodal LLM is undocumented.This PR normalizes each image path inside
LLMController.forwardso both forms work, and updates the JSDoc onMessage.mediaPathandLLMModule.forward.imagePathsto document the new contract.Introduces a breaking change?
Strictly additive: previously-working calls (paths with
file://) keep working unchanged. Previously-failing calls (paths withoutfile://) now succeed.Type of change
Tested on
The bare-path failure was reproduced on Android (Samsung Galaxy S24 Ultra) with LFM2-VL-1.6B while building a downstream consumer; both forms tested manually post-fix on the same device. Re-verification of both forms on iOS is recommended.
Testing instructions
Related issues
Addresses item 3 of #1086.
Checklist
Additional notes
The normalizer is module-scope (matching
messagesForChatTemplatefrom #1089) rather than a class method because it doesn't depend on controller state.