jev-web 0.5.0 → 0.6.0
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/README.md +8 -3
- package/package.json +1 -1
- package/src/decision2.mjs +31 -0
- package/src/index.mjs +1 -0
package/README.md
CHANGED
|
@@ -383,6 +383,9 @@ const decider = await createDecision2Decider({
|
|
|
383
383
|
// q8 (onnx/model_quantized.onnx, 0.61 GB)
|
|
384
384
|
onProgress: (p) => console.log(p.phase, p.loaded, p.total),
|
|
385
385
|
});
|
|
386
|
+
// or pick a larger sibling:
|
|
387
|
+
// await createDecision2Decider({ variant: "eos" }); // 0.8B, 16k context
|
|
388
|
+
// await createDecision2Decider({ variant: "sol" }); // 2B, 16k context
|
|
386
389
|
const { answers } = await decider.decide(stateText, questions);
|
|
387
390
|
```
|
|
388
391
|
|
|
@@ -397,9 +400,11 @@ Protocol implemented here (mirrors the reference `decision2` runtime):
|
|
|
397
400
|
- score questions add the per-level `score_bias` from `config.json` before the
|
|
398
401
|
softmax (temperature 1).
|
|
399
402
|
|
|
400
|
-
Larger siblings are available via the
|
|
401
|
-
`
|
|
402
|
-
`
|
|
403
|
+
Larger siblings are available via the `variant` option (`"kai"`, `"eos"`,
|
|
404
|
+
`"sol"`) or the exported model/revision constants: `DECISION2_EOS_MODEL` /
|
|
405
|
+
`DECISION2_EOS_REVISION` (0.8B) and `DECISION2_SOL_MODEL` /
|
|
406
|
+
`DECISION2_SOL_REVISION` (2B). The `DECISION2_VARIANTS` map carries each
|
|
407
|
+
variant's pinned revision and context size.
|
|
403
408
|
|
|
404
409
|
Lower-level helpers are exported for custom runtimes:
|
|
405
410
|
`renderDecision2Content`, `renderDecision2Options`, `buildDecision2Segments`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jev-web",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Run open-jev-, Laya- and Strands-Decider-shaped typed-decision models in the browser: one state plus typed questions in, calibrated probabilities out.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/src/decision2.mjs
CHANGED
|
@@ -35,6 +35,28 @@ export const DECISION2_EOS_REVISION = "6369be38417e";
|
|
|
35
35
|
export const DECISION2_SOL_MODEL = "onnx-community/Decision-2.0-Sol-2B-ONNX";
|
|
36
36
|
export const DECISION2_SOL_REVISION = "5b3478e05ce3";
|
|
37
37
|
|
|
38
|
+
/** Named variants with their pinned revisions and context sizes. */
|
|
39
|
+
export const DECISION2_VARIANTS = {
|
|
40
|
+
kai: {
|
|
41
|
+
model: DECISION2_DEFAULT_MODEL,
|
|
42
|
+
revision: DECISION2_DEFAULT_REVISION,
|
|
43
|
+
maxLength: 8192,
|
|
44
|
+
description: "0.6B, 0.61 GB q8",
|
|
45
|
+
},
|
|
46
|
+
eos: {
|
|
47
|
+
model: DECISION2_EOS_MODEL,
|
|
48
|
+
revision: DECISION2_EOS_REVISION,
|
|
49
|
+
maxLength: 16384,
|
|
50
|
+
description: "0.8B, q8/q4f16",
|
|
51
|
+
},
|
|
52
|
+
sol: {
|
|
53
|
+
model: DECISION2_SOL_MODEL,
|
|
54
|
+
revision: DECISION2_SOL_REVISION,
|
|
55
|
+
maxLength: 16384,
|
|
56
|
+
description: "2B, q8/q4f16",
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
|
|
38
60
|
export const DECISION2_NOUL_DESCRIPTIONS = { false: "No", true: "Yes" };
|
|
39
61
|
const DECISION_SUFFIX = "Select the single option best supported by the context and instructions.";
|
|
40
62
|
|
|
@@ -201,6 +223,7 @@ const hfUrl = (model, revision, ...parts) =>
|
|
|
201
223
|
export async function createDecision2Decider({
|
|
202
224
|
model = DECISION2_DEFAULT_MODEL,
|
|
203
225
|
revision = DECISION2_DEFAULT_REVISION,
|
|
226
|
+
variant = null,
|
|
204
227
|
file = DECISION2_DEFAULT_FILE,
|
|
205
228
|
configUrl = null,
|
|
206
229
|
ort = null,
|
|
@@ -213,6 +236,14 @@ export async function createDecision2Decider({
|
|
|
213
236
|
maxLength = DECISION2_MAX_INPUT_TOKENS,
|
|
214
237
|
scope = globalThis,
|
|
215
238
|
} = {}) {
|
|
239
|
+
// Named variant shortcut: {variant: "eos"} sets model/revision/maxLength.
|
|
240
|
+
if (variant) {
|
|
241
|
+
const v = DECISION2_VARIANTS[variant];
|
|
242
|
+
if (!v) throw new TypeError(`decision2: unknown variant "${variant}" (kai, eos, sol)`);
|
|
243
|
+
model = v.model;
|
|
244
|
+
revision = v.revision;
|
|
245
|
+
maxLength = v.maxLength;
|
|
246
|
+
}
|
|
216
247
|
const ortMod = ort ?? (await import("onnxruntime-web"));
|
|
217
248
|
const tf = transformers ?? (await import("@huggingface/transformers"));
|
|
218
249
|
if (wasmPaths) {
|