kjarni-wasm 0.1.8 → 0.1.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kjarni-wasm",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
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",
@@ -81,6 +81,13 @@ export class WasmClassifier {
81
81
  private constructor();
82
82
  free(): void;
83
83
  [Symbol.dispose](): void;
84
+ /**
85
+ * Classify a batch, returning the single best label for each input.
86
+ *
87
+ * One result per input, in input order, so the caller can line them up with
88
+ * whatever it passed in.
89
+ */
90
+ classify_batch(texts: string[]): any;
84
91
  /**
85
92
  * Classify one text, returning every label with its score, highest first.
86
93
  *
@@ -89,13 +96,6 @@ export class WasmClassifier {
89
96
  * what makes the behaviour testable on the host.
90
97
  */
91
98
  classify(text: string): any;
92
- /**
93
- * Classify a batch, returning the single best label for each input.
94
- *
95
- * One result per input, in input order, so the caller can line them up with
96
- * whatever it passed in.
97
- */
98
- classify_batch(texts: string[]): any;
99
99
  /**
100
100
  * The labels this model predicts, in index order.
101
101
  */
@@ -248,8 +248,8 @@ export interface InitOutput {
248
248
  readonly wasmsearch_search_keywords: (a: number, b: number, c: number, d: number, e: number) => void;
249
249
  readonly wasmsearch_search_semantic: (a: number, b: number, c: number, d: number, e: number) => void;
250
250
  readonly wasmsearch_update_file: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
251
- readonly __wasm_bindgen_func_elem_5516: (a: number, b: number, c: number, d: number) => void;
252
- readonly __wasm_bindgen_func_elem_5525: (a: number, b: number, c: number, d: number) => void;
251
+ readonly __wasm_bindgen_func_elem_5599: (a: number, b: number, c: number, d: number) => void;
252
+ readonly __wasm_bindgen_func_elem_5619: (a: number, b: number, c: number, d: number) => void;
253
253
  readonly __wbindgen_export: (a: number, b: number) => number;
254
254
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
255
255
  readonly __wbindgen_export3: (a: number) => void;
@@ -230,20 +230,19 @@ export class WasmClassifier {
230
230
  wasm.__wbg_wasmclassifier_free(ptr, 0);
231
231
  }
232
232
  /**
233
- * Classify one text, returning every label with its score, highest first.
233
+ * Classify a batch, returning the single best label for each input.
234
234
  *
235
- * Serializing to a `JsValue` panics outside wasm32, so the work lives in
236
- * [`WasmClassifier::classify_core`] and this is only the conversion. That is
237
- * what makes the behaviour testable on the host.
238
- * @param {string} text
235
+ * One result per input, in input order, so the caller can line them up with
236
+ * whatever it passed in.
237
+ * @param {string[]} texts
239
238
  * @returns {any}
240
239
  */
241
- classify(text) {
240
+ classify_batch(texts) {
242
241
  try {
243
242
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
244
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
243
+ const ptr0 = passArrayJsValueToWasm0(texts, wasm.__wbindgen_export);
245
244
  const len0 = WASM_VECTOR_LEN;
246
- wasm.wasmclassifier_classify(retptr, this.__wbg_ptr, ptr0, len0);
245
+ wasm.wasmclassifier_classify_batch(retptr, this.__wbg_ptr, ptr0, len0);
247
246
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
248
247
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
249
248
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -256,19 +255,20 @@ export class WasmClassifier {
256
255
  }
257
256
  }
258
257
  /**
259
- * Classify a batch, returning the single best label for each input.
258
+ * Classify one text, returning every label with its score, highest first.
260
259
  *
261
- * One result per input, in input order, so the caller can line them up with
262
- * whatever it passed in.
263
- * @param {string[]} texts
260
+ * Serializing to a `JsValue` panics outside wasm32, so the work lives in
261
+ * [`WasmClassifier::classify_core`] and this is only the conversion. That is
262
+ * what makes the behaviour testable on the host.
263
+ * @param {string} text
264
264
  * @returns {any}
265
265
  */
266
- classify_batch(texts) {
266
+ classify(text) {
267
267
  try {
268
268
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
269
- const ptr0 = passArrayJsValueToWasm0(texts, wasm.__wbindgen_export);
269
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
270
270
  const len0 = WASM_VECTOR_LEN;
271
- wasm.wasmclassifier_classify_batch(retptr, this.__wbg_ptr, ptr0, len0);
271
+ wasm.wasmclassifier_classify(retptr, this.__wbg_ptr, ptr0, len0);
272
272
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
273
273
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
274
274
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1092,7 +1092,7 @@ function __wbg_get_imports() {
1092
1092
  const a = state0.a;
1093
1093
  state0.a = 0;
1094
1094
  try {
1095
- return __wasm_bindgen_func_elem_5525(a, state0.b, arg0, arg1);
1095
+ return __wasm_bindgen_func_elem_5619(a, state0.b, arg0, arg1);
1096
1096
  } finally {
1097
1097
  state0.a = a;
1098
1098
  }
@@ -1206,8 +1206,8 @@ function __wbg_get_imports() {
1206
1206
  return addHeapObject(ret);
1207
1207
  },
1208
1208
  __wbindgen_generic_0000000000000001: function(arg0, arg1) {
1209
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 2060, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1210
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_5516);
1209
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 2061, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1210
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_5599);
1211
1211
  return addHeapObject(ret);
1212
1212
  },
1213
1213
  __wbindgen_generic_0000000000000002: function(arg0) {
@@ -1244,14 +1244,14 @@ function __wbg_get_imports() {
1244
1244
  };
1245
1245
  }
1246
1246
 
1247
- function __wasm_bindgen_func_elem_5525(arg0, arg1, arg2, arg3) {
1248
- wasm.__wasm_bindgen_func_elem_5525(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
1247
+ function __wasm_bindgen_func_elem_5619(arg0, arg1, arg2, arg3) {
1248
+ wasm.__wasm_bindgen_func_elem_5619(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
1249
1249
  }
1250
1250
 
1251
- function __wasm_bindgen_func_elem_5516(arg0, arg1, arg2) {
1251
+ function __wasm_bindgen_func_elem_5599(arg0, arg1, arg2) {
1252
1252
  try {
1253
1253
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1254
- wasm.__wasm_bindgen_func_elem_5516(retptr, arg0, arg1, addHeapObject(arg2));
1254
+ wasm.__wasm_bindgen_func_elem_5599(retptr, arg0, arg1, addHeapObject(arg2));
1255
1255
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1256
1256
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1257
1257
  if (r1) {
Binary file
@@ -45,8 +45,8 @@ export const wasmsearch_search: (a: number, b: number, c: number, d: number, e:
45
45
  export const wasmsearch_search_keywords: (a: number, b: number, c: number, d: number, e: number) => void;
46
46
  export const wasmsearch_search_semantic: (a: number, b: number, c: number, d: number, e: number) => void;
47
47
  export const wasmsearch_update_file: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
48
- export const __wasm_bindgen_func_elem_5516: (a: number, b: number, c: number, d: number) => void;
49
- export const __wasm_bindgen_func_elem_5525: (a: number, b: number, c: number, d: number) => void;
48
+ export const __wasm_bindgen_func_elem_5599: (a: number, b: number, c: number, d: number) => void;
49
+ export const __wasm_bindgen_func_elem_5619: (a: number, b: number, c: number, d: number) => void;
50
50
  export const __wbindgen_export: (a: number, b: number) => number;
51
51
  export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
52
52
  export const __wbindgen_export3: (a: number) => void;
package/pkg/package.json CHANGED
@@ -5,7 +5,7 @@
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.3.4",
8
+ "version": "0.1.10",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",