From a05d460caea648d2423e99b7d1d3ca9aca731335 Mon Sep 17 00:00:00 2001 From: leehack Date: Mon, 9 Nov 2026 20:06:08 -0500 Subject: [PATCH] Document that LiteRT-LM Web generate() wraps the prompt in a user turn @litert-lm/core 0.19.0 and the 0.20 nightly expose no raw streaming route: the Session API decodes a whole reply per call, with no streaming or stop cause, so generate() keeps the conversation route. State the Web behaviour in the generation guide, backend selection, support matrix and chat streaming skill. Refs #1863, #1874 --- CHANGELOG.md | 2 ++ skills/llamadart-chat-streaming/SKILL.md | 3 ++- website/docs/changelog/recent-releases.md | 2 ++ website/docs/guides/backend-selection.md | 5 +++-- website/docs/guides/generation-and-streaming.md | 7 ++++++- website/docs/platforms/support-matrix.md | 2 ++ 6 files changed, 17 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68fd84b4a..c16540595 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Unreleased +- Document that LiteRT-LM Web `generate()` wraps the prompt in one user turn of the bundle's chat template, because `@litert-lm/core@0.19.0` has no raw streaming route ([#1863](https://github.com/leehack/llamadart/issues/1863)). + ## 0.19.2 - Keep the default WebGPU bridge assets at `v0.1.83` (unchanged from 0.19.1). diff --git a/skills/llamadart-chat-streaming/SKILL.md b/skills/llamadart-chat-streaming/SKILL.md index 57465468b..f32180056 100644 --- a/skills/llamadart-chat-streaming/SKILL.md +++ b/skills/llamadart-chat-streaming/SKILL.md @@ -37,7 +37,8 @@ modalities and speculative strategies before offering them. every call and append the assistant reply yourself. - `engine.generate(prompt)` only for an already-rendered raw prompt; it skips the chat template, except on LiteRT-LM Web, which sends the prompt as one - user turn through the bundle's template. + user turn through the bundle's template (`@litert-lm/core@0.19.0` has no + raw streaming route), so never pass it a `chatTemplate()`-rendered prompt. - Opt in with the portable `LlamaBackend.withTextHistory()` factory, or the direct Web `LiteRtLmBackend.withTextHistory()` factory, for ordered system/user/assistant text through diff --git a/website/docs/changelog/recent-releases.md b/website/docs/changelog/recent-releases.md index 97a7e58fe..28b91d88b 100644 --- a/website/docs/changelog/recent-releases.md +++ b/website/docs/changelog/recent-releases.md @@ -13,6 +13,8 @@ validate against the exact release tag notes. ## Unreleased +- Document that LiteRT-LM Web `generate()` wraps the prompt in one user turn of the bundle's chat template, because `@litert-lm/core@0.19.0` has no raw streaming route ([#1863](https://github.com/leehack/llamadart/issues/1863)). + ## 0.19.2 - Keep default WebGPU bridge assets at `v0.1.83` (unchanged from 0.19.1). diff --git a/website/docs/guides/backend-selection.md b/website/docs/guides/backend-selection.md index 7c33b87ab..cb4c383d8 100644 --- a/website/docs/guides/backend-selection.md +++ b/website/docs/guides/backend-selection.md @@ -334,8 +334,9 @@ LiteRT-LM Web rejects tool declarations/results, media and user/system thinking assistant/system message, custom templates (including an empty override), `enableThinking: false`, template kwargs, explicit template clocks and native-only `liteRtLm*` controls. Default thinking remains the model's behavior; no template -replacement or thinking-budget support is implied. Raw `generate` sends one user -text. Low-level `backend.applyChatTemplate` accepts one user message only; use +replacement or thinking-budget support is implied. Raw `generate` wraps the +prompt in one user turn of the bundle's template +([#1863](https://github.com/leehack/llamadart/issues/1863)). Low-level `backend.applyChatTemplate` accepts one user message only; use `engine.create` for structured history. Automatic tool loops remain unavailable. The remaining #1152 scope is tracked in [the runtime gap](https://github.com/leehack/llamadart/issues/1152). diff --git a/website/docs/guides/generation-and-streaming.md b/website/docs/guides/generation-and-streaming.md index 348397f42..3de908528 100644 --- a/website/docs/guides/generation-and-streaming.md +++ b/website/docs/guides/generation-and-streaming.md @@ -26,7 +26,12 @@ adds one, and only one: a prompt that already starts with it, such as a Native LiteRT-LM throws `LlamaArgumentException` for an empty prompt. LiteRT-LM Web is the exception: it sends the prompt as one user turn through the bundle's chat template, because `@litert-lm/core` cannot replace that -template ([#1863](https://github.com/leehack/llamadart/issues/1863)). +template. Its `Session` API skips the template, but it decodes a whole reply +per call, with no streaming or stop cause, so `generate()` does not use it +([#1863](https://github.com/leehack/llamadart/issues/1863)). `create()` and +`ChatSession` are unaffected. Do not pass a prompt you rendered with +`chatTemplate()` to Web LiteRT-LM `generate()`: the bundle would template it +again. For one-shot instructions, prefer `engine.create(...)`: it applies the chat template without session state, and a follow-up turn sees only the messages you diff --git a/website/docs/platforms/support-matrix.md b/website/docs/platforms/support-matrix.md index b47071224..aecd1c477 100644 --- a/website/docs/platforms/support-matrix.md +++ b/website/docs/platforms/support-matrix.md @@ -189,6 +189,8 @@ video and URL-only images throw `LlamaUnsupportedException`, as do tool-role image/audio parts and media alongside `LlamaToolResultContent` under any role ([tool-result media](../guides/tool-calling#tool-result-media)). +LiteRT-LM Web `generate(prompt)` wraps the prompt in one user turn of the bundle's chat template (native LiteRT-LM and the other backends send it unchanged). `@litert-lm/core@0.19.0` cannot replace that template, and its `Session` API decodes a whole reply per call, with no streaming or stop cause. `create()` and `ChatSession` are unaffected ([#1863](https://github.com/leehack/llamadart/issues/1863)). + `LlamaEngine.supportsVideo` returns `false` on every runtime, and passing `LlamaVideoContent` throws `LlamaUnsupportedException`. Web state paths point into the bridge's WASMFS virtual filesystem; to keep state across reloads,