eddie-jekyll 0.4.0 → 0.4.2

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.
@@ -1,9 +1,72 @@
1
+ // SPDX-License-Identifier: GPL-3.0-only
2
+ // Generated by widget/build.sh (wasm-pack --target no-modules, eddie-lite); loaded with importScripts by eddie-worker.js.
1
3
  let wasm_bindgen = (function(exports) {
2
4
  let script_src;
3
5
  if (typeof document !== 'undefined' && document.currentScript !== null) {
4
6
  script_src = new URL(document.currentScript.src, location.href).toString();
5
7
  }
6
8
 
9
+ /**
10
+ * Attach a sidecar file (`manifest.sidecars[].file`, fetched relative to
11
+ * the index URL): its `dense/<scope>/<lane>` sections join the loaded
12
+ * index after the identity (`index_id`), chunk count and lane shape are
13
+ * checked. Until a lane's sidecar is attached, searches that ask for it
14
+ * report the dense arm as skipped instead of failing.
15
+ * @param {Uint8Array} bytes
16
+ * @returns {string}
17
+ */
18
+ function attach_sidecar(bytes) {
19
+ let deferred3_0;
20
+ let deferred3_1;
21
+ try {
22
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
23
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
24
+ const len0 = WASM_VECTOR_LEN;
25
+ wasm.attach_sidecar(retptr, ptr0, len0);
26
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
27
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
28
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
29
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
30
+ var ptr2 = r0;
31
+ var len2 = r1;
32
+ if (r3) {
33
+ ptr2 = 0; len2 = 0;
34
+ throw takeObject(r2);
35
+ }
36
+ deferred3_0 = ptr2;
37
+ deferred3_1 = len2;
38
+ return getStringFromWasm0(ptr2, len2);
39
+ } finally {
40
+ wasm.__wbindgen_add_to_stack_pointer(16);
41
+ wasm.__wbindgen_export2(deferred3_0, deferred3_1, 1);
42
+ }
43
+ }
44
+ exports.attach_sidecar = attach_sidecar;
45
+
46
+ /**
47
+ * What this WASM build can do, so the worker can branch between the lite
48
+ * module (`{dense_wasm: false}`; load `eddie-dense.wasm` for a CPU lane)
49
+ * and the full one.
50
+ * @returns {string}
51
+ */
52
+ function capabilities() {
53
+ let deferred1_0;
54
+ let deferred1_1;
55
+ try {
56
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
57
+ wasm.capabilities(retptr);
58
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
59
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
60
+ deferred1_0 = r0;
61
+ deferred1_1 = r1;
62
+ return getStringFromWasm0(r0, r1);
63
+ } finally {
64
+ wasm.__wbindgen_add_to_stack_pointer(16);
65
+ wasm.__wbindgen_export2(deferred1_0, deferred1_1, 1);
66
+ }
67
+ }
68
+ exports.capabilities = capabilities;
69
+
7
70
  /**
8
71
  * One chunk by id.
9
72
  * @param {number} id
@@ -35,45 +98,17 @@ let wasm_bindgen = (function(exports) {
35
98
  }
36
99
  exports.chunk = chunk;
37
100
 
38
- /**
39
- * Load the BERT-family model for a `wasm-candle` lane of the loaded index.
40
- * @param {string} lane_id
41
- * @param {Uint8Array} config
42
- * @param {Uint8Array} tokenizer
43
- * @param {Uint8Array} weights
44
- */
45
- function init_dense_wasm(lane_id, config, tokenizer, weights) {
46
- try {
47
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
48
- const ptr0 = passStringToWasm0(lane_id, wasm.__wbindgen_export3, wasm.__wbindgen_export4);
49
- const len0 = WASM_VECTOR_LEN;
50
- const ptr1 = passArray8ToWasm0(config, wasm.__wbindgen_export3);
51
- const len1 = WASM_VECTOR_LEN;
52
- const ptr2 = passArray8ToWasm0(tokenizer, wasm.__wbindgen_export3);
53
- const len2 = WASM_VECTOR_LEN;
54
- const ptr3 = passArray8ToWasm0(weights, wasm.__wbindgen_export3);
55
- const len3 = WASM_VECTOR_LEN;
56
- wasm.init_dense_wasm(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
57
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
58
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
59
- if (r1) {
60
- throw takeObject(r0);
61
- }
62
- } finally {
63
- wasm.__wbindgen_add_to_stack_pointer(16);
64
- }
65
- }
66
- exports.init_dense_wasm = init_dense_wasm;
67
-
68
101
  /**
69
102
  * Parse and validate the index. Replaces any previously loaded index and
70
- * forgets its dense embedder / sparse tokenizer.
103
+ * forgets its dense embedder. When the index embeds its sparse vocabulary
104
+ * (`manifest.sparse.vocab == "embedded"`) the sparse arm is ready without
105
+ * `init_sparse_tokenizer`.
71
106
  * @param {Uint8Array} index_bytes
72
107
  */
73
108
  function init_index(index_bytes) {
74
109
  try {
75
110
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
76
- const ptr0 = passArray8ToWasm0(index_bytes, wasm.__wbindgen_export3);
111
+ const ptr0 = passArray8ToWasm0(index_bytes, wasm.__wbindgen_export);
77
112
  const len0 = WASM_VECTOR_LEN;
78
113
  wasm.init_index(retptr, ptr0, len0);
79
114
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
@@ -98,7 +133,7 @@ let wasm_bindgen = (function(exports) {
98
133
  function init_sparse_tokenizer(tokenizer_bytes) {
99
134
  try {
100
135
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
101
- const ptr0 = passArray8ToWasm0(tokenizer_bytes, wasm.__wbindgen_export3);
136
+ const ptr0 = passArray8ToWasm0(tokenizer_bytes, wasm.__wbindgen_export);
102
137
  const len0 = WASM_VECTOR_LEN;
103
138
  wasm.init_sparse_tokenizer(retptr, ptr0, len0);
104
139
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
@@ -122,7 +157,7 @@ let wasm_bindgen = (function(exports) {
122
157
  let deferred3_1;
123
158
  try {
124
159
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
125
- const ptr0 = passArray8ToWasm0(index_bytes, wasm.__wbindgen_export3);
160
+ const ptr0 = passArray8ToWasm0(index_bytes, wasm.__wbindgen_export);
126
161
  const len0 = WASM_VECTOR_LEN;
127
162
  wasm.manifest(retptr, ptr0, len0);
128
163
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
@@ -157,7 +192,7 @@ let wasm_bindgen = (function(exports) {
157
192
  let deferred3_1;
158
193
  try {
159
194
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
160
- const ptr0 = passStringToWasm0(url, wasm.__wbindgen_export3, wasm.__wbindgen_export4);
195
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_export, wasm.__wbindgen_export3);
161
196
  const len0 = WASM_VECTOR_LEN;
162
197
  wasm.page(retptr, ptr0, len0);
163
198
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
@@ -181,8 +216,11 @@ let wasm_bindgen = (function(exports) {
181
216
  exports.page = page;
182
217
 
183
218
  /**
184
- * Nearest QA entries by cosine on the qa dense lane. Returns `[]` when the
185
- * index has no qa section or no query vector can be produced.
219
+ * QA entries ranked by [`crate::search::rank_qa`]: the qa dense lane's
220
+ * cosine fused with lexical overlap and a BM25 pass over the questions and
221
+ * answers. Returns `[]` when the index has no qa section; without a query
222
+ * vector (no runnable embedder) the ranking is lexical only and no hit is
223
+ * `confident`.
186
224
  * @param {string} query
187
225
  * @param {string | null | undefined} dense_lane_id
188
226
  * @param {Float32Array | null | undefined} dense_query_vec
@@ -194,11 +232,11 @@ let wasm_bindgen = (function(exports) {
194
232
  let deferred5_1;
195
233
  try {
196
234
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
197
- const ptr0 = passStringToWasm0(query, wasm.__wbindgen_export3, wasm.__wbindgen_export4);
235
+ const ptr0 = passStringToWasm0(query, wasm.__wbindgen_export, wasm.__wbindgen_export3);
198
236
  const len0 = WASM_VECTOR_LEN;
199
- var ptr1 = isLikeNone(dense_lane_id) ? 0 : passStringToWasm0(dense_lane_id, wasm.__wbindgen_export3, wasm.__wbindgen_export4);
237
+ var ptr1 = isLikeNone(dense_lane_id) ? 0 : passStringToWasm0(dense_lane_id, wasm.__wbindgen_export, wasm.__wbindgen_export3);
200
238
  var len1 = WASM_VECTOR_LEN;
201
- var ptr2 = isLikeNone(dense_query_vec) ? 0 : passArrayF32ToWasm0(dense_query_vec, wasm.__wbindgen_export3);
239
+ var ptr2 = isLikeNone(dense_query_vec) ? 0 : passArrayF32ToWasm0(dense_query_vec, wasm.__wbindgen_export);
202
240
  var len2 = WASM_VECTOR_LEN;
203
241
  wasm.qa_lookup(retptr, ptr0, len0, ptr1, len1, ptr2, len2, k);
204
242
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
@@ -241,13 +279,13 @@ let wasm_bindgen = (function(exports) {
241
279
  let deferred6_1;
242
280
  try {
243
281
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
244
- const ptr0 = passStringToWasm0(query, wasm.__wbindgen_export3, wasm.__wbindgen_export4);
282
+ const ptr0 = passStringToWasm0(query, wasm.__wbindgen_export, wasm.__wbindgen_export3);
245
283
  const len0 = WASM_VECTOR_LEN;
246
- const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export3, wasm.__wbindgen_export4);
284
+ const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export, wasm.__wbindgen_export3);
247
285
  const len1 = WASM_VECTOR_LEN;
248
- var ptr2 = isLikeNone(dense_lane_id) ? 0 : passStringToWasm0(dense_lane_id, wasm.__wbindgen_export3, wasm.__wbindgen_export4);
286
+ var ptr2 = isLikeNone(dense_lane_id) ? 0 : passStringToWasm0(dense_lane_id, wasm.__wbindgen_export, wasm.__wbindgen_export3);
249
287
  var len2 = WASM_VECTOR_LEN;
250
- var ptr3 = isLikeNone(dense_query_vec) ? 0 : passArrayF32ToWasm0(dense_query_vec, wasm.__wbindgen_export3);
288
+ var ptr3 = isLikeNone(dense_query_vec) ? 0 : passArrayF32ToWasm0(dense_query_vec, wasm.__wbindgen_export);
251
289
  var len3 = WASM_VECTOR_LEN;
252
290
  wasm.search(retptr, ptr0, len0, top_k, ptr1, len1, ptr2, len2, ptr3, len3);
253
291
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
@@ -269,6 +307,28 @@ let wasm_bindgen = (function(exports) {
269
307
  }
270
308
  }
271
309
  exports.search = search;
310
+
311
+ /**
312
+ * Whether the sparse arm can run queries right now (an embedded vocab or
313
+ * a tokenizer loaded with `init_sparse_tokenizer`).
314
+ * @returns {boolean}
315
+ */
316
+ function sparse_ready() {
317
+ try {
318
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
319
+ wasm.sparse_ready(retptr);
320
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
321
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
322
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
323
+ if (r2) {
324
+ throw takeObject(r1);
325
+ }
326
+ return r0 !== 0;
327
+ } finally {
328
+ wasm.__wbindgen_add_to_stack_pointer(16);
329
+ }
330
+ }
331
+ exports.sparse_ready = sparse_ready;
272
332
  function __wbg_get_imports() {
273
333
  const import0 = {
274
334
  __proto__: null,
@@ -278,9 +338,6 @@ let wasm_bindgen = (function(exports) {
278
338
  __wbg_error_dd408a7b3cb542dd: function(arg0) {
279
339
  console.error(getObject(arg0));
280
340
  },
281
- __wbg_getRandomValues_a608c4436c19407a: function() { return handleError(function (arg0, arg1) {
282
- globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
283
- }, arguments); },
284
341
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
285
342
  // Cast intrinsic for `Ref(String) -> Externref`.
286
343
  const ret = getStringFromWasm0(arg0, arg1);
@@ -292,7 +349,7 @@ let wasm_bindgen = (function(exports) {
292
349
  };
293
350
  return {
294
351
  __proto__: null,
295
- "./eddie_bg.js": import0,
352
+ "./eddie-lite_bg.js": import0,
296
353
  };
297
354
  }
298
355
 
@@ -311,11 +368,6 @@ let wasm_bindgen = (function(exports) {
311
368
  heap_next = idx;
312
369
  }
313
370
 
314
- function getArrayU8FromWasm0(ptr, len) {
315
- ptr = ptr >>> 0;
316
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
317
- }
318
-
319
371
  let cachedDataViewMemory0 = null;
320
372
  function getDataViewMemory0() {
321
373
  if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
@@ -346,14 +398,6 @@ let wasm_bindgen = (function(exports) {
346
398
 
347
399
  function getObject(idx) { return heap[idx]; }
348
400
 
349
- function handleError(f, args) {
350
- try {
351
- return f.apply(this, args);
352
- } catch (e) {
353
- wasm.__wbindgen_export(addHeapObject(e));
354
- }
355
- }
356
-
357
401
  let heap = new Array(1024).fill(undefined);
358
402
  heap.push(undefined, null, true, false);
359
403
 
Binary file