@mlx-node/lm 0.0.9 → 0.0.12
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/chat-session.d.ts +175 -68
- package/dist/chat-session.d.ts.map +1 -1
- package/dist/chat-session.js +271 -122
- package/dist/family-data.d.ts +407 -0
- package/dist/family-data.d.ts.map +1 -0
- package/dist/family-data.js +381 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -1
- package/dist/models/model-loader.d.ts +91 -135
- package/dist/models/model-loader.d.ts.map +1 -1
- package/dist/models/model-loader.js +74 -179
- package/dist/models/paged-config-override.d.ts +0 -2
- package/dist/models/paged-config-override.d.ts.map +1 -1
- package/dist/models/paged-config-override.js +29 -6
- package/dist/models/qwen3_5-configs.d.ts +1 -3
- package/dist/models/qwen3_5-configs.d.ts.map +1 -1
- package/dist/stream.d.ts +29 -5
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +127 -24
- package/package.json +7 -3
- package/dist/interfaces.d.ts +0 -3
- package/dist/interfaces.d.ts.map +0 -1
- package/dist/interfaces.js +0 -1
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native-free per-family registration rows plus the pure `matchFamily`
|
|
3
|
+
* detection they drive.
|
|
4
|
+
*
|
|
5
|
+
* This module must stay free of runtime imports (`import type` only): it is
|
|
6
|
+
* re-exported through the native-free `@mlx-node/agent/catalog` subpath to the
|
|
7
|
+
* dashboard viewer process, which must never dlopen the Metal addon.
|
|
8
|
+
* `packages/agent/__test__/catalog-native-free.test.ts` gates that contract.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Sampling defaults from Unsloth's Qwen3.6 guide:
|
|
12
|
+
* https://unsloth.ai/docs/models/qwen3.6#recommended-settings
|
|
13
|
+
*
|
|
14
|
+
* All modes pin `top_k = 20` and `min_p = 0.0`; they differ in
|
|
15
|
+
* `temperature`, `top_p`, and `presence_penalty`.
|
|
16
|
+
*
|
|
17
|
+
* Deliberately no `maxConsecutiveTokens` / `maxNgramRepeats` / `ngramSize`: the
|
|
18
|
+
* native anti-repetition cutoff is off by default (vLLM-aligned), and a client
|
|
19
|
+
* can still opt in per request.
|
|
20
|
+
*/
|
|
21
|
+
export const QWEN_SAMPLING_DEFAULTS = {
|
|
22
|
+
/** Thinking mode for precise coding tasks. */
|
|
23
|
+
thinkingCoding: {
|
|
24
|
+
temperature: 0.6,
|
|
25
|
+
topP: 0.95,
|
|
26
|
+
topK: 20,
|
|
27
|
+
minP: 0.0,
|
|
28
|
+
presencePenalty: 0.0,
|
|
29
|
+
repetitionPenalty: 1.0,
|
|
30
|
+
},
|
|
31
|
+
/** Thinking mode for general tasks. */
|
|
32
|
+
thinkingGeneral: {
|
|
33
|
+
temperature: 1.0,
|
|
34
|
+
topP: 0.95,
|
|
35
|
+
topK: 20,
|
|
36
|
+
minP: 0.0,
|
|
37
|
+
presencePenalty: 1.5,
|
|
38
|
+
repetitionPenalty: 1.0,
|
|
39
|
+
},
|
|
40
|
+
/** Instruct (non-thinking) for general tasks. */
|
|
41
|
+
instructGeneral: {
|
|
42
|
+
temperature: 0.7,
|
|
43
|
+
topP: 0.8,
|
|
44
|
+
topK: 20,
|
|
45
|
+
minP: 0.0,
|
|
46
|
+
presencePenalty: 1.5,
|
|
47
|
+
repetitionPenalty: 1.0,
|
|
48
|
+
},
|
|
49
|
+
/** Instruct (non-thinking) for reasoning tasks. */
|
|
50
|
+
instructReasoning: {
|
|
51
|
+
temperature: 1.0,
|
|
52
|
+
topP: 0.95,
|
|
53
|
+
topK: 20,
|
|
54
|
+
minP: 0.0,
|
|
55
|
+
presencePenalty: 1.5,
|
|
56
|
+
repetitionPenalty: 1.0,
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
/** Sampling defaults for Gemma4 Instruct. */
|
|
60
|
+
export const GEMMA4_SAMPLING_DEFAULTS = {
|
|
61
|
+
temperature: 0.7,
|
|
62
|
+
topP: 0.95,
|
|
63
|
+
topK: 64,
|
|
64
|
+
minP: 0.0,
|
|
65
|
+
presencePenalty: 0.0,
|
|
66
|
+
repetitionPenalty: 1.0,
|
|
67
|
+
};
|
|
68
|
+
/** Sampling defaults from Meta's Muse-Glimmer release recipe. */
|
|
69
|
+
export const MUSE_GLIMMER_SAMPLING_DEFAULTS = {
|
|
70
|
+
temperature: 0.6,
|
|
71
|
+
topP: 0.95,
|
|
72
|
+
topK: 20,
|
|
73
|
+
minP: 0.0,
|
|
74
|
+
presencePenalty: 0.0,
|
|
75
|
+
repetitionPenalty: 1.0,
|
|
76
|
+
};
|
|
77
|
+
/** Sampling defaults from NVIDIA's Nemotron 3.5 Lightning release recipe. */
|
|
78
|
+
export const NEMOTRON_SAMPLING_DEFAULTS = {
|
|
79
|
+
temperature: 1.0,
|
|
80
|
+
topP: 0.95,
|
|
81
|
+
topK: 20,
|
|
82
|
+
minP: 0.0,
|
|
83
|
+
presencePenalty: 0.0,
|
|
84
|
+
repetitionPenalty: 1.0,
|
|
85
|
+
};
|
|
86
|
+
/** Sampling defaults for LFM2.5 Thinking. */
|
|
87
|
+
export const LFM2_SAMPLING_DEFAULTS = {
|
|
88
|
+
temperature: 0.05,
|
|
89
|
+
topP: 1.0,
|
|
90
|
+
topK: 50,
|
|
91
|
+
minP: 0.0,
|
|
92
|
+
presencePenalty: 0.0,
|
|
93
|
+
repetitionPenalty: 1.05,
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Ordered source of truth for every supported model family's registration
|
|
97
|
+
* data. Each entry owns its canonical `ModelType`, raw config aliases /
|
|
98
|
+
* architecture probes, and `ChatSession` eligibility via `kind`:
|
|
99
|
+
*
|
|
100
|
+
* - `'trainable'` — GRPO/SFT-capable LM (Qwen3 family); chat-capable.
|
|
101
|
+
* - `'loadable'` — chat-capable LM with no trainer engine (Gemma4, LFM2).
|
|
102
|
+
* - `'embedding'` — no chat surface (Harrier); rejected by `loadSession`.
|
|
103
|
+
* - `'vlm'` — VLM whose AsyncGenerator wrapper lives in
|
|
104
|
+
* `@mlx-node/vlm` (importing it here would create a
|
|
105
|
+
* circular package dependency), so `loadSession`
|
|
106
|
+
* rejects it and routes callers to `@mlx-node/vlm`.
|
|
107
|
+
*
|
|
108
|
+
* ORDER IS LOAD-BEARING: a base family is selected from an explicit alias or
|
|
109
|
+
* the single declarative nullish-model_type default, then architecture probes
|
|
110
|
+
* refine it in declaration order. Gemma's unified architecture is
|
|
111
|
+
* authoritative (matching the native loader); Harrier refines a Qwen3 base.
|
|
112
|
+
* Adding a family means adding one data row here plus one loader binding in
|
|
113
|
+
* `models/model-loader.ts`; the row type and the family-completeness test
|
|
114
|
+
* enumerate everything else.
|
|
115
|
+
*/
|
|
116
|
+
export const MODEL_FAMILY_DATA = [
|
|
117
|
+
{
|
|
118
|
+
id: 'gemma4',
|
|
119
|
+
kind: 'loadable',
|
|
120
|
+
match: {
|
|
121
|
+
rawModelTypes: ['gemma4', 'gemma4_text', 'gemma4_unified'],
|
|
122
|
+
architectureProbe: ({ architectures }) => architectures.has('Gemma4UnifiedForConditionalGeneration'),
|
|
123
|
+
},
|
|
124
|
+
acceptsDraftModel: true,
|
|
125
|
+
traits: {
|
|
126
|
+
reasoning: true,
|
|
127
|
+
thinkingLevelMap: {
|
|
128
|
+
minimal: 'minimal',
|
|
129
|
+
low: null,
|
|
130
|
+
medium: null,
|
|
131
|
+
high: 'high',
|
|
132
|
+
},
|
|
133
|
+
fallbackContextWindow: 131072,
|
|
134
|
+
},
|
|
135
|
+
launchPreset: {
|
|
136
|
+
sampling: GEMMA4_SAMPLING_DEFAULTS,
|
|
137
|
+
maxOutputTokens: 16384,
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
id: 'muse_glimmer',
|
|
142
|
+
kind: 'loadable',
|
|
143
|
+
match: {
|
|
144
|
+
rawModelTypes: ['muse_glimmer', 'muse_glimmer_text'],
|
|
145
|
+
architectureProbe: ({ architectures }) => architectures.has('MuseGlimmerForConditionalGeneration'),
|
|
146
|
+
},
|
|
147
|
+
traits: {
|
|
148
|
+
reasoning: true,
|
|
149
|
+
fallbackContextWindow: 131072,
|
|
150
|
+
},
|
|
151
|
+
launchPreset: {
|
|
152
|
+
sampling: MUSE_GLIMMER_SAMPLING_DEFAULTS,
|
|
153
|
+
maxOutputTokens: 16384,
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
id: 'harrier',
|
|
158
|
+
kind: 'embedding',
|
|
159
|
+
match: {
|
|
160
|
+
rawModelTypes: ['harrier'],
|
|
161
|
+
architectureProbe: ({ modelType, architectures }) => modelType === 'qwen3' && architectures.has('Qwen3Model') && !architectures.has('Qwen3ForCausalLM'),
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
id: 'qwen3',
|
|
166
|
+
kind: 'trainable',
|
|
167
|
+
match: { rawModelTypes: ['qwen3'] },
|
|
168
|
+
defaultForNullishModelType: true,
|
|
169
|
+
traits: { reasoning: true, fallbackContextWindow: 40960 },
|
|
170
|
+
launchPreset: {
|
|
171
|
+
sampling: QWEN_SAMPLING_DEFAULTS.thinkingCoding,
|
|
172
|
+
maxOutputTokens: 38912,
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
id: 'qwen3_5',
|
|
177
|
+
kind: 'trainable',
|
|
178
|
+
match: { rawModelTypes: ['qwen3_5'] },
|
|
179
|
+
acceptsDraftModel: true,
|
|
180
|
+
ggufArchitectures: ['qwen35'],
|
|
181
|
+
traits: { reasoning: true, fallbackContextWindow: 262144 },
|
|
182
|
+
launchPreset: {
|
|
183
|
+
sampling: QWEN_SAMPLING_DEFAULTS.thinkingCoding,
|
|
184
|
+
maxOutputTokens: 81920,
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
id: 'qwen3_5_moe',
|
|
189
|
+
kind: 'trainable',
|
|
190
|
+
match: { rawModelTypes: ['qwen3_5_moe'] },
|
|
191
|
+
traits: { reasoning: true, fallbackContextWindow: 262144 },
|
|
192
|
+
launchPreset: {
|
|
193
|
+
sampling: QWEN_SAMPLING_DEFAULTS.thinkingCoding,
|
|
194
|
+
maxOutputTokens: 81920,
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
id: 'lfm2',
|
|
199
|
+
kind: 'loadable',
|
|
200
|
+
match: { rawModelTypes: ['lfm2'] },
|
|
201
|
+
traits: { reasoning: true, fallbackContextWindow: 128000 },
|
|
202
|
+
launchPreset: {
|
|
203
|
+
sampling: LFM2_SAMPLING_DEFAULTS,
|
|
204
|
+
maxOutputTokens: 8192,
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
id: 'lfm2_moe',
|
|
209
|
+
kind: 'loadable',
|
|
210
|
+
match: { rawModelTypes: ['lfm2_moe'] },
|
|
211
|
+
traits: { reasoning: true, fallbackContextWindow: 128000 },
|
|
212
|
+
/**
|
|
213
|
+
* LFM2.5-8B-A1B: LiquidAI's MoE card recommends temperature 0.2 / top_k 80
|
|
214
|
+
* — deliberately NOT the dense `lfm2` values (0.05 / 50).
|
|
215
|
+
*/
|
|
216
|
+
launchPreset: {
|
|
217
|
+
sampling: {
|
|
218
|
+
temperature: 0.2,
|
|
219
|
+
topP: 1.0,
|
|
220
|
+
topK: 80,
|
|
221
|
+
minP: 0.0,
|
|
222
|
+
presencePenalty: 0.0,
|
|
223
|
+
repetitionPenalty: 1.05,
|
|
224
|
+
},
|
|
225
|
+
maxOutputTokens: 8192,
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
id: 'nemotron_h',
|
|
230
|
+
kind: 'loadable',
|
|
231
|
+
match: {
|
|
232
|
+
rawModelTypes: ['nemotron_h'],
|
|
233
|
+
architectureProbe: ({ architectures }) => architectures.has('NemotronHForCausalLM'),
|
|
234
|
+
},
|
|
235
|
+
traits: {
|
|
236
|
+
reasoning: true,
|
|
237
|
+
fallbackContextWindow: 1048576,
|
|
238
|
+
},
|
|
239
|
+
launchPreset: {
|
|
240
|
+
sampling: NEMOTRON_SAMPLING_DEFAULTS,
|
|
241
|
+
maxOutputTokens: 32768,
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
id: 'internvl_chat',
|
|
246
|
+
kind: 'vlm',
|
|
247
|
+
match: { rawModelTypes: ['internvl_chat'] },
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
id: 'qianfan-ocr',
|
|
251
|
+
kind: 'vlm',
|
|
252
|
+
match: { rawModelTypes: ['qianfan-ocr'] },
|
|
253
|
+
},
|
|
254
|
+
];
|
|
255
|
+
/**
|
|
256
|
+
* Every chat-capable family (kind trainable | loadable), in registry order —
|
|
257
|
+
* the default set the paged-config override manager forces onto the block-paged
|
|
258
|
+
* path. Derived, so a new chat family can never be forgotten.
|
|
259
|
+
*/
|
|
260
|
+
export const CHAT_FAMILY_IDS = MODEL_FAMILY_DATA.filter((row) => row.kind === 'trainable' || row.kind === 'loadable').map((row) => row.id);
|
|
261
|
+
/** Detection results that cannot back a chat endpoint (kind embedding | vlm). */
|
|
262
|
+
export const NON_GENERATIVE_FAMILY_IDS = new Set(MODEL_FAMILY_DATA.filter((row) => row.kind === 'embedding' || row.kind === 'vlm').map((row) => row.id));
|
|
263
|
+
function buildFamilyDataIndex(rows) {
|
|
264
|
+
const byId = new Map();
|
|
265
|
+
const byRawModelType = new Map();
|
|
266
|
+
let defaultForNullishModelType;
|
|
267
|
+
for (const family of rows) {
|
|
268
|
+
const previousFamily = byId.get(family.id);
|
|
269
|
+
if (previousFamily !== undefined) {
|
|
270
|
+
throw new Error(`Duplicate canonical model type "${family.id}" in model family registry`);
|
|
271
|
+
}
|
|
272
|
+
byId.set(family.id, family);
|
|
273
|
+
for (const rawModelType of family.match.rawModelTypes) {
|
|
274
|
+
const previous = byRawModelType.get(rawModelType);
|
|
275
|
+
if (previous !== undefined) {
|
|
276
|
+
throw new Error(`Duplicate model_type alias "${rawModelType}" for "${previous.id}" and "${family.id}"`);
|
|
277
|
+
}
|
|
278
|
+
byRawModelType.set(rawModelType, family);
|
|
279
|
+
}
|
|
280
|
+
if (family.defaultForNullishModelType === true) {
|
|
281
|
+
if (defaultForNullishModelType !== undefined) {
|
|
282
|
+
throw new Error(`Duplicate nullish-model_type defaults for "${defaultForNullishModelType.id}" and "${family.id}"`);
|
|
283
|
+
}
|
|
284
|
+
defaultForNullishModelType = family;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
if (defaultForNullishModelType === undefined) {
|
|
288
|
+
throw new Error('Model family registry must declare exactly one nullish-model_type default');
|
|
289
|
+
}
|
|
290
|
+
return { byId, byRawModelType, defaultForNullishModelType };
|
|
291
|
+
}
|
|
292
|
+
const FAMILY_DATA_INDEX = buildFamilyDataIndex(MODEL_FAMILY_DATA);
|
|
293
|
+
/** Registration data for a canonical family id, or `undefined` for a foreign string. */
|
|
294
|
+
export function familyDataFor(modelType) {
|
|
295
|
+
return FAMILY_DATA_INDEX.byId.get(modelType);
|
|
296
|
+
}
|
|
297
|
+
function chatFamilyDataFor(modelType) {
|
|
298
|
+
const row = FAMILY_DATA_INDEX.byId.get(modelType);
|
|
299
|
+
return row !== undefined && (row.kind === 'trainable' || row.kind === 'loadable') ? row : undefined;
|
|
300
|
+
}
|
|
301
|
+
/** Canonical family id owning a raw `config.json` model_type alias. */
|
|
302
|
+
export function rawModelTypeToCanonical(rawModelType) {
|
|
303
|
+
return FAMILY_DATA_INDEX.byRawModelType.get(rawModelType)?.id;
|
|
304
|
+
}
|
|
305
|
+
/** Agent discovery traits for a chat-capable family. */
|
|
306
|
+
export function familyTraitsFor(modelType) {
|
|
307
|
+
return chatFamilyDataFor(modelType)?.traits;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Launch preset for every surface that serves a chat family:
|
|
311
|
+
* `@mlx-node/server` discovery, `mlx launch claude` and `mlx agent`.
|
|
312
|
+
* `undefined` only for a non-generative family or an unknown type.
|
|
313
|
+
*/
|
|
314
|
+
export function launchPresetFor(modelType) {
|
|
315
|
+
return chatFamilyDataFor(modelType)?.launchPreset;
|
|
316
|
+
}
|
|
317
|
+
export class MalformedModelConfigError extends Error {
|
|
318
|
+
constructor(modelPath, reason) {
|
|
319
|
+
super(`Malformed config.json in ${modelPath}: ${reason}`);
|
|
320
|
+
this.name = 'MalformedModelConfigError';
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
export class UnsupportedModelTypeError extends Error {
|
|
324
|
+
constructor(modelPath, rawModelTypeLabel) {
|
|
325
|
+
super(`Unsupported model_type "${rawModelTypeLabel}" in ${modelPath}/config.json`);
|
|
326
|
+
this.name = 'UnsupportedModelTypeError';
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Fail-closed validation: a config.json whose root is not a plain object,
|
|
331
|
+
* or whose `architectures` is neither an array nor a string, is rejected
|
|
332
|
+
* instead of coerced (coercion would fall through to the qwen3
|
|
333
|
+
* nullish-model_type default and silently misroute the checkpoint).
|
|
334
|
+
*/
|
|
335
|
+
function normalizeConfig(modelPath, config) {
|
|
336
|
+
if (typeof config !== 'object' || config === null || Array.isArray(config)) {
|
|
337
|
+
throw new MalformedModelConfigError(modelPath, 'root must be a JSON object');
|
|
338
|
+
}
|
|
339
|
+
const object = config;
|
|
340
|
+
const hasModelType = Object.hasOwn(object, 'model_type');
|
|
341
|
+
const rawModelTypeValue = hasModelType ? object.model_type : undefined;
|
|
342
|
+
const usesDefaultModelType = !hasModelType || rawModelTypeValue === null;
|
|
343
|
+
const rawModelType = typeof rawModelTypeValue === 'string' ? rawModelTypeValue : undefined;
|
|
344
|
+
const rawModelTypeLabel = hasModelType ? String(rawModelTypeValue) : '<missing>';
|
|
345
|
+
const rawArchitectures = 'architectures' in object ? object.architectures : undefined;
|
|
346
|
+
if (rawArchitectures !== undefined &&
|
|
347
|
+
rawArchitectures !== null &&
|
|
348
|
+
!Array.isArray(rawArchitectures) &&
|
|
349
|
+
typeof rawArchitectures !== 'string') {
|
|
350
|
+
throw new MalformedModelConfigError(modelPath, '"architectures" must be an array or a string');
|
|
351
|
+
}
|
|
352
|
+
const architectures = Array.isArray(rawArchitectures)
|
|
353
|
+
? rawArchitectures.filter((architecture) => typeof architecture === 'string')
|
|
354
|
+
: typeof rawArchitectures === 'string'
|
|
355
|
+
? [rawArchitectures]
|
|
356
|
+
: [];
|
|
357
|
+
return { usesDefaultModelType, rawModelType, rawModelTypeLabel, architectures: new Set(architectures) };
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Pure family detection over a parsed `config.json`: alias (or the qwen3
|
|
361
|
+
* nullish default) picks a base family, then architecture probes refine it in
|
|
362
|
+
* registry declaration order. Throws {@link MalformedModelConfigError} /
|
|
363
|
+
* {@link UnsupportedModelTypeError} with `modelPath` naming the checkpoint.
|
|
364
|
+
* The filesystem/GGUF half lives in `detectModelType`
|
|
365
|
+
* (`models/model-loader.ts`); native-free consumers (dashboard labels via
|
|
366
|
+
* `@mlx-node/agent/catalog`) call this directly.
|
|
367
|
+
*/
|
|
368
|
+
export function matchFamily(modelPath, parsedConfig) {
|
|
369
|
+
const config = normalizeConfig(modelPath, parsedConfig);
|
|
370
|
+
const rows = MODEL_FAMILY_DATA;
|
|
371
|
+
const baseFamily = config.usesDefaultModelType
|
|
372
|
+
? FAMILY_DATA_INDEX.defaultForNullishModelType
|
|
373
|
+
: config.rawModelType === undefined
|
|
374
|
+
? undefined
|
|
375
|
+
: FAMILY_DATA_INDEX.byRawModelType.get(config.rawModelType);
|
|
376
|
+
const matchContext = { ...config, modelType: baseFamily?.id };
|
|
377
|
+
const family = rows.find((candidate) => candidate.match.architectureProbe?.(matchContext) === true) ?? baseFamily;
|
|
378
|
+
if (family === undefined)
|
|
379
|
+
throw new UnsupportedModelTypeError(modelPath, config.rawModelTypeLabel);
|
|
380
|
+
return family.id;
|
|
381
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
export { Qwen3Model } from './stream.js';
|
|
16
16
|
export { Gemma4Model } from './stream.js';
|
|
17
|
+
export { MuseGlimmerModel } from './stream.js';
|
|
17
18
|
export { HarrierModel } from '@mlx-node/core';
|
|
18
19
|
export { Qwen35Model } from './stream.js';
|
|
19
20
|
export type { Qwen35Config, Qwen35ContextLimits } from '@mlx-node/core';
|
|
@@ -21,6 +22,8 @@ export { Lfm2Model } from './stream.js';
|
|
|
21
22
|
export { LFM2_CONFIGS, getLfm2Config } from './models/lfm2-configs.js';
|
|
22
23
|
export { Qwen35MoeModel } from './stream.js';
|
|
23
24
|
export type { Qwen35MoeConfig } from '@mlx-node/core';
|
|
25
|
+
export { NemotronHModel } from './stream.js';
|
|
26
|
+
export type { NemotronHConfig, NemotronHContextLimits } from '@mlx-node/core';
|
|
24
27
|
export { memoryStats } from '@mlx-node/core';
|
|
25
28
|
export type { ChatConfig, ChatResult, ChatMessage, ToolCallResult, PerformanceMetrics } from '@mlx-node/core';
|
|
26
29
|
export type { ChatStreamDelta, ChatStreamFinal, ChatStreamEvent } from './stream.js';
|
|
@@ -29,8 +32,9 @@ export type { NativeStreamingInstance, NativeStreamingMethod, StreamingInstance,
|
|
|
29
32
|
export { ChatSession, ContextCapacityError, isContextCapacityError } from './chat-session.js';
|
|
30
33
|
export type { ChatSessionOptions, SendOptions, SessionCapableModel, SessionContextLimits } from './chat-session.js';
|
|
31
34
|
export { type Qwen3Config, QWEN3_CONFIGS, type GenerationResult, type GenerationConfig, getQwen3Config, } from './models/qwen3-configs.js';
|
|
32
|
-
export { loadModel, loadSession, detectModelType, type LoadableModel, type TrainableModel, type
|
|
33
|
-
export {
|
|
35
|
+
export { loadModel, loadSession, detectModelType, type LoadableModel, type TrainableModel, type LoadModelOptions, } from './models/model-loader.js';
|
|
36
|
+
export { CHAT_FAMILY_IDS, familyDataFor, familyTraitsFor, GEMMA4_SAMPLING_DEFAULTS, launchPresetFor, LFM2_SAMPLING_DEFAULTS, matchFamily, MODEL_FAMILY_DATA, MUSE_GLIMMER_SAMPLING_DEFAULTS, NEMOTRON_SAMPLING_DEFAULTS, NON_GENERATIVE_FAMILY_IDS, QWEN_SAMPLING_DEFAULTS, rawModelTypeToCanonical, type ChatFamilyId, type FamilyThinkingLevelMap, type FamilyTraits, type LaunchPreset, type ModelFamilyData, type ModelFamilyKind, type ModelType, type TrainableFamilyId, } from './family-data.js';
|
|
37
|
+
export { PagedConfigOverrideManager, QWEN35_PAGED_MODEL_TYPES, type PagedConfigOverrideManagerOptions, } from './models/paged-config-override.js';
|
|
34
38
|
export { QWEN35_CONFIGS, getQwen35Config } from './models/qwen3_5-configs.js';
|
|
35
39
|
export * from './tools/index.js';
|
|
36
40
|
export { enableProfiling, disableProfiling } from './profiling.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,YAAY,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAGxE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAGvE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,YAAY,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAGxE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAGvE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAStD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,YAAY,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAsB9E,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAG9G,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AASrF,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjE,YAAY,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAMrH,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC9F,YAAY,EAAE,kBAAkB,EAAE,WAAW,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAGpH,OAAO,EACL,KAAK,WAAW,EAChB,aAAa,EACb,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,cAAc,GACf,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EACL,SAAS,EACT,WAAW,EACX,eAAe,EACf,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,gBAAgB,GACtB,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EACL,eAAe,EACf,aAAa,EACb,eAAe,EACf,wBAAwB,EACxB,eAAe,EACf,sBAAsB,EACtB,WAAW,EACX,iBAAiB,EACjB,8BAA8B,EAC9B,0BAA0B,EAC1B,yBAAyB,EACzB,sBAAsB,EACtB,uBAAuB,EACvB,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,iBAAiB,GACvB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,KAAK,iCAAiC,GACvC,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9E,cAAc,kBAAkB,CAAC;AAGjC,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
export { Qwen3Model } from './stream.js';
|
|
17
17
|
// Gemma4 models
|
|
18
18
|
export { Gemma4Model } from './stream.js';
|
|
19
|
+
// Muse-Glimmer models
|
|
20
|
+
export { MuseGlimmerModel } from './stream.js';
|
|
19
21
|
// Embedding models
|
|
20
22
|
export { HarrierModel } from '@mlx-node/core';
|
|
21
23
|
export { Qwen35Model } from './stream.js';
|
|
@@ -24,6 +26,14 @@ export { Lfm2Model } from './stream.js';
|
|
|
24
26
|
export { LFM2_CONFIGS, getLfm2Config } from './models/lfm2-configs.js';
|
|
25
27
|
// MoE variant
|
|
26
28
|
export { Qwen35MoeModel } from './stream.js';
|
|
29
|
+
// Nemotron H models
|
|
30
|
+
//
|
|
31
|
+
// The config/limits types ship alongside the class for the same reason
|
|
32
|
+
// Qwen3.5's do: `NemotronHModel` exposes both `getConfig()` and
|
|
33
|
+
// `contextLimits()`, and without these exports a consumer cannot name
|
|
34
|
+
// either return type. (`MuseGlimmerModel` above deliberately exports no
|
|
35
|
+
// config type — that wrapper has no `getConfig()` at all.)
|
|
36
|
+
export { NemotronHModel } from './stream.js';
|
|
27
37
|
// Memory hygiene: most management is automatic — the decode loop
|
|
28
38
|
// inside `@mlx-node/core` calls `mlx_clear_cache()` every 256 generated
|
|
29
39
|
// tokens to prevent unbounded free-pool growth during long
|
|
@@ -64,7 +74,11 @@ export { ChatSession, ContextCapacityError, isContextCapacityError } from './cha
|
|
|
64
74
|
export { QWEN3_CONFIGS, getQwen3Config, } from './models/qwen3-configs.js';
|
|
65
75
|
// Model loading
|
|
66
76
|
export { loadModel, loadSession, detectModelType, } from './models/model-loader.js';
|
|
67
|
-
|
|
77
|
+
// Native-free per-family registration data (also published as the
|
|
78
|
+
// `@mlx-node/lm/family-data` subpath for consumers that must not dlopen the
|
|
79
|
+
// addon; see family-data.ts).
|
|
80
|
+
export { CHAT_FAMILY_IDS, familyDataFor, familyTraitsFor, GEMMA4_SAMPLING_DEFAULTS, launchPresetFor, LFM2_SAMPLING_DEFAULTS, matchFamily, MODEL_FAMILY_DATA, MUSE_GLIMMER_SAMPLING_DEFAULTS, NEMOTRON_SAMPLING_DEFAULTS, NON_GENERATIVE_FAMILY_IDS, QWEN_SAMPLING_DEFAULTS, rawModelTypeToCanonical, } from './family-data.js';
|
|
81
|
+
export { PagedConfigOverrideManager, QWEN35_PAGED_MODEL_TYPES, } from './models/paged-config-override.js';
|
|
68
82
|
export { QWEN35_CONFIGS, getQwen35Config } from './models/qwen3_5-configs.js';
|
|
69
83
|
// Tool calling utilities
|
|
70
84
|
export * from './tools/index.js';
|