blazen 0.1.154 → 0.1.156
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/index.d.ts +37 -2
- package/package.json +7 -7
package/index.d.ts
CHANGED
|
@@ -2625,15 +2625,50 @@ export declare class ModelManager {
|
|
|
2625
2625
|
*/
|
|
2626
2626
|
constructor(config: ModelManagerConfig)
|
|
2627
2627
|
/**
|
|
2628
|
-
* Register a model with the manager.
|
|
2628
|
+
* Register a `CompletionModel`-backed local model with the manager.
|
|
2629
2629
|
*
|
|
2630
2630
|
* The model starts in the unloaded state. An optional
|
|
2631
2631
|
* `vramEstimateBytes` overrides the model's self-reported estimate.
|
|
2632
2632
|
*
|
|
2633
2633
|
* Only local in-process providers (mistral.rs, llama.cpp, candle) can be
|
|
2634
|
-
* registered -- remote HTTP providers will throw.
|
|
2634
|
+
* registered -- remote HTTP providers will throw. To register an
|
|
2635
|
+
* arbitrary JS-managed resource (embedding model, tokenizer, custom
|
|
2636
|
+
* runtime, …), use [`Self::register_local_model`] instead.
|
|
2635
2637
|
*/
|
|
2636
2638
|
register(id: string, model: JsCompletionModel, vramEstimateBytes?: bigint | undefined | null): Promise<void>
|
|
2639
|
+
/**
|
|
2640
|
+
* Register an arbitrary JS-managed local model with the manager.
|
|
2641
|
+
*
|
|
2642
|
+
* Unlike [`Self::register`] -- which expects a [`JsCompletionModel`]
|
|
2643
|
+
* backed by an in-process provider -- this entrypoint takes raw
|
|
2644
|
+
* lifecycle callbacks. The manager will invoke `load()` when the model
|
|
2645
|
+
* is brought into VRAM (potentially after evicting an LRU peer) and
|
|
2646
|
+
* `unload()` when it is evicted or explicitly released.
|
|
2647
|
+
*
|
|
2648
|
+
* Both callbacks must return a `Promise<void>` (or be `async`). A
|
|
2649
|
+
* rejection from `load()` aborts the load operation; a rejection from
|
|
2650
|
+
* `unload()` is propagated as a manager error.
|
|
2651
|
+
*
|
|
2652
|
+
* `isLoaded()` is optional: when omitted, the manager's own
|
|
2653
|
+
* loaded-flag bookkeeping is the source of truth.
|
|
2654
|
+
* `vramEstimateBytes` reports the model's footprint so the manager
|
|
2655
|
+
* can enforce the global budget; defaults to `0` when not provided.
|
|
2656
|
+
*
|
|
2657
|
+
* ```javascript
|
|
2658
|
+
* let loaded = false;
|
|
2659
|
+
* await manager.registerLocalModel(
|
|
2660
|
+
* "my-resource",
|
|
2661
|
+
* async () => { /* materialize *\/ loaded = true; },
|
|
2662
|
+
* async () => { /* release *\/ loaded = false; },
|
|
2663
|
+
* async () => loaded,
|
|
2664
|
+
* 2_000_000_000n,
|
|
2665
|
+
* );
|
|
2666
|
+
* ```
|
|
2667
|
+
*
|
|
2668
|
+
* `isLoaded` is `null`-able (pass `null` or `undefined` to omit) and
|
|
2669
|
+
* `vramEstimateBytes` may also be omitted.
|
|
2670
|
+
*/
|
|
2671
|
+
registerLocalModel(id: string, load: LifecycleTsfn, unload: LifecycleTsfn, isLoaded?: IsLoadedTsfn | undefined | null, vramEstimateBytes?: bigint | undefined | null): Promise<void>
|
|
2637
2672
|
/**
|
|
2638
2673
|
* Load a model, evicting LRU models if the budget would be exceeded.
|
|
2639
2674
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "blazen",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.156",
|
|
4
4
|
"description": "Blazen - Event-driven AI workflow framework for Node.js/TypeScript",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -58,12 +58,12 @@
|
|
|
58
58
|
"verbose": true
|
|
59
59
|
},
|
|
60
60
|
"optionalDependencies": {
|
|
61
|
-
"@blazen-dev/blazen-linux-x64-gnu": "0.1.
|
|
62
|
-
"@blazen-dev/blazen-linux-x64-musl": "0.1.
|
|
63
|
-
"@blazen-dev/blazen-linux-arm64-gnu": "0.1.
|
|
64
|
-
"@blazen-dev/blazen-linux-arm64-musl": "0.1.
|
|
65
|
-
"@blazen-dev/blazen-darwin-arm64": "0.1.
|
|
66
|
-
"@blazen-dev/blazen-win32-x64-msvc": "0.1.
|
|
61
|
+
"@blazen-dev/blazen-linux-x64-gnu": "0.1.156",
|
|
62
|
+
"@blazen-dev/blazen-linux-x64-musl": "0.1.156",
|
|
63
|
+
"@blazen-dev/blazen-linux-arm64-gnu": "0.1.156",
|
|
64
|
+
"@blazen-dev/blazen-linux-arm64-musl": "0.1.156",
|
|
65
|
+
"@blazen-dev/blazen-darwin-arm64": "0.1.156",
|
|
66
|
+
"@blazen-dev/blazen-win32-x64-msvc": "0.1.156"
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
|
69
69
|
"build": "napi build --release --platform --features local-all,langfuse --js index.js && node scripts/post-build.mjs",
|