kjarni-wasm 0.2.5 → 0.2.7
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 +1 -1
- package/dist/index.d.ts +18 -3
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/dist/protocol.d.ts +9 -0
- package/package.json +2 -2
- package/pkg/kjarni_wasm.d.ts +3 -8
- package/pkg/kjarni_wasm.js +8 -13
- package/pkg/kjarni_wasm_bg.wasm +0 -0
- package/pkg/kjarni_wasm_bg.wasm.d.ts +2 -2
- package/pkg/package.json +2 -2
package/README.md
CHANGED
|
@@ -224,6 +224,6 @@ you need the server half of the same product:
|
|
|
224
224
|
|
|
225
225
|
## Making your own `.kjq`
|
|
226
226
|
|
|
227
|
-
See [the format guide](
|
|
227
|
+
See [the format guide](https://github.com/olafurjohannsson/kjarni/blob/main/crates/kjarni-wasm/scripts/README.md). Any BERT-family encoder,
|
|
228
228
|
cross-encoder, classifier or small decoder from Hugging Face converts with one
|
|
229
229
|
script.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Capability, ClassifyResult, ModelSource, RankedDocument } from "./protocol.js";
|
|
2
|
-
export type { ClassifyResult, ModelSource, RankedDocument };
|
|
2
|
+
export type { Capability, ClassifyResult, ModelSource, RankedDocument };
|
|
3
|
+
/** Which models {@link Kjarni.load} loads. Name only the ones you need. */
|
|
3
4
|
export interface LoadOptions {
|
|
4
5
|
/** Embeddings and semantic similarity. A `.kjq` file. */
|
|
5
6
|
encoder?: ModelSource;
|
|
@@ -14,11 +15,23 @@ export interface LoadOptions {
|
|
|
14
15
|
/** Called as each model is fetched, for progress UI. */
|
|
15
16
|
onProgress?: (capability: Capability, loaded: number, total: number) => void;
|
|
16
17
|
}
|
|
18
|
+
/** How {@link Kjarni.chat} generates a reply. */
|
|
17
19
|
export interface ChatOptions {
|
|
20
|
+
/** The most tokens to generate. Defaults to 256. */
|
|
18
21
|
maxNewTokens?: number;
|
|
19
|
-
/** 0
|
|
22
|
+
/** Sampling temperature. Defaults to 0, greedy decoding, which is deterministic. */
|
|
20
23
|
temperature?: number;
|
|
21
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Models running in a Web Worker. Create one with {@link Kjarni.load}; every
|
|
27
|
+
* method returns a promise, so the page stays responsive while a model works.
|
|
28
|
+
*
|
|
29
|
+
* ```ts
|
|
30
|
+
* const kjarni = await Kjarni.load({ encoder: "/models/minilm.kjq" });
|
|
31
|
+
* const [a, b] = await kjarni.encode(["doctor", "physician"]);
|
|
32
|
+
* console.log(Kjarni.cosine(a, b)); // 0.8598
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
22
35
|
export declare class Kjarni {
|
|
23
36
|
#private;
|
|
24
37
|
private constructor();
|
|
@@ -39,7 +52,9 @@ export declare class Kjarni {
|
|
|
39
52
|
/**
|
|
40
53
|
* Generates a reply, yielding text as it arrives.
|
|
41
54
|
*
|
|
42
|
-
*
|
|
55
|
+
* ```ts
|
|
56
|
+
* for await (const piece of kjarni.chat("Explain RAG")) out.textContent += piece;
|
|
57
|
+
* ```
|
|
43
58
|
*/
|
|
44
59
|
chat(prompt: string, options?: ChatOptions): AsyncGenerator<string, void, unknown>;
|
|
45
60
|
/** Releases the models and stops the worker. */
|
package/dist/index.js
CHANGED
|
@@ -41,6 +41,16 @@ async function toBytes(src, capability, onProgress) {
|
|
|
41
41
|
}
|
|
42
42
|
return bytes;
|
|
43
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Models running in a Web Worker. Create one with {@link Kjarni.load}; every
|
|
46
|
+
* method returns a promise, so the page stays responsive while a model works.
|
|
47
|
+
*
|
|
48
|
+
* ```ts
|
|
49
|
+
* const kjarni = await Kjarni.load({ encoder: "/models/minilm.kjq" });
|
|
50
|
+
* const [a, b] = await kjarni.encode(["doctor", "physician"]);
|
|
51
|
+
* console.log(Kjarni.cosine(a, b)); // 0.8598
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
44
54
|
export class Kjarni {
|
|
45
55
|
#worker;
|
|
46
56
|
#next = 1;
|
|
@@ -116,7 +126,9 @@ export class Kjarni {
|
|
|
116
126
|
/**
|
|
117
127
|
* Generates a reply, yielding text as it arrives.
|
|
118
128
|
*
|
|
119
|
-
*
|
|
129
|
+
* ```ts
|
|
130
|
+
* for await (const piece of kjarni.chat("Explain RAG")) out.textContent += piece;
|
|
131
|
+
* ```
|
|
120
132
|
*/
|
|
121
133
|
async *chat(prompt, options = {}) {
|
|
122
134
|
const queue = [];
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,EAAE;AACF,yEAAyE;AACzE,iEAAiE;AACjE,kDAAkD;AAClD,EAAE;AACF,+EAA+E;AAC/E,2DAA2D;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,EAAE;AACF,yEAAyE;AACzE,iEAAiE;AACjE,kDAAkD;AAClD,EAAE;AACF,+EAA+E;AAC/E,2DAA2D;AAqC3D,KAAK,UAAU,OAAO,CACpB,GAAgB,EAChB,UAAsB,EACtB,UAAsC;IAEtC,IAAI,GAAG,YAAY,UAAU;QAAE,OAAO,GAAG,CAAC;IAC1C,IAAI,GAAG,YAAY,WAAW;QAAE,OAAO,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;IAE3D,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1C,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,YAAY,GAAG,iBAAiB,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,8EAA8E;IAC9E,2EAA2E;IAC3E,kDAAkD;IAClD,M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,CAAC,CAAC,CAAC;YACnB,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAClB,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;QACD,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC;IACvD,CAAC;CACF;AAED,eAAe,MAAM,CAAC"}
|
package/dist/protocol.d.ts
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
/** A model to load, either already in memory or somewhere to fetch it from. */
|
|
2
2
|
export type ModelSource = string | URL | ArrayBuffer | Uint8Array;
|
|
3
|
+
/** A kind of model a {@link Kjarni} instance can hold, one of each. */
|
|
3
4
|
export type Capability = "encoder" | "classifier" | "reranker" | "chat";
|
|
5
|
+
/** The top prediction for one text. */
|
|
4
6
|
export interface ClassifyResult {
|
|
7
|
+
/** The predicted label, for example "POSITIVE". */
|
|
5
8
|
label: string;
|
|
9
|
+
/** Its probability, from 0 to 1. */
|
|
6
10
|
score: number;
|
|
11
|
+
/** The label's position in the model's label list. */
|
|
7
12
|
index: number;
|
|
8
13
|
}
|
|
14
|
+
/** One document after reranking. */
|
|
9
15
|
export interface RankedDocument {
|
|
16
|
+
/** Its position in the list that was passed in. */
|
|
10
17
|
index: number;
|
|
18
|
+
/** The cross-encoder's raw score; higher is more relevant. */
|
|
11
19
|
score: number;
|
|
20
|
+
/** The document text. */
|
|
12
21
|
text: string;
|
|
13
22
|
}
|
|
14
23
|
export type Request = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kjarni-wasm",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "Local AI inference in the browser: embeddings, classification, reranking, semantic search and chat, running in a Web Worker.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"typescript": "^5.6.0"
|
|
26
26
|
},
|
|
27
|
-
"license": "MIT",
|
|
27
|
+
"license": "MIT OR Apache-2.0",
|
|
28
28
|
"repository": {
|
|
29
29
|
"type": "git",
|
|
30
30
|
"url": "git+https://github.com/olafurjohannsson/kjarni.git",
|
package/pkg/kjarni_wasm.d.ts
CHANGED
|
@@ -77,10 +77,6 @@ export class WasmChat {
|
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
79
|
* Sequence classification: sentiment, emotion, toxicity.
|
|
80
|
-
*
|
|
81
|
-
* New to the browser. Classification was always in the engine but never had a
|
|
82
|
-
* binding here, because this crate previously carried its own encoder and nobody
|
|
83
|
-
* wrote a second classifier head for it.
|
|
84
80
|
*/
|
|
85
81
|
export class WasmClassifier {
|
|
86
82
|
private constructor();
|
|
@@ -171,8 +167,7 @@ export class WasmReranker {
|
|
|
171
167
|
/**
|
|
172
168
|
* Load a cross-encoder from a `.kjq` container.
|
|
173
169
|
*
|
|
174
|
-
* The
|
|
175
|
-
* engine's `CrossEncoder` loads it as part of the model.
|
|
170
|
+
* The engine's `CrossEncoder` loads the classifier head as part of the model.
|
|
176
171
|
*/
|
|
177
172
|
static load(data: Uint8Array): WasmReranker;
|
|
178
173
|
/**
|
|
@@ -255,8 +250,8 @@ export interface InitOutput {
|
|
|
255
250
|
readonly wasmsearch_search_keywords: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
256
251
|
readonly wasmsearch_search_semantic: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
257
252
|
readonly wasmsearch_update_file: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
258
|
-
readonly
|
|
259
|
-
readonly
|
|
253
|
+
readonly __wasm_bindgen_func_elem_5727: (a: number, b: number, c: number, d: number) => void;
|
|
254
|
+
readonly __wasm_bindgen_func_elem_5745: (a: number, b: number, c: number, d: number) => void;
|
|
260
255
|
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
261
256
|
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
262
257
|
readonly __wbindgen_export3: (a: number) => void;
|
package/pkg/kjarni_wasm.js
CHANGED
|
@@ -229,10 +229,6 @@ if (Symbol.dispose) WasmChat.prototype[Symbol.dispose] = WasmChat.prototype.free
|
|
|
229
229
|
|
|
230
230
|
/**
|
|
231
231
|
* Sequence classification: sentiment, emotion, toxicity.
|
|
232
|
-
*
|
|
233
|
-
* New to the browser. Classification was always in the engine but never had a
|
|
234
|
-
* binding here, because this crate previously carried its own encoder and nobody
|
|
235
|
-
* wrote a second classifier head for it.
|
|
236
232
|
*/
|
|
237
233
|
export class WasmClassifier {
|
|
238
234
|
static __wrap(ptr) {
|
|
@@ -673,8 +669,7 @@ export class WasmReranker {
|
|
|
673
669
|
/**
|
|
674
670
|
* Load a cross-encoder from a `.kjq` container.
|
|
675
671
|
*
|
|
676
|
-
* The
|
|
677
|
-
* engine's `CrossEncoder` loads it as part of the model.
|
|
672
|
+
* The engine's `CrossEncoder` loads the classifier head as part of the model.
|
|
678
673
|
* @param {Uint8Array} data
|
|
679
674
|
* @returns {WasmReranker}
|
|
680
675
|
*/
|
|
@@ -1114,7 +1109,7 @@ function __wbg_get_imports() {
|
|
|
1114
1109
|
const a = state0.a;
|
|
1115
1110
|
state0.a = 0;
|
|
1116
1111
|
try {
|
|
1117
|
-
return
|
|
1112
|
+
return __wasm_bindgen_func_elem_5745(a, state0.b, arg0, arg1);
|
|
1118
1113
|
} finally {
|
|
1119
1114
|
state0.a = a;
|
|
1120
1115
|
}
|
|
@@ -1228,8 +1223,8 @@ function __wbg_get_imports() {
|
|
|
1228
1223
|
return addHeapObject(ret);
|
|
1229
1224
|
},
|
|
1230
1225
|
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
1231
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
1232
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1226
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 2088, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1227
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_5727);
|
|
1233
1228
|
return addHeapObject(ret);
|
|
1234
1229
|
},
|
|
1235
1230
|
__wbindgen_generic_0000000000000002: function(arg0) {
|
|
@@ -1266,14 +1261,14 @@ function __wbg_get_imports() {
|
|
|
1266
1261
|
};
|
|
1267
1262
|
}
|
|
1268
1263
|
|
|
1269
|
-
function
|
|
1270
|
-
wasm.
|
|
1264
|
+
function __wasm_bindgen_func_elem_5745(arg0, arg1, arg2, arg3) {
|
|
1265
|
+
wasm.__wasm_bindgen_func_elem_5745(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
1271
1266
|
}
|
|
1272
1267
|
|
|
1273
|
-
function
|
|
1268
|
+
function __wasm_bindgen_func_elem_5727(arg0, arg1, arg2) {
|
|
1274
1269
|
try {
|
|
1275
1270
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1276
|
-
wasm.
|
|
1271
|
+
wasm.__wasm_bindgen_func_elem_5727(retptr, arg0, arg1, addHeapObject(arg2));
|
|
1277
1272
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1278
1273
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1279
1274
|
if (r1) {
|
package/pkg/kjarni_wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -47,8 +47,8 @@ export const wasmsearch_search: (a: number, b: number, c: number, d: number, e:
|
|
|
47
47
|
export const wasmsearch_search_keywords: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
48
48
|
export const wasmsearch_search_semantic: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
49
49
|
export const wasmsearch_update_file: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
50
|
-
export const
|
|
51
|
-
export const
|
|
50
|
+
export const __wasm_bindgen_func_elem_5727: (a: number, b: number, c: number, d: number) => void;
|
|
51
|
+
export const __wasm_bindgen_func_elem_5745: (a: number, b: number, c: number, d: number) => void;
|
|
52
52
|
export const __wbindgen_export: (a: number, b: number) => number;
|
|
53
53
|
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
54
54
|
export const __wbindgen_export3: (a: number) => void;
|
package/pkg/package.json
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
"Ólafur Aron Jóhannsson <olafurjohannss@gmail.com>"
|
|
6
6
|
],
|
|
7
7
|
"description": "Local AI inference in the browser: embeddings, classification, reranking, semantic search and chat, compiled to WebAssembly.",
|
|
8
|
-
"version": "0.2.
|
|
9
|
-
"license": "MIT",
|
|
8
|
+
"version": "0.2.7",
|
|
9
|
+
"license": "MIT OR Apache-2.0",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
12
|
"url": "https://github.com/olafurjohannsson/kjarni"
|