LocalAI/core/templates
Ettore Di Giacinto 7809c5f5d0
fix(vision): propagate mtmd media marker from backend via ModelMetadata (#9412)
Upstream llama.cpp (PR #21962) switched the server-side mtmd media
marker to a random per-server string and removed the legacy
"<__media__>" backward-compat replacement in mtmd_tokenizer. The
Go layer still emitted the hardcoded "<__media__>", so on the
non-tokenizer-template path the prompt arrived with a marker mtmd
did not recognize and tokenization failed with "number of bitmaps
(1) does not match number of markers (0)".

Report the active media marker via ModelMetadataResponse.media_marker
and substitute the sentinel "<__media__>" with it right before the
gRPC call, after the backend has been loaded and probed. Also skip
the Go-side multimodal templating entirely when UseTokenizerTemplate
is true — llama.cpp's oaicompat_chat_params_parse already injects its
own marker and StringContent is unused in that path. Backends that do
not expose the field keep the legacy "<__media__>" behavior.
2026-04-18 20:30:13 +02:00
..
cache.go feat: add distributed mode (#9124) 2026-03-30 00:47:27 +02:00
evaluator.go feat: add distributed mode (#9124) 2026-03-30 00:47:27 +02:00
evaluator_test.go feat: add distributed mode (#9124) 2026-03-30 00:47:27 +02:00
multimodal.go fix(vision): propagate mtmd media marker from backend via ModelMetadata (#9412) 2026-04-18 20:30:13 +02:00
multimodal_test.go fix: untangle pkg and core (#5896) 2025-07-24 15:03:41 +02:00
templates_suite_test.go fix: untangle pkg and core (#5896) 2025-07-24 15:03:41 +02:00