eddie-jekyll 0.2.0 → 0.2.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73ece7f8b1b59db4dffd19458119f623a5a4c395f609ff726f852b51dbc254b0
4
- data.tar.gz: 6901385bb5767ad6773ccf3eaf3a6845c67f73f66fa6d33fb0c382bc94c183fa
3
+ metadata.gz: fc7384373abb460bcdda72dcc92f89592c6579b33a365a5b0ae128d6248fee2b
4
+ data.tar.gz: ad25ba5c95827f9df881f6644b43b121f03036ca4e540737df23756d911c85ca
5
5
  SHA512:
6
- metadata.gz: 20c16a129c2b26f60ade599e0fa9f67cea7c3b2f0784fe4cd8de44f3d7ad453b5be589a8c2536369ceee19f8b9b59f742eb4beeb09d5cd0f9c62b010f42e467c
7
- data.tar.gz: 21f8cef90ef666b399ad6e72301c35a23de4a7032286e55d725d1866831dbaf038421b8e6426ac438fd587e9fdc08cb052fc0da9f33ef10969ed597ff622c9f7
6
+ metadata.gz: 1cee5605e7eed8f1d93efc339fccc97c58b4c07fb43171bf7eae2da6feeff3bf667cb983496f51f204204bca55db2b649afe253eac39e9f09958403f7aab2c89
7
+ data.tar.gz: 0ca440e4046e541b00285de6a7e6f38e33770c58a0e534dbcf64315df341127fb89074faeb6b8e5e3c272af061776862496b53a6284d5bba0e9bc694b675c9cb
@@ -0,0 +1,460 @@
1
+ let wasm_bindgen = (function(exports) {
2
+ let script_src;
3
+ if (typeof document !== 'undefined' && document.currentScript !== null) {
4
+ script_src = new URL(document.currentScript.src, location.href).toString();
5
+ }
6
+
7
+ /**
8
+ * @param {Uint8Array} index_bytes
9
+ * @returns {string}
10
+ */
11
+ function extract_model_id(index_bytes) {
12
+ let deferred3_0;
13
+ let deferred3_1;
14
+ try {
15
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
16
+ const ptr0 = passArray8ToWasm0(index_bytes, wasm.__wbindgen_export);
17
+ const len0 = WASM_VECTOR_LEN;
18
+ wasm.extract_model_id(retptr, ptr0, len0);
19
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
20
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
21
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
22
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
23
+ var ptr2 = r0;
24
+ var len2 = r1;
25
+ if (r3) {
26
+ ptr2 = 0; len2 = 0;
27
+ throw takeObject(r2);
28
+ }
29
+ deferred3_0 = ptr2;
30
+ deferred3_1 = len2;
31
+ return getStringFromWasm0(ptr2, len2);
32
+ } finally {
33
+ wasm.__wbindgen_add_to_stack_pointer(16);
34
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
35
+ }
36
+ }
37
+ exports.extract_model_id = extract_model_id;
38
+
39
+ /**
40
+ * Initialize the search engine from raw model and index bytes.
41
+ *
42
+ * Called once by the Web Worker after downloading all assets.
43
+ * @param {Uint8Array} config_bytes
44
+ * @param {Uint8Array} tokenizer_bytes
45
+ * @param {Uint8Array} weights_bytes
46
+ * @param {Uint8Array} index_bytes
47
+ */
48
+ function init_engine(config_bytes, tokenizer_bytes, weights_bytes, index_bytes) {
49
+ try {
50
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
51
+ const ptr0 = passArray8ToWasm0(config_bytes, wasm.__wbindgen_export);
52
+ const len0 = WASM_VECTOR_LEN;
53
+ const ptr1 = passArray8ToWasm0(tokenizer_bytes, wasm.__wbindgen_export);
54
+ const len1 = WASM_VECTOR_LEN;
55
+ const ptr2 = passArray8ToWasm0(weights_bytes, wasm.__wbindgen_export);
56
+ const len2 = WASM_VECTOR_LEN;
57
+ const ptr3 = passArray8ToWasm0(index_bytes, wasm.__wbindgen_export);
58
+ const len3 = WASM_VECTOR_LEN;
59
+ wasm.init_engine(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
60
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
61
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
62
+ if (r1) {
63
+ throw takeObject(r0);
64
+ }
65
+ } finally {
66
+ wasm.__wbindgen_add_to_stack_pointer(16);
67
+ }
68
+ }
69
+ exports.init_engine = init_engine;
70
+
71
+ /**
72
+ * Query the embedded claims section semantically.
73
+ * @param {string} query
74
+ * @param {number} top_k
75
+ * @returns {any}
76
+ */
77
+ function query_claims(query, top_k) {
78
+ try {
79
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
80
+ const ptr0 = passStringToWasm0(query, wasm.__wbindgen_export, wasm.__wbindgen_export2);
81
+ const len0 = WASM_VECTOR_LEN;
82
+ wasm.query_claims(retptr, ptr0, len0, top_k);
83
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
84
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
85
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
86
+ if (r2) {
87
+ throw takeObject(r1);
88
+ }
89
+ return takeObject(r0);
90
+ } finally {
91
+ wasm.__wbindgen_add_to_stack_pointer(16);
92
+ }
93
+ }
94
+ exports.query_claims = query_claims;
95
+
96
+ /**
97
+ * Query the embedded QA section semantically.
98
+ * @param {string} query
99
+ * @param {number} top_k
100
+ * @returns {any}
101
+ */
102
+ function query_qa(query, top_k) {
103
+ try {
104
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
105
+ const ptr0 = passStringToWasm0(query, wasm.__wbindgen_export, wasm.__wbindgen_export2);
106
+ const len0 = WASM_VECTOR_LEN;
107
+ wasm.query_qa(retptr, ptr0, len0, top_k);
108
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
109
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
110
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
111
+ if (r2) {
112
+ throw takeObject(r1);
113
+ }
114
+ return takeObject(r0);
115
+ } finally {
116
+ wasm.__wbindgen_add_to_stack_pointer(16);
117
+ }
118
+ }
119
+ exports.query_qa = query_qa;
120
+
121
+ /**
122
+ * Search the index and return results as a JS array.
123
+ *
124
+ * `mode`: "semantic", "keyword", or "hybrid" (default).
125
+ * @param {string} query
126
+ * @param {number} top_k
127
+ * @param {string} mode
128
+ * @returns {any}
129
+ */
130
+ function search_query(query, top_k, mode) {
131
+ try {
132
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
133
+ const ptr0 = passStringToWasm0(query, wasm.__wbindgen_export, wasm.__wbindgen_export2);
134
+ const len0 = WASM_VECTOR_LEN;
135
+ const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export, wasm.__wbindgen_export2);
136
+ const len1 = WASM_VECTOR_LEN;
137
+ wasm.search_query(retptr, ptr0, len0, top_k, ptr1, len1);
138
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
139
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
140
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
141
+ if (r2) {
142
+ throw takeObject(r1);
143
+ }
144
+ return takeObject(r0);
145
+ } finally {
146
+ wasm.__wbindgen_add_to_stack_pointer(16);
147
+ }
148
+ }
149
+ exports.search_query = search_query;
150
+
151
+ /**
152
+ * Search and optionally synthesize a grounded answer inside WASM.
153
+ * @param {string} query
154
+ * @param {number} top_k
155
+ * @param {number} answer_top_k
156
+ * @param {string} mode
157
+ * @param {boolean} answer_mode
158
+ * @param {string} qa_subject
159
+ * @returns {any}
160
+ */
161
+ function search_with_answer(query, top_k, answer_top_k, mode, answer_mode, qa_subject) {
162
+ try {
163
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
164
+ const ptr0 = passStringToWasm0(query, wasm.__wbindgen_export, wasm.__wbindgen_export2);
165
+ const len0 = WASM_VECTOR_LEN;
166
+ const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export, wasm.__wbindgen_export2);
167
+ const len1 = WASM_VECTOR_LEN;
168
+ const ptr2 = passStringToWasm0(qa_subject, wasm.__wbindgen_export, wasm.__wbindgen_export2);
169
+ const len2 = WASM_VECTOR_LEN;
170
+ wasm.search_with_answer(retptr, ptr0, len0, top_k, answer_top_k, ptr1, len1, answer_mode, ptr2, len2);
171
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
172
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
173
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
174
+ if (r2) {
175
+ throw takeObject(r1);
176
+ }
177
+ return takeObject(r0);
178
+ } finally {
179
+ wasm.__wbindgen_add_to_stack_pointer(16);
180
+ }
181
+ }
182
+ exports.search_with_answer = search_with_answer;
183
+
184
+ function __wbg_get_imports() {
185
+ const import0 = {
186
+ __proto__: null,
187
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
188
+ const ret = String(getObject(arg1));
189
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
190
+ const len1 = WASM_VECTOR_LEN;
191
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
192
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
193
+ },
194
+ __wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
195
+ throw new Error(getStringFromWasm0(arg0, arg1));
196
+ },
197
+ __wbg_getRandomValues_3f44b700395062e5: function() { return handleError(function (arg0, arg1) {
198
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
199
+ }, arguments); },
200
+ __wbg_new_a70fbab9066b301f: function() {
201
+ const ret = new Array();
202
+ return addHeapObject(ret);
203
+ },
204
+ __wbg_new_ab79df5bd7c26067: function() {
205
+ const ret = new Object();
206
+ return addHeapObject(ret);
207
+ },
208
+ __wbg_now_16f0c993d5dd6c27: function() {
209
+ const ret = Date.now();
210
+ return ret;
211
+ },
212
+ __wbg_set_282384002438957f: function(arg0, arg1, arg2) {
213
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
214
+ },
215
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
216
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
217
+ },
218
+ __wbindgen_cast_0000000000000001: function(arg0) {
219
+ // Cast intrinsic for `F64 -> Externref`.
220
+ const ret = arg0;
221
+ return addHeapObject(ret);
222
+ },
223
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
224
+ // Cast intrinsic for `Ref(String) -> Externref`.
225
+ const ret = getStringFromWasm0(arg0, arg1);
226
+ return addHeapObject(ret);
227
+ },
228
+ __wbindgen_object_clone_ref: function(arg0) {
229
+ const ret = getObject(arg0);
230
+ return addHeapObject(ret);
231
+ },
232
+ __wbindgen_object_drop_ref: function(arg0) {
233
+ takeObject(arg0);
234
+ },
235
+ };
236
+ return {
237
+ __proto__: null,
238
+ "./eddie_bg.js": import0,
239
+ };
240
+ }
241
+
242
+ function addHeapObject(obj) {
243
+ if (heap_next === heap.length) heap.push(heap.length + 1);
244
+ const idx = heap_next;
245
+ heap_next = heap[idx];
246
+
247
+ heap[idx] = obj;
248
+ return idx;
249
+ }
250
+
251
+ function dropObject(idx) {
252
+ if (idx < 1028) return;
253
+ heap[idx] = heap_next;
254
+ heap_next = idx;
255
+ }
256
+
257
+ function getArrayU8FromWasm0(ptr, len) {
258
+ ptr = ptr >>> 0;
259
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
260
+ }
261
+
262
+ let cachedDataViewMemory0 = null;
263
+ function getDataViewMemory0() {
264
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
265
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
266
+ }
267
+ return cachedDataViewMemory0;
268
+ }
269
+
270
+ function getStringFromWasm0(ptr, len) {
271
+ ptr = ptr >>> 0;
272
+ return decodeText(ptr, len);
273
+ }
274
+
275
+ let cachedUint8ArrayMemory0 = null;
276
+ function getUint8ArrayMemory0() {
277
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
278
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
279
+ }
280
+ return cachedUint8ArrayMemory0;
281
+ }
282
+
283
+ function getObject(idx) { return heap[idx]; }
284
+
285
+ function handleError(f, args) {
286
+ try {
287
+ return f.apply(this, args);
288
+ } catch (e) {
289
+ wasm.__wbindgen_export3(addHeapObject(e));
290
+ }
291
+ }
292
+
293
+ let heap = new Array(1024).fill(undefined);
294
+ heap.push(undefined, null, true, false);
295
+
296
+ let heap_next = heap.length;
297
+
298
+ function passArray8ToWasm0(arg, malloc) {
299
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
300
+ getUint8ArrayMemory0().set(arg, ptr / 1);
301
+ WASM_VECTOR_LEN = arg.length;
302
+ return ptr;
303
+ }
304
+
305
+ function passStringToWasm0(arg, malloc, realloc) {
306
+ if (realloc === undefined) {
307
+ const buf = cachedTextEncoder.encode(arg);
308
+ const ptr = malloc(buf.length, 1) >>> 0;
309
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
310
+ WASM_VECTOR_LEN = buf.length;
311
+ return ptr;
312
+ }
313
+
314
+ let len = arg.length;
315
+ let ptr = malloc(len, 1) >>> 0;
316
+
317
+ const mem = getUint8ArrayMemory0();
318
+
319
+ let offset = 0;
320
+
321
+ for (; offset < len; offset++) {
322
+ const code = arg.charCodeAt(offset);
323
+ if (code > 0x7F) break;
324
+ mem[ptr + offset] = code;
325
+ }
326
+ if (offset !== len) {
327
+ if (offset !== 0) {
328
+ arg = arg.slice(offset);
329
+ }
330
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
331
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
332
+ const ret = cachedTextEncoder.encodeInto(arg, view);
333
+
334
+ offset += ret.written;
335
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
336
+ }
337
+
338
+ WASM_VECTOR_LEN = offset;
339
+ return ptr;
340
+ }
341
+
342
+ function takeObject(idx) {
343
+ const ret = getObject(idx);
344
+ dropObject(idx);
345
+ return ret;
346
+ }
347
+
348
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
349
+ cachedTextDecoder.decode();
350
+ function decodeText(ptr, len) {
351
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
352
+ }
353
+
354
+ const cachedTextEncoder = new TextEncoder();
355
+
356
+ if (!('encodeInto' in cachedTextEncoder)) {
357
+ cachedTextEncoder.encodeInto = function (arg, view) {
358
+ const buf = cachedTextEncoder.encode(arg);
359
+ view.set(buf);
360
+ return {
361
+ read: arg.length,
362
+ written: buf.length
363
+ };
364
+ };
365
+ }
366
+
367
+ let WASM_VECTOR_LEN = 0;
368
+
369
+ let wasmModule, wasm;
370
+ function __wbg_finalize_init(instance, module) {
371
+ wasm = instance.exports;
372
+ wasmModule = module;
373
+ cachedDataViewMemory0 = null;
374
+ cachedUint8ArrayMemory0 = null;
375
+ return wasm;
376
+ }
377
+
378
+ async function __wbg_load(module, imports) {
379
+ if (typeof Response === 'function' && module instanceof Response) {
380
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
381
+ try {
382
+ return await WebAssembly.instantiateStreaming(module, imports);
383
+ } catch (e) {
384
+ const validResponse = module.ok && expectedResponseType(module.type);
385
+
386
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
387
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
388
+
389
+ } else { throw e; }
390
+ }
391
+ }
392
+
393
+ const bytes = await module.arrayBuffer();
394
+ return await WebAssembly.instantiate(bytes, imports);
395
+ } else {
396
+ const instance = await WebAssembly.instantiate(module, imports);
397
+
398
+ if (instance instanceof WebAssembly.Instance) {
399
+ return { instance, module };
400
+ } else {
401
+ return instance;
402
+ }
403
+ }
404
+
405
+ function expectedResponseType(type) {
406
+ switch (type) {
407
+ case 'basic': case 'cors': case 'default': return true;
408
+ }
409
+ return false;
410
+ }
411
+ }
412
+
413
+ function initSync(module) {
414
+ if (wasm !== undefined) return wasm;
415
+
416
+
417
+ if (module !== undefined) {
418
+ if (Object.getPrototypeOf(module) === Object.prototype) {
419
+ ({module} = module)
420
+ } else {
421
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
422
+ }
423
+ }
424
+
425
+ const imports = __wbg_get_imports();
426
+ if (!(module instanceof WebAssembly.Module)) {
427
+ module = new WebAssembly.Module(module);
428
+ }
429
+ const instance = new WebAssembly.Instance(module, imports);
430
+ return __wbg_finalize_init(instance, module);
431
+ }
432
+
433
+ async function __wbg_init(module_or_path) {
434
+ if (wasm !== undefined) return wasm;
435
+
436
+
437
+ if (module_or_path !== undefined) {
438
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
439
+ ({module_or_path} = module_or_path)
440
+ } else {
441
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
442
+ }
443
+ }
444
+
445
+ if (module_or_path === undefined && script_src !== undefined) {
446
+ module_or_path = script_src.replace(/\.js$/, "_bg.wasm");
447
+ }
448
+ const imports = __wbg_get_imports();
449
+
450
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
451
+ module_or_path = fetch(module_or_path);
452
+ }
453
+
454
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
455
+
456
+ return __wbg_finalize_init(instance, module);
457
+ }
458
+
459
+ return Object.assign(__wbg_init, { initSync }, exports);
460
+ })({ __proto__: null });