diskformer 0.5.4 → 0.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ggml/llama.js CHANGED
@@ -55,9 +55,10 @@ export class Llama {
55
55
  return this.request({ type: 'load', opfsName: name, budget, slots, ctx, env }, ['loaded'], (d) => { if (d.type === 'plan' && onPlan) onPlan(d.plan); });
56
56
  }
57
57
 
58
- // A reply through the model's chat template; greedy. Resolves { text, stats }.
59
- chat(messages, { n = 512, onPiece } = {}) {
60
- return this.request({ type: 'chat', messages, n }, ['done'], (d) => { if (d.type === 'piece' && onPiece) onPiece(d.piece); });
58
+ // A reply through the model's chat template; greedy. Resolves { text, stats }. thinking: false renders the template
59
+ // with reasoning off (models that reason first then answer directly); default: the template's own choice.
60
+ chat(messages, { n = 512, thinking = true, onPiece } = {}) {
61
+ return this.request({ type: 'chat', messages, n, thinking }, ['done'], (d) => { if (d.type === 'piece' && onPiece) onPiece(d.piece); });
61
62
  }
62
63
 
63
64
  // A continuation of an already formatted prompt; greedy.
package/ggml/worker.mjs CHANGED
@@ -3,7 +3,7 @@
3
3
  // sync access handles, straight into the wasm heap. A GGUF gets into OPFS by download (resumable, from a URL) or by
4
4
  // copying a picked file; with opfs: false a picked File is read in place instead (slower).
5
5
  //
6
- // Messages in: load {opfsName | file, budget | slots, ctx, env} · chat {messages, n} · complete {prompt, n} (the gate)
6
+ // Messages in: load {opfsName | file, budget | slots, ctx, env} · chat {messages, n, thinking} · complete {prompt, n} (the gate)
7
7
  // · abort · download {url, name, size} · list · remove {name}
8
8
  // Messages out: log · progress · plan · loaded · piece · done · downloaded · models · removed · error
9
9
  import createModule from './dist/df-chat.mjs'; // built from ggml/build-wasm, see ggml/dist/BUILD.md
@@ -188,7 +188,7 @@ onmessage = async ({ data }) => {
188
188
  } else if (data.type === 'chat') {
189
189
  // messages: the whole conversation; prompt: one user turn (the older single-turn form)
190
190
  const reply = data.messages
191
- ? await mod._df_chat_messages(str(JSON.stringify(data.messages)), data.n ?? 512)
191
+ ? await mod._df_chat_messages(str(JSON.stringify(data.messages)), data.n ?? 512, data.thinking === false ? 0 : 1)
192
192
  : await mod._df_chat(str(data.prompt), data.n ?? 64);
193
193
  post('done', { text: text(reply), stats: JSON.parse(text(mod._df_stats())) });
194
194
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diskformer",
3
- "version": "0.5.4",
3
+ "version": "0.6.4",
4
4
  "description": "Run a model larger than your GPU memory in a browser tab: weights stay in OPFS, WebGPU holds only what each step needs. llama.cpp with paged MoE experts (diskformer/llama), a disk tier, and hand-written MoE engines.",
5
5
  "type": "module",
6
6
  "license": "MIT",