@mlx-node/lm 0.0.7 → 0.0.8

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/dist/stream.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Gemma4Model as Gemma4ModelNative, Lfm2Model as Lfm2ModelNative, Qwen3Model as Qwen3ModelNative, Qwen35Model as Qwen35ModelNative, Qwen35MoeModel as Qwen35MoeModelNative } from '@mlx-node/core';
2
- import type { ChatConfig, ChatMessage, ChatStreamChunk, ChatStreamHandle, PerformanceMetrics, ToolCallResult } from '@mlx-node/core';
2
+ import type { ChatStreamChunk, ChatStreamHandle, PerformanceMetrics, ToolCallResult } from '@mlx-node/core';
3
+ import type { SessionCapableModel } from './chat-session.js';
3
4
  export interface ChatStreamDelta {
4
5
  text: string;
5
6
  done: false;
@@ -15,6 +16,29 @@ export interface ChatStreamFinal {
15
16
  promptTokens: number;
16
17
  reasoningTokens: number;
17
18
  rawText: string;
19
+ /**
20
+ * Number of prompt tokens served from the reused KV-cache prefix on
21
+ * this turn. Mirrors the `cachedTokens` field on the non-streaming
22
+ * `ChatResult` so session-aware streaming consumers can observe
23
+ * prefix-cache reuse without round-tripping to the non-streaming
24
+ * path.
25
+ *
26
+ * The native `ChatStreamChunk` surfaces `cachedTokens` on the
27
+ * terminal (`done == true`) chunk for every streaming entry point
28
+ * (Qwen3, Qwen3.5 Dense / MoE, LFM2, Gemma4, QianfanOCR) — start-path
29
+ * chunks carry the matched prefix length from
30
+ * `verify_cache_prefix_direct`, delta-path chunks carry the reused
31
+ * prior-history length. Non-terminal deltas carry `None` /
32
+ * `undefined` (only the terminal chunk is authoritative).
33
+ *
34
+ * This field remains OPTIONAL because the bridge-level mock tests
35
+ * (and any future in-process driver that constructs its own
36
+ * `ChatStreamChunk`) may legitimately omit it. Consumers SHOULD
37
+ * treat `undefined` distinctly from `0` (e.g. skip emitting
38
+ * `X-Cached-Tokens` rather than reporting `0`); a numeric value is
39
+ * always authoritative.
40
+ */
41
+ cachedTokens?: number;
18
42
  performance?: PerformanceMetrics;
19
43
  }
20
44
  export type ChatStreamEvent = ChatStreamDelta | ChatStreamFinal;
@@ -57,128 +81,181 @@ export type ChatStreamEvent = ChatStreamDelta | ChatStreamFinal;
57
81
  */
58
82
  export declare function _runChatStream(startCall: (callback: (err: Error | null, chunk: ChatStreamChunk) => void) => Promise<ChatStreamHandle>, signal?: AbortSignal): AsyncGenerator<ChatStreamEvent>;
59
83
  /**
60
- * Qwen3.5 dense model with AsyncGenerator-based session streaming.
84
+ * The three callback-based session-streaming methods every native chat
85
+ * class carries on its prototype (and, structurally, on its instances).
86
+ * Used both as the native `prototype` shape and as the constructed
87
+ * instance type so `InstanceType<NativeStreamingCtor>` resolves to the
88
+ * full native instance surface (`generate`, `saveModel`,
89
+ * `numParameters`, `hasMtpWeights`, …) — see {@link NativeStreamingCtor}.
61
90
  *
62
- * Streaming is driven through the session API — `chatStreamSessionStart`,
63
- * `chatStreamSessionContinue`, and `chatStreamSessionContinueTool` below —
64
- * which adapt the callback-based native methods to
65
- * `AsyncGenerator<ChatStreamEvent>` so the wrapper structurally satisfies
66
- * `SessionCapableModel` and can be passed to `ChatSession<Qwen35Model>`.
91
+ * @internal Native callback streaming surface consumed by
92
+ * {@link makeStreamingModel}.
67
93
  */
68
- export declare class Qwen35Model extends Qwen35ModelNative {
69
- static load(modelPath: string): Promise<Qwen35Model>;
70
- /**
71
- * Streaming variant of {@link Qwen35Model#chatSessionStart}.
72
- *
73
- * Resets the KV caches, runs the jinja chat template, prefills on
74
- * top of the fresh caches, and streams the decoded reply token-by-
75
- * token. Stops on `<|im_end|>` so the cached history ends on a
76
- * clean ChatML boundary that subsequent `chatStreamSessionContinue`
77
- * deltas can append to. Text-only.
78
- *
79
- * The optional `signal` parameter wires an AbortSignal into the
80
- * `_runChatStream` adapter's fast-abort path. Callers that need
81
- * client-disconnect-aware cancellation (e.g. HTTP endpoints) pass
82
- * one here and the native decode winds down at the next safepoint.
83
- */
84
- chatStreamSessionStart(messages: ChatMessage[], config?: ChatConfig | null, signal?: AbortSignal): AsyncGenerator<ChatStreamEvent>;
94
+ export interface NativeStreamingInstance {
95
+ chatStreamSessionStart: (...args: never[]) => Promise<ChatStreamHandle>;
96
+ chatStreamSessionContinue: (...args: never[]) => Promise<ChatStreamHandle>;
97
+ chatStreamSessionContinueTool: (...args: never[]) => Promise<ChatStreamHandle>;
98
+ }
99
+ /**
100
+ * Minimal structural shape of a native chat model constructor that the
101
+ * factory needs: a real `new (...)` signature (so `InstanceType<C>`
102
+ * resolves to the native instance surface and the factory return type
103
+ * can preserve `generate`/`saveModel`/`numParameters`/… on the public
104
+ * subclass), a `static load(path)`, and the three callback-based
105
+ * session-streaming methods on its prototype. The native NAPI classes
106
+ * (`Qwen35ModelNative` etc.) all satisfy this the concrete generic
107
+ * `C` passed at each call site carries the full per-family instance
108
+ * type, which `InstanceType<C>` recovers.
109
+ */
110
+ interface NativeStreamingCtor {
111
+ new (...args: never[]): NativeStreamingInstance;
112
+ load(modelPath: string): Promise<object>;
113
+ prototype: NativeStreamingInstance;
114
+ }
115
+ /** Tuning knobs for {@link makeStreamingModel}. */
116
+ interface StreamingModelOptions {
85
117
  /**
86
- * Streaming variant of {@link Qwen35Model#chatSessionContinue}.
87
- *
88
- * Builds a raw ChatML delta on top of the live session caches,
89
- * tokenizes it, prefills the delta, and streams the decoded reply.
90
- * Requires a live session started via `chatSessionStart` or
91
- * `chatStreamSessionStart`. Stops on `<|im_end|>`.
92
- *
93
- * `images` is the native opt-in guard parameter — callers that
94
- * attach a new image set must restart the session via
95
- * `chatStreamSessionStart` with the full history. The high-level
96
- * `ChatSession` wrapper handles that routing; callers that drive
97
- * the wrapper directly should pass `null` for text-only continues.
118
+ * When `true`, `static load` records the on-disk model path so the
119
+ * generated subclass can serve `applyChatTemplate` from a lazily
120
+ * constructed tokenizer (see {@link applyChatTemplateFromModelPath}).
121
+ * When `false` (QianfanOCR) the path is not recorded and
122
+ * `applyChatTemplate` is omitted.
98
123
  */
99
- chatStreamSessionContinue(userMessage: string, images: Uint8Array[] | null, config?: ChatConfig | null, signal?: AbortSignal): AsyncGenerator<ChatStreamEvent>;
124
+ recordModelPath: boolean;
100
125
  /**
101
- * Streaming variant of {@link Qwen35Model#chatSessionContinueTool}.
102
- *
103
- * Builds a ChatML `<tool_response>` delta on top of the live
104
- * session caches and streams the decoded assistant reply. Requires
105
- * a live session started via `chatSessionStart` /
106
- * `chatStreamSessionStart`.
126
+ * Whether to attach an `applyChatTemplate` method. Defaults to
127
+ * `recordModelPath` because the method can only work when a path was
128
+ * recorded. Qwen3 (first-gen) records its path but keeps its native
129
+ * tokenizer-backed implementation; pass `applyTemplate: false` to suppress
130
+ * only the factory's path-backed replacement.
107
131
  */
108
- chatStreamSessionContinueTool(toolCallId: string, content: string, config?: ChatConfig | null, signal?: AbortSignal): AsyncGenerator<ChatStreamEvent>;
132
+ applyTemplate?: boolean;
109
133
  }
110
134
  /**
111
- * Qwen3.5 MoE model wrapper.
135
+ * Shared base type produced by the factory: a `SessionCapableModel`
136
+ * whose static surface still exposes `load`. Concrete families extend
137
+ * the returned class with an empty body so they inherit everything and
138
+ * pick up the correct `.name` (and working `instanceof`) for free.
139
+ */
140
+ export type StreamingModel = SessionCapableModel;
141
+ /**
142
+ * The effective `applyTemplate` flag resolved from the options literal:
143
+ * an explicit `applyTemplate` wins, otherwise it defaults to `recordModelPath`
144
+ * — mirroring the runtime `opts.applyTemplate ?? recordPath`. Requires the
145
+ * options to be inferred as a literal (the `const` type parameter below), so
146
+ * `{ recordModelPath: true }` yields `true`, not `boolean`.
147
+ */
148
+ type ResolvedApplyTemplate<O extends StreamingModelOptions> = O extends {
149
+ applyTemplate: boolean;
150
+ } ? O['applyTemplate'] : O['recordModelPath'];
151
+ /** @internal Method names whose callback ABI is replaced by the generator wrapper. */
152
+ export type NativeStreamingMethod = keyof NativeStreamingInstance;
153
+ type StreamingReplacementMethod<O extends StreamingModelOptions> = NativeStreamingMethod | (ResolvedApplyTemplate<O> extends true ? 'applyChatTemplate' : never);
154
+ /**
155
+ * Instance surface of a generated streaming wrapper. Only methods replaced at
156
+ * runtime are removed from the native instance: the three callback streaming
157
+ * methods, plus `applyChatTemplate` when the wrapper installs its path-backed
158
+ * implementation. Intersecting the remaining native surface with
159
+ * `SessionCapableModel` preserves required native capabilities such as
160
+ * `hasBlockPagedCache()` while exposing the generator streaming signatures.
161
+ *
162
+ * When `applyTemplate` resolves false, an existing native implementation stays
163
+ * intact (notably Qwen3's required tokenizer-backed method), while models that
164
+ * never had one (QianfanOCR) retain the optional structural contract.
112
165
  *
113
- * Streaming is driven through the `ChatSession` API — overrides below
114
- * adapt the callback-based native methods to
115
- * `AsyncGenerator<ChatStreamEvent>` so the wrapper structurally
116
- * satisfies `SessionCapableModel`.
166
+ * @internal Concrete instance type returned by {@link makeStreamingModel}.
117
167
  */
118
- export declare class Qwen35MoeModel extends Qwen35MoeModelNative {
119
- static load(modelPath: string): Promise<Qwen35MoeModel>;
120
- /** Streaming variant of {@link Qwen35MoeModel#chatSessionStart}. */
121
- chatStreamSessionStart(messages: ChatMessage[], config?: ChatConfig | null, signal?: AbortSignal): AsyncGenerator<ChatStreamEvent>;
122
- /** Streaming variant of {@link Qwen35MoeModel#chatSessionContinue}. */
123
- chatStreamSessionContinue(userMessage: string, images: Uint8Array[] | null, config?: ChatConfig | null, signal?: AbortSignal): AsyncGenerator<ChatStreamEvent>;
124
- /** Streaming variant of {@link Qwen35MoeModel#chatSessionContinueTool}. */
125
- chatStreamSessionContinueTool(toolCallId: string, content: string, config?: ChatConfig | null, signal?: AbortSignal): AsyncGenerator<ChatStreamEvent>;
126
- }
168
+ export type StreamingInstance<C extends NativeStreamingCtor, O extends StreamingModelOptions> = Omit<InstanceType<C>, StreamingReplacementMethod<O>> & SessionCapableModel & (ResolvedApplyTemplate<O> extends true ? Required<Pick<SessionCapableModel, 'applyChatTemplate'>> : object);
127
169
  /**
128
- * LFM2 model wrapper.
170
+ * Build the streaming-model subclass for a native chat model class.
171
+ *
172
+ * The returned class:
173
+ * - captures the three native callback-based session-streaming methods
174
+ * from `NativeClass.prototype`,
175
+ * - overrides them as `async *` generators delegating to
176
+ * {@link _runChatStream} with identical argument plumbing (including
177
+ * `config ?? null`, `images`, `isError ?? null`, and the `signal`),
178
+ * - overrides `static load` to re-prototype the native instance onto
179
+ * the concrete subclass (`this`) and optionally record the path,
180
+ * - installs a path-backed `applyChatTemplate` when `opts.applyTemplate`
181
+ * (defaulting to `opts.recordModelPath`).
129
182
  *
130
- * Streaming is driven through the `ChatSession` API overrides below
131
- * adapt the callback-based native methods to
132
- * `AsyncGenerator<ChatStreamEvent>` so the wrapper structurally
133
- * satisfies `SessionCapableModel`. LFM2 is text-only; the native
134
- * `images` guard rejects non-empty image sets with an
135
- * `IMAGE_CHANGE_REQUIRES_SESSION_RESTART:` prefix.
183
+ * @internal Exported so the VLM wrapper (`@mlx-node/vlm`) builds its
184
+ * `QianfanOCRModel` from the same factory. Not part of the public API.
136
185
  */
137
- export declare class Lfm2Model extends Lfm2ModelNative {
138
- static load(modelPath: string): Promise<Lfm2Model>;
139
- /** Streaming variant of {@link Lfm2Model#chatSessionStart}. */
140
- chatStreamSessionStart(messages: ChatMessage[], config?: ChatConfig | null, signal?: AbortSignal): AsyncGenerator<ChatStreamEvent>;
141
- /** Streaming variant of {@link Lfm2Model#chatSessionContinue}. */
142
- chatStreamSessionContinue(userMessage: string, images: Uint8Array[] | null, config?: ChatConfig | null, signal?: AbortSignal): AsyncGenerator<ChatStreamEvent>;
143
- /** Streaming variant of {@link Lfm2Model#chatSessionContinueTool}. */
144
- chatStreamSessionContinueTool(toolCallId: string, content: string, config?: ChatConfig | null, signal?: AbortSignal): AsyncGenerator<ChatStreamEvent>;
145
- }
186
+ export declare function makeStreamingModel<C extends NativeStreamingCtor, const O extends StreamingModelOptions>(NativeClass: C, opts: O): {
187
+ new (...args: ConstructorParameters<C>): StreamingInstance<C, O>;
188
+ load(...args: Parameters<C['load']>): Promise<StreamingInstance<C, O>>;
189
+ };
190
+ declare const Qwen35Model_base: {
191
+ new (): StreamingInstance<typeof Qwen35ModelNative, {
192
+ readonly recordModelPath: true;
193
+ }>;
194
+ load(path: string): Promise<StreamingInstance<typeof Qwen35ModelNative, {
195
+ readonly recordModelPath: true;
196
+ }>>;
197
+ };
146
198
  /**
147
- * Gemma4 model wrapper.
199
+ * Qwen3.5 dense model with AsyncGenerator-based session streaming.
148
200
  *
149
- * Streaming is driven through the `ChatSession` API overrides below
150
- * adapt the callback-based native methods to
151
- * `AsyncGenerator<ChatStreamEvent>` so the wrapper structurally
152
- * satisfies `SessionCapableModel`. Gemma4 is text-only in the
153
- * current refactor scope; the native `images` guard rejects non-empty
154
- * image sets with an `IMAGE_CHANGE_REQUIRES_SESSION_RESTART:` prefix.
201
+ * The empty `extends` inherits the factory's streaming overrides,
202
+ * `static load`, and `applyChatTemplate`, and supplies the concrete
203
+ * `.name === 'Qwen35Model'` and a working `instanceof`. Records its
204
+ * model path so `applyChatTemplate` can serve a lazily built tokenizer.
155
205
  */
156
- export declare class Gemma4Model extends Gemma4ModelNative {
157
- static load(modelPath: string): Promise<Gemma4Model>;
158
- /** Streaming variant of {@link Gemma4Model#chatSessionStart}. */
159
- chatStreamSessionStart(messages: ChatMessage[], config?: ChatConfig | null, signal?: AbortSignal): AsyncGenerator<ChatStreamEvent>;
160
- /** Streaming variant of {@link Gemma4Model#chatSessionContinue}. */
161
- chatStreamSessionContinue(userMessage: string, images: Uint8Array[] | null, config?: ChatConfig | null, signal?: AbortSignal): AsyncGenerator<ChatStreamEvent>;
162
- /** Streaming variant of {@link Gemma4Model#chatSessionContinueTool}. */
163
- chatStreamSessionContinueTool(toolCallId: string, content: string, config?: ChatConfig | null, signal?: AbortSignal): AsyncGenerator<ChatStreamEvent>;
206
+ export declare class Qwen35Model extends Qwen35Model_base {
207
+ }
208
+ declare const Qwen35MoeModel_base: {
209
+ new (): StreamingInstance<typeof Qwen35MoeModelNative, {
210
+ readonly recordModelPath: true;
211
+ }>;
212
+ load(path: string): Promise<StreamingInstance<typeof Qwen35MoeModelNative, {
213
+ readonly recordModelPath: true;
214
+ }>>;
215
+ };
216
+ /** Qwen3.5 MoE model — see {@link Qwen35Model} for the wrapper shape. */
217
+ export declare class Qwen35MoeModel extends Qwen35MoeModel_base {
218
+ }
219
+ declare const Lfm2Model_base: {
220
+ new (): StreamingInstance<typeof Lfm2ModelNative, {
221
+ readonly recordModelPath: true;
222
+ }>;
223
+ load(modelPath: string): Promise<StreamingInstance<typeof Lfm2ModelNative, {
224
+ readonly recordModelPath: true;
225
+ }>>;
226
+ };
227
+ /** LFM2 model (text-only) — see {@link Qwen35Model} for the wrapper shape. */
228
+ export declare class Lfm2Model extends Lfm2Model_base {
229
+ }
230
+ declare const Gemma4Model_base: {
231
+ new (config: import("@mlx-node/core").Gemma4Config): StreamingInstance<typeof Gemma4ModelNative, {
232
+ readonly recordModelPath: true;
233
+ }>;
234
+ load(modelPath: string, options?: import("@mlx-node/core").Gemma4LoadOptions | null | undefined): Promise<StreamingInstance<typeof Gemma4ModelNative, {
235
+ readonly recordModelPath: true;
236
+ }>>;
237
+ };
238
+ /** Gemma4 model (text-only) — see {@link Qwen35Model} for the wrapper shape. */
239
+ export declare class Gemma4Model extends Gemma4Model_base {
164
240
  }
241
+ declare const Qwen3Model_base: {
242
+ new (): StreamingInstance<typeof Qwen3ModelNative, {
243
+ readonly recordModelPath: true;
244
+ readonly applyTemplate: false;
245
+ }>;
246
+ load(modelPath: string): Promise<StreamingInstance<typeof Qwen3ModelNative, {
247
+ readonly recordModelPath: true;
248
+ readonly applyTemplate: false;
249
+ }>>;
250
+ };
165
251
  /**
166
- * Qwen3 (legacy) model wrapper.
252
+ * Qwen3 (first-gen, text-only) model.
167
253
  *
168
- * Streaming is driven through the `ChatSession` API overrides below
169
- * adapt the callback-based native methods to
170
- * `AsyncGenerator<ChatStreamEvent>` so the wrapper structurally
171
- * satisfies `SessionCapableModel`. Qwen3 legacy is text-only; the
172
- * native `images` guard rejects non-empty image sets with an
173
- * `IMAGE_CHANGE_REQUIRES_SESSION_RESTART:` prefix.
254
+ * Records its model path (so prototype-set + path-recording match the
255
+ * other families) but does not install the factory's path-backed
256
+ * `applyChatTemplate`; it retains the native tokenizer-backed method.
174
257
  */
175
- export declare class Qwen3Model extends Qwen3ModelNative {
176
- static load(modelPath: string): Promise<Qwen3Model>;
177
- /** Streaming variant of {@link Qwen3Model#chatSessionStart}. */
178
- chatStreamSessionStart(messages: ChatMessage[], config?: ChatConfig | null, signal?: AbortSignal): AsyncGenerator<ChatStreamEvent>;
179
- /** Streaming variant of {@link Qwen3Model#chatSessionContinue}. */
180
- chatStreamSessionContinue(userMessage: string, images: Uint8Array[] | null, config?: ChatConfig | null, signal?: AbortSignal): AsyncGenerator<ChatStreamEvent>;
181
- /** Streaming variant of {@link Qwen3Model#chatSessionContinueTool}. */
182
- chatStreamSessionContinueTool(toolCallId: string, content: string, config?: ChatConfig | null, signal?: AbortSignal): AsyncGenerator<ChatStreamEvent>;
258
+ export declare class Qwen3Model extends Qwen3Model_base {
183
259
  }
260
+ export {};
184
261
  //# sourceMappingURL=stream.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,IAAI,iBAAiB,EAChC,SAAS,IAAI,eAAe,EAC5B,UAAU,IAAI,gBAAgB,EAC9B,WAAW,IAAI,iBAAiB,EAChC,cAAc,IAAI,oBAAoB,EACvC,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACf,MAAM,gBAAgB,CAAC;AAIxB,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,KAAK,CAAC;IACZ,WAAW,CAAC,EAAE,OAAO,CAAC;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