@delali/narsil 0.3.1-next.95 → 0.3.1-next.97
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 +2 -1
- package/dist/adapters/filesystem.d.ts +1 -1
- package/dist/adapters/filesystem.mjs +1 -1
- package/dist/adapters/indexeddb.d.ts +1 -1
- package/dist/adapters/indexeddb.mjs +1 -1
- package/dist/adapters/memory.d.ts +1 -1
- package/dist/{adapters-79OIa4xm.d.ts → adapters-BQFQ4PRz.d.ts} +27 -1
- package/dist/browser/{chunk-3U636ADD.mjs → chunk-CN4I4FZU.mjs} +2 -2
- package/dist/browser/chunk-JPTQZWJQ.mjs +10 -0
- package/dist/browser/{chunk-WKPJ4E73.mjs → chunk-LD55ZGU3.mjs} +2 -1
- package/dist/browser/{chunk-D3CC2NMZ.mjs → chunk-NAFT3K6X.mjs} +240 -135
- package/dist/browser/{chunk-LULHQXCK.mjs → chunk-NNG3EEB6.mjs} +5 -4
- package/dist/browser/{chunk-HARBSUWP.mjs → chunk-QWES44AW.mjs} +2 -197
- package/dist/browser/chunk-RELZRJNR.mjs +203 -0
- package/dist/browser/{chunk-FYFQJKFW.mjs → chunk-Z7QH2XHB.mjs} +40 -45
- package/dist/browser/{durability-wiring-3ZRKSPJD.mjs → durability-wiring-PY3L7DES.mjs} +7 -5
- package/dist/browser/{module-IEOQI5GI.mjs → module-PDXYHT75.mjs} +18 -10
- package/dist/browser/{restore-queue-RBULSOVX.mjs → restore-queue-DVIYJ7RU.mjs} +1 -1
- package/dist/browser/runtime-NYE5TB6O.mjs +557 -0
- package/dist/browser/{snapshot-Y3NGUJHX.mjs → snapshot-J57MZK6L.mjs} +115 -61
- package/dist/browser/{write-ZUBDNLCH.mjs → write-L7FAQA47.mjs} +6 -4
- package/dist/{capabilities-BvxvFzVA.d.ts → capabilities-BTTIs96E.d.ts} +19 -3
- package/dist/{chunk-GJZHU4FC.mjs → chunk-2WYMG3OZ.mjs} +4 -4
- package/dist/{chunk-7QONURHW.mjs → chunk-45AVKHMJ.mjs} +2 -2
- package/dist/{chunk-QM3VPX4Z.mjs → chunk-ASY5PHYI.mjs} +2 -2
- package/dist/{chunk-RDJKYKMQ.mjs → chunk-AY3AQ3UH.mjs} +1 -1
- package/dist/{chunk-54HYC5FT.mjs → chunk-BKB3XTMI.mjs} +6 -6
- package/dist/{chunk-MWT5WCJ5.mjs → chunk-COVCQ73F.mjs} +5 -5
- package/dist/{chunk-FGMGUDHX.mjs → chunk-E74YLAIG.mjs} +4 -1
- package/dist/chunk-FMWRCP2C.mjs +57 -0
- package/dist/{chunk-ES33L3HO.mjs → chunk-GGSH6KBQ.mjs} +1 -1
- package/dist/chunk-HJSN7UYG.mjs +10 -0
- package/dist/{chunk-ICL2AELD.mjs → chunk-HXJBSHXF.mjs} +40 -46
- package/dist/{chunk-ZHS44YKF.mjs → chunk-JFRNNBOM.mjs} +1 -1
- package/dist/{chunk-CHOGQSHK.mjs → chunk-K25LZA54.mjs} +39 -13
- package/dist/chunk-K7D4ZTSW.mjs +126 -0
- package/dist/{chunk-SYWGORQB.mjs → chunk-KV3AZFT3.mjs} +2 -0
- package/dist/chunk-KZ3NX2P7.mjs +21 -0
- package/dist/{chunk-J7SDAOTP.mjs → chunk-L3L5YFXC.mjs} +4 -4
- package/dist/{chunk-Q4UTU5ZE.mjs → chunk-LH4NZNJJ.mjs} +10 -10
- package/dist/{chunk-7KC56574.mjs → chunk-LU2CE5AE.mjs} +1 -1
- package/dist/{chunk-4ZJWRETC.mjs → chunk-LXPIXDUJ.mjs} +2 -2
- package/dist/{chunk-Q5DC6WAB.mjs → chunk-LXWDQLTW.mjs} +1 -1
- package/dist/{chunk-SBCEHIPL.mjs → chunk-MHOSCQCQ.mjs} +4 -4
- package/dist/{chunk-R36MIGBU.mjs → chunk-NKRBEGJZ.mjs} +169 -130
- package/dist/{chunk-L26LEDHO.mjs → chunk-NTRMFARG.mjs} +7 -7
- package/dist/chunk-NW4XDSP2.mjs +212 -0
- package/dist/{chunk-BB7MASRQ.mjs → chunk-OOEXLUGR.mjs} +1 -1
- package/dist/{chunk-3LYY62M6.mjs → chunk-OWNZYMRE.mjs} +10 -10
- package/dist/{chunk-HBVLF3HA.mjs → chunk-PPY2GSIB.mjs} +1 -1
- package/dist/{chunk-WLOF6HSP.mjs → chunk-R7EEKAJE.mjs} +12 -3
- package/dist/{chunk-2GZGBOQI.mjs → chunk-RONEOEON.mjs} +2 -2
- package/dist/{chunk-T2QN2FA4.mjs → chunk-UCDF35PU.mjs} +2 -2
- package/dist/{chunk-JFUE6F2Y.mjs → chunk-VWULPWRJ.mjs} +60 -21
- package/dist/{chunk-F52QGNZ2.mjs → chunk-WCJKUGHB.mjs} +1 -1
- package/dist/{chunk-RUIXODYU.mjs → chunk-YA7XLE2R.mjs} +32 -5
- package/dist/{chunk-MASE2LTJ.mjs → chunk-ZG477IPV.mjs} +7 -7
- package/dist/chunk-ZYNAMIYX.mjs +113 -0
- package/dist/{client-DKwterMb.d.ts → client-i9eLJrw5.d.ts} +3 -3
- package/dist/client.d.ts +9 -9
- package/dist/client.mjs +2 -0
- package/dist/{config-6YBtxekG.d.ts → config-BGB_fDtq.d.ts} +2 -2
- package/dist/{config-DPphZfuM.d.ts → config-P__Diiy4.d.ts} +25 -3
- package/dist/direct-executor-CXZ66ACP.mjs +22 -0
- package/dist/distribution/coordinator/etcd.d.ts +3 -3
- package/dist/distribution/coordinator/etcd.mjs +1 -1
- package/dist/distribution/coordinator/in-memory.d.ts +3 -3
- package/dist/distribution/transport/grpc.mjs +1 -1
- package/dist/distribution.d.ts +24 -12
- package/dist/distribution.mjs +177 -54
- package/dist/{durability-wiring-FRPV6JLZ.mjs → durability-wiring-QTHOGFMZ.mjs} +26 -25
- package/dist/embeddings/openai.d.ts +2 -2
- package/dist/embeddings/openai.mjs +22 -133
- package/dist/{engine-BGt9lI1V.d.ts → engine-BGCEm9E_.d.ts} +50 -20
- package/dist/{index-ONAEaqtx.d.ts → index-lcdGLyJH.d.ts} +1 -1
- package/dist/index.browser.mjs +4 -2
- package/dist/index.d.ts +8 -8
- package/dist/index.mjs +19 -18
- package/dist/invalidation/broadcast-channel.d.ts +1 -1
- package/dist/invalidation/filesystem.d.ts +1 -1
- package/dist/invalidation/noop.d.ts +1 -1
- package/dist/{memory-COdoGthn.d.ts → memory-CUEDwr-F.d.ts} +70 -2
- package/dist/{module-IUTNXWMV.mjs → module-3NONKBZX.mjs} +25 -18
- package/dist/partial-words.mjs +6 -6
- package/dist/pattern.mjs +3 -3
- package/dist/persistence/durability/checkpoint-worker.d.ts +2 -2
- package/dist/persistence/durability/checkpoint-worker.mjs +23 -22
- package/dist/react.d.ts +8 -8
- package/dist/react.mjs +2 -0
- package/dist/rerank-NWTKK636.mjs +60 -0
- package/dist/rerankers/http.d.ts +50 -0
- package/dist/rerankers/http.mjs +104 -0
- package/dist/{restore-queue-I5SI6AUQ.mjs → restore-queue-JPRBUYII.mjs} +1 -1
- package/dist/runtime-ZKYZFJJC.mjs +177 -0
- package/dist/{schema-DttzM-ln.d.ts → schema-4W_7tk1f.d.ts} +2 -2
- package/dist/server.d.ts +11 -11
- package/dist/server.mjs +63 -22
- package/dist/{snapshot-YC6TS4OP.mjs → snapshot-HOGXNO5W.mjs} +138 -83
- package/dist/synonyms.mjs +3 -3
- package/dist/{tasks-BJmamiC4.d.ts → tasks-HG3rlxx6.d.ts} +1 -1
- package/dist/{thread-U7XYJWGG.mjs → thread-B657LQXK.mjs} +49 -30
- package/dist/vector/search-worker.d.ts +6 -2
- package/dist/vector/search-worker.mjs +9 -7
- package/dist/workers/entry.mjs +5 -5
- package/dist/{write-M2OALSA4.mjs → write-XLIGTXBU.mjs} +21 -20
- package/package.json +11 -7
- package/dist/direct-executor-5KJGVQHM.mjs +0 -22
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
import { loadUWebSockets, childAppOf, createRouteRunner, corsHeaderReader, createSharedRequestGate, registerServerRoutes, sendRelayed, createDocumentReadHandlers, respondJson, SERVER_CAPABILITIES, versionReport, statusLine, sendError, serverRoutes, parseJson, validateSuggest, rejectInvalid, respondError, validateQuery, refuseRegex, awaitDepartureConfirmation, departureConfirmation, REQUEST_THREAD_DEPARTURE_DRAIN_MS, departureConfirmed, encodeJson } from './chunk-
|
|
1
|
+
import { loadUWebSockets, childAppOf, createRouteRunner, corsHeaderReader, createSharedRequestGate, registerServerRoutes, sendRelayed, createDocumentReadHandlers, respondJson, SERVER_CAPABILITIES, versionReport, statusLine, sendError, serverRoutes, parseJson, validateSuggest, rejectInvalid, respondError, validateQuery, refuseRegex, withServerRerankWindow, awaitDepartureConfirmation, departureConfirmation, REQUEST_THREAD_DEPARTURE_DRAIN_MS, departureConfirmed, encodeJson } from './chunk-YA7XLE2R.mjs';
|
|
2
|
+
import { withRerankQueryText } from './chunk-KZ3NX2P7.mjs';
|
|
2
3
|
import './chunk-DJHHF2L5.mjs';
|
|
3
|
-
import { executeListDocuments, executeSuggest, executePreflight, queryBindingOf, executeQuery } from './chunk-
|
|
4
|
-
import { resolveProjection, projectionKeepsField, setNestedValue } from './chunk-
|
|
5
|
-
import './chunk-
|
|
4
|
+
import { executeListDocuments, executeSuggest, executePreflight, queryBindingOf, executeQuery } from './chunk-NKRBEGJZ.mjs';
|
|
5
|
+
import { resolveProjection, projectionKeepsField, setNestedValue } from './chunk-K25LZA54.mjs';
|
|
6
|
+
import './chunk-HJSN7UYG.mjs';
|
|
7
|
+
import './chunk-LXWDQLTW.mjs';
|
|
6
8
|
import './chunk-QY7GC2MW.mjs';
|
|
7
|
-
import './chunk-
|
|
8
|
-
import './chunk-
|
|
9
|
+
import './chunk-GGSH6KBQ.mjs';
|
|
10
|
+
import './chunk-ASY5PHYI.mjs';
|
|
9
11
|
import './chunk-WQBCBKY3.mjs';
|
|
10
|
-
import './chunk-
|
|
11
|
-
import { extractVectorFieldsFromSchema } from './chunk-
|
|
12
|
-
import './chunk-
|
|
12
|
+
import './chunk-MHOSCQCQ.mjs';
|
|
13
|
+
import { extractVectorFieldsFromSchema } from './chunk-LXPIXDUJ.mjs';
|
|
14
|
+
import './chunk-E74YLAIG.mjs';
|
|
13
15
|
import './chunk-KEHK2O6P.mjs';
|
|
14
16
|
import './chunk-GES7U2PM.mjs';
|
|
15
|
-
import './chunk-
|
|
17
|
+
import './chunk-OOEXLUGR.mjs';
|
|
16
18
|
import './chunk-X5CV2E2B.mjs';
|
|
17
|
-
import './chunk-
|
|
19
|
+
import './chunk-LU2CE5AE.mjs';
|
|
18
20
|
import './chunk-R6A773WK.mjs';
|
|
19
21
|
import './chunk-YTJCGKM4.mjs';
|
|
20
22
|
import './chunk-L5ORED7V.mjs';
|
|
21
|
-
import { ServerErrorCodes, ErrorCodes, NarsilError, isNarsilError } from './chunk-
|
|
23
|
+
import { ServerErrorCodes, ErrorCodes, NarsilError, isNarsilError } from './chunk-KV3AZFT3.mjs';
|
|
22
24
|
|
|
23
25
|
// src/server/request-threads/held-vectors.ts
|
|
24
26
|
function managerWithHeldVectors(manager, fieldPaths, vectorOf) {
|
|
@@ -40,7 +42,7 @@ function managerWithHeldVectors(manager, fieldPaths, vectorOf) {
|
|
|
40
42
|
|
|
41
43
|
// src/server/request-threads/read-engine.ts
|
|
42
44
|
function createThreadReadEngine(options) {
|
|
43
|
-
const { executor, relay, searchHooks, patternWorkCap } = options;
|
|
45
|
+
const { executor, relay, searchHooks, patternWorkCap, maxRerankWindow } = options;
|
|
44
46
|
function vectorFieldsOf(context) {
|
|
45
47
|
return [...extractVectorFieldsFromSchema(context.config.schema).keys()];
|
|
46
48
|
}
|
|
@@ -85,7 +87,15 @@ function createThreadReadEngine(options) {
|
|
|
85
87
|
const context = requireAnswerable(indexName, wholeDocumentsContext(indexName));
|
|
86
88
|
return { context, manager: managerOf(indexName, context) };
|
|
87
89
|
}
|
|
88
|
-
|
|
90
|
+
function rerankRunnerFor(params) {
|
|
91
|
+
if (params.rerank === void 0) return void 0;
|
|
92
|
+
return {
|
|
93
|
+
maxWindow: maxRerankWindow,
|
|
94
|
+
score: (adapter, query, documents) => relay.rerank(adapter, query, documents)
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
async function resolvedParams(indexName, request) {
|
|
98
|
+
const params = withRerankQueryText(request);
|
|
89
99
|
if (params.vector?.text === void 0) return params;
|
|
90
100
|
const value = await relay.embed(indexName, params.vector);
|
|
91
101
|
const { text: _text, ...vector } = params.vector;
|
|
@@ -120,7 +130,8 @@ function createThreadReadEngine(options) {
|
|
|
120
130
|
indexName,
|
|
121
131
|
cursorBinding: queryBindingOf(params),
|
|
122
132
|
vectorSearchers: context.vectorSearchers,
|
|
123
|
-
patternWorkCap
|
|
133
|
+
patternWorkCap,
|
|
134
|
+
rerank: rerankRunnerFor(params)
|
|
124
135
|
});
|
|
125
136
|
if (context.analysisStale) result.analysisStale = true;
|
|
126
137
|
return result;
|
|
@@ -180,7 +191,7 @@ function createThreadReadEngine(options) {
|
|
|
180
191
|
function isRelayReply(message) {
|
|
181
192
|
if (typeof message !== "object" || message === null) return false;
|
|
182
193
|
const { type, requestId } = message;
|
|
183
|
-
return typeof requestId === "number" && (type === "response" || type === "authorized" || type === "embedded");
|
|
194
|
+
return typeof requestId === "number" && (type === "response" || type === "authorized" || type === "embedded" || type === "reranked");
|
|
184
195
|
}
|
|
185
196
|
function isStreamPart(message) {
|
|
186
197
|
if (typeof message !== "object" || message === null) return false;
|
|
@@ -222,9 +233,8 @@ function writeStreamPart(port, writer, part) {
|
|
|
222
233
|
return true;
|
|
223
234
|
});
|
|
224
235
|
}
|
|
225
|
-
function
|
|
226
|
-
|
|
227
|
-
return new NarsilError(error.code, error.message, error.details);
|
|
236
|
+
function relayedErrorOf(error, fallback) {
|
|
237
|
+
return error === null ? fallback : new NarsilError(error.code, error.message, error.details);
|
|
228
238
|
}
|
|
229
239
|
function portClosedError() {
|
|
230
240
|
return new NarsilError(ErrorCodes.WORKER_CRASHED, "The port to the main thread closed before it answered");
|
|
@@ -334,10 +344,19 @@ function createRelayClient(port, touchIntervalMs) {
|
|
|
334
344
|
},
|
|
335
345
|
async embed(indexName, vector) {
|
|
336
346
|
const reply = await send((requestId) => ({ type: "embed", requestId, indexName, vector }));
|
|
337
|
-
if (reply.type
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
347
|
+
if (reply.type === "embedded" && reply.value !== null) return reply.value;
|
|
348
|
+
throw relayedErrorOf(
|
|
349
|
+
reply.type === "embedded" ? reply.error : null,
|
|
350
|
+
new NarsilError(ErrorCodes.EMBEDDING_FAILED, "The main thread returned no vector")
|
|
351
|
+
);
|
|
352
|
+
},
|
|
353
|
+
async rerank(adapter, query, documents) {
|
|
354
|
+
const reply = await send((requestId) => ({ type: "rerank", requestId, adapter, query, documents }));
|
|
355
|
+
if (reply.type === "reranked" && reply.scores !== null) return reply.scores;
|
|
356
|
+
throw relayedErrorOf(
|
|
357
|
+
reply.type === "reranked" ? reply.error : null,
|
|
358
|
+
new NarsilError(ErrorCodes.RERANK_FAILED, "The main thread returned no scores")
|
|
359
|
+
);
|
|
341
360
|
},
|
|
342
361
|
touch(indexName) {
|
|
343
362
|
if (closed) return;
|
|
@@ -547,11 +566,11 @@ function mainThreadAnswersInstead(err) {
|
|
|
547
566
|
return isNarsilError(err) && err.code === ErrorCodes.WORKER_BUSY;
|
|
548
567
|
}
|
|
549
568
|
function searchHandler(options) {
|
|
550
|
-
const { fallback,
|
|
569
|
+
const { fallback, limits, allowRegex, staysOnThread, answer } = options;
|
|
551
570
|
return async (ctx) => {
|
|
552
571
|
const params = parseJson(ctx);
|
|
553
572
|
if (!params) return;
|
|
554
|
-
const failure = validateQuery(params,
|
|
573
|
+
const failure = validateQuery(params, limits);
|
|
555
574
|
if (failure) {
|
|
556
575
|
rejectInvalid(ctx, failure);
|
|
557
576
|
return;
|
|
@@ -562,7 +581,7 @@ function searchHandler(options) {
|
|
|
562
581
|
return;
|
|
563
582
|
}
|
|
564
583
|
try {
|
|
565
|
-
respondJson(ctx, await answer(ctx.params[0], params));
|
|
584
|
+
respondJson(ctx, await answer(ctx.params[0], withServerRerankWindow(params, limits)));
|
|
566
585
|
} catch (err) {
|
|
567
586
|
if (staysOnThread(ctx.params[0], params) && !mainThreadAnswersInstead(err)) respondError(ctx, err);
|
|
568
587
|
else await fallback(ctx);
|
|
@@ -604,7 +623,6 @@ function threadHandlers(local, relay, settings) {
|
|
|
604
623
|
const { allowRegex } = settings;
|
|
605
624
|
const reads = createDocumentReadHandlers({ engine: local, limits: settings.limits, allowRegex });
|
|
606
625
|
const forwarded = relayedHandlers(relay, settings.limits);
|
|
607
|
-
const { maxResultWindow } = settings.limits;
|
|
608
626
|
return {
|
|
609
627
|
...forwarded,
|
|
610
628
|
livez: (ctx) => respondJson(ctx, { status: "ok" }),
|
|
@@ -612,14 +630,14 @@ function threadHandlers(local, relay, settings) {
|
|
|
612
630
|
capabilities: (ctx) => respondJson(ctx, { capabilities: [...SERVER_CAPABILITIES] }),
|
|
613
631
|
search: searchHandler({
|
|
614
632
|
fallback: forwarded.search,
|
|
615
|
-
|
|
633
|
+
limits: settings.limits,
|
|
616
634
|
allowRegex,
|
|
617
635
|
staysOnThread: (name, params) => local.canAnswer(name, params),
|
|
618
636
|
answer: (name, params) => local.query(name, params)
|
|
619
637
|
}),
|
|
620
638
|
preflight: searchHandler({
|
|
621
639
|
fallback: forwarded.preflight,
|
|
622
|
-
|
|
640
|
+
limits: settings.limits,
|
|
623
641
|
allowRegex,
|
|
624
642
|
staysOnThread: (name, params) => local.canCount(name, params),
|
|
625
643
|
answer: (name, params) => local.preflight(name, params)
|
|
@@ -648,7 +666,8 @@ async function serveRequests(executor, settings) {
|
|
|
648
666
|
executor: departure.guardExecutor(executor),
|
|
649
667
|
relay,
|
|
650
668
|
searchHooks: settings.searchHooks,
|
|
651
|
-
patternWorkCap: settings.patternWorkCap
|
|
669
|
+
patternWorkCap: settings.patternWorkCap,
|
|
670
|
+
maxRerankWindow: settings.maxRerankWindow
|
|
652
671
|
});
|
|
653
672
|
const run = createRouteRunner({
|
|
654
673
|
authorize: settings.authorizes ? (context) => relay.authorize(context) : void 0,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { e as VectorQuantizationMode } from '../schema-
|
|
2
|
-
import '../adapters-
|
|
1
|
+
import { e as VectorQuantizationMode } from '../schema-4W_7tk1f.js';
|
|
2
|
+
import '../adapters-BQFQ4PRz.js';
|
|
3
3
|
import '../synonyms-CpOAHPa-.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -461,6 +461,8 @@ interface VectorSearchRequest {
|
|
|
461
461
|
efSearch?: number;
|
|
462
462
|
/** The worker re-scores this many times the requested count against full precision, or its own default when absent. */
|
|
463
463
|
oversample?: number;
|
|
464
|
+
/** When present, the worker re-scores only this many times the oversample of the nearest candidates against full precision and keeps the estimated score of the rest, or returns the re-scored candidates alone under a similarity floor. */
|
|
465
|
+
rescoreWindow?: number;
|
|
464
466
|
}
|
|
465
467
|
/**
|
|
466
468
|
* Asks the search worker to answer one nearest-neighbour query from a shared
|
|
@@ -489,6 +491,8 @@ interface VectorOrdinalSearchRequest {
|
|
|
489
491
|
efSearch?: number;
|
|
490
492
|
/** The worker re-scores this many times the requested count against full precision, or its own default when absent. */
|
|
491
493
|
oversample?: number;
|
|
494
|
+
/** When present, the worker re-scores only this many times the oversample of the nearest candidates against full precision and keeps the estimated score of the rest, or returns the re-scored candidates alone under a similarity floor. */
|
|
495
|
+
rescoreWindow?: number;
|
|
492
496
|
}
|
|
493
497
|
/**
|
|
494
498
|
* Every message the engine posts to the search worker.
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { openSharedVectorField, createVectorStore } from '../chunk-
|
|
2
|
-
import { osqBitsOf, createHNSWIndex, createOsqQuantizer } from '../chunk-
|
|
3
|
-
import { osqRecordBytes } from '../chunk-37CD3OKS.mjs';
|
|
1
|
+
import { openSharedVectorField, createVectorStore } from '../chunk-UCDF35PU.mjs';
|
|
2
|
+
import { osqBitsOf, createHNSWIndex, createOsqQuantizer } from '../chunk-HXJBSHXF.mjs';
|
|
4
3
|
import '../chunk-DJHHF2L5.mjs';
|
|
4
|
+
import { osqRecordBytes } from '../chunk-37CD3OKS.mjs';
|
|
5
5
|
import '../chunk-KOKM4PQN.mjs';
|
|
6
6
|
import { MAX_WORKER_COPIES } from '../chunk-QY7GC2MW.mjs';
|
|
7
|
-
import '../chunk-
|
|
7
|
+
import '../chunk-GGSH6KBQ.mjs';
|
|
8
8
|
import '../chunk-KEHK2O6P.mjs';
|
|
9
9
|
import '../chunk-R6A773WK.mjs';
|
|
10
10
|
import '../chunk-YTJCGKM4.mjs';
|
|
11
|
-
import '../chunk-
|
|
11
|
+
import '../chunk-KV3AZFT3.mjs';
|
|
12
12
|
|
|
13
13
|
// src/vector/worker-copy.ts
|
|
14
14
|
function restoreQuantizer(snapshot, store) {
|
|
@@ -101,7 +101,8 @@ function handleSearch(request) {
|
|
|
101
101
|
const hits = entry.copy.graph.search(request.query, request.k, request.metric, request.minSimilarity, {
|
|
102
102
|
filter: request.filter,
|
|
103
103
|
efSearch: request.efSearch,
|
|
104
|
-
oversample: request.oversample
|
|
104
|
+
oversample: request.oversample,
|
|
105
|
+
rescoreWindow: request.rescoreWindow
|
|
105
106
|
});
|
|
106
107
|
const docIds = [];
|
|
107
108
|
const scores = new Float64Array(hits.length);
|
|
@@ -122,7 +123,8 @@ function handleSearchOrdinals(request) {
|
|
|
122
123
|
const hits = entry.view.searchOrdinals(request.query, request.k, request.metric, request.minSimilarity, {
|
|
123
124
|
filter: request.filter,
|
|
124
125
|
efSearch: request.efSearch,
|
|
125
|
-
oversample: request.oversample
|
|
126
|
+
oversample: request.oversample,
|
|
127
|
+
rescoreWindow: request.rescoreWindow
|
|
126
128
|
});
|
|
127
129
|
const ordinals = new Uint32Array(hits.length);
|
|
128
130
|
const scores = new Float64Array(hits.length);
|
package/dist/workers/entry.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { startIdleHeapCleanup } from '../chunk-5XNIRLFC.mjs';
|
|
2
2
|
import { threadSlotOfWorker, isValidWorkerAction } from '../chunk-R6PR4WYZ.mjs';
|
|
3
|
-
import { loadVectorCode } from '../chunk-
|
|
3
|
+
import { loadVectorCode } from '../chunk-PPY2GSIB.mjs';
|
|
4
4
|
import '../chunk-L5ORED7V.mjs';
|
|
5
|
-
import { ErrorCodes, NarsilError, isNarsilError } from '../chunk-
|
|
5
|
+
import { ErrorCodes, NarsilError, isNarsilError } from '../chunk-KV3AZFT3.mjs';
|
|
6
6
|
|
|
7
7
|
// src/workers/action-handler.ts
|
|
8
8
|
function buildErrorResponse(requestId, code, message, details) {
|
|
@@ -20,7 +20,7 @@ async function importBootstrapModule(moduleUrl) {
|
|
|
20
20
|
await import(moduleUrl);
|
|
21
21
|
}
|
|
22
22
|
async function stopServingRequests() {
|
|
23
|
-
const { closeRequestThread } = await import('../thread-
|
|
23
|
+
const { closeRequestThread } = await import('../thread-B657LQXK.mjs');
|
|
24
24
|
closeRequestThread();
|
|
25
25
|
}
|
|
26
26
|
function holdsCopies(executor) {
|
|
@@ -51,7 +51,7 @@ function createActionHandler(executor) {
|
|
|
51
51
|
if (!holdsCopies(executor)) {
|
|
52
52
|
throw new NarsilError(ErrorCodes.CONFIG_INVALID, "This executor holds no copies to answer requests from");
|
|
53
53
|
}
|
|
54
|
-
const starting = import('../thread-
|
|
54
|
+
const starting = import('../thread-B657LQXK.mjs').then(
|
|
55
55
|
({ serveRequests }) => serveRequests(executor, action.settings)
|
|
56
56
|
);
|
|
57
57
|
serving.start = starting.then(
|
|
@@ -104,7 +104,7 @@ async function setup() {
|
|
|
104
104
|
} catch {
|
|
105
105
|
parentPort = null;
|
|
106
106
|
}
|
|
107
|
-
const [{ createDirectExecutor }] = await Promise.all([import('../direct-executor-
|
|
107
|
+
const [{ createDirectExecutor }] = await Promise.all([import('../direct-executor-CXZ66ACP.mjs'), loadVectorCode()]);
|
|
108
108
|
const handleAction = createActionHandler(createDirectExecutor({ threadSlot }));
|
|
109
109
|
if (parentPort) {
|
|
110
110
|
const port = parentPort;
|
|
@@ -1,38 +1,39 @@
|
|
|
1
|
-
import { decodeVectorFilePayload, isDead, bytesToVectors } from './chunk-
|
|
1
|
+
import { decodeVectorFilePayload, isDead, bytesToVectors } from './chunk-WCJKUGHB.mjs';
|
|
2
2
|
import './chunk-37CD3OKS.mjs';
|
|
3
|
-
import { setNestedValue, KEYWORD_SEGMENT_ENVELOPE_VERSION, decodeKeywordSegment } from './chunk-
|
|
4
|
-
import { openChecksummedEnvelope, NUMBER_TAG, DATE_TAG, BYTES_TAG, encodeBase64, startsWithTagPrefix, OBJECT_TAG, MILLISECONDS_PER_SECOND, NANOSECONDS_PER_MILLISECOND, DOCUMENT_EXPORT_VERSION, DOCUMENT_EXPORT_FORMAT } from './chunk-
|
|
5
|
-
import './chunk-
|
|
6
|
-
import './chunk-
|
|
7
|
-
import
|
|
8
|
-
import './chunk-CHOGQSHK.mjs';
|
|
9
|
-
import './chunk-WLOF6HSP.mjs';
|
|
3
|
+
import { setNestedValue, KEYWORD_SEGMENT_ENVELOPE_VERSION, decodeKeywordSegment } from './chunk-L3L5YFXC.mjs';
|
|
4
|
+
import { openChecksummedEnvelope, NUMBER_TAG, DATE_TAG, BYTES_TAG, encodeBase64, startsWithTagPrefix, OBJECT_TAG, MILLISECONDS_PER_SECOND, NANOSECONDS_PER_MILLISECOND, DOCUMENT_EXPORT_VERSION, DOCUMENT_EXPORT_FORMAT } from './chunk-VWULPWRJ.mjs';
|
|
5
|
+
import './chunk-NKRBEGJZ.mjs';
|
|
6
|
+
import './chunk-R7EEKAJE.mjs';
|
|
7
|
+
import './chunk-AY3AQ3UH.mjs';
|
|
10
8
|
import './chunk-AV4IJKD2.mjs';
|
|
11
|
-
import {
|
|
12
|
-
import './chunk-
|
|
9
|
+
import { decodeStoredDocument } from './chunk-OWNZYMRE.mjs';
|
|
10
|
+
import './chunk-K25LZA54.mjs';
|
|
11
|
+
import './chunk-JFRNNBOM.mjs';
|
|
12
|
+
import './chunk-HJSN7UYG.mjs';
|
|
13
|
+
import { EXPORT_CHUNK_BYTES } from './chunk-LXWDQLTW.mjs';
|
|
13
14
|
import './chunk-TGP5M5R7.mjs';
|
|
14
15
|
import './chunk-U2BKYEC7.mjs';
|
|
15
16
|
import './chunk-KOKM4PQN.mjs';
|
|
16
17
|
import './chunk-QY7GC2MW.mjs';
|
|
17
|
-
import './chunk-
|
|
18
|
-
import './chunk-
|
|
18
|
+
import './chunk-GGSH6KBQ.mjs';
|
|
19
|
+
import './chunk-ASY5PHYI.mjs';
|
|
19
20
|
import './chunk-WQBCBKY3.mjs';
|
|
20
|
-
import './chunk-
|
|
21
|
-
import './chunk-
|
|
22
|
-
import './chunk-
|
|
21
|
+
import './chunk-MHOSCQCQ.mjs';
|
|
22
|
+
import './chunk-LXPIXDUJ.mjs';
|
|
23
|
+
import './chunk-E74YLAIG.mjs';
|
|
23
24
|
import './chunk-KEHK2O6P.mjs';
|
|
24
25
|
import './chunk-GES7U2PM.mjs';
|
|
25
|
-
import './chunk-
|
|
26
|
-
import './chunk-
|
|
26
|
+
import './chunk-OOEXLUGR.mjs';
|
|
27
|
+
import './chunk-RONEOEON.mjs';
|
|
27
28
|
import './chunk-X5CV2E2B.mjs';
|
|
28
29
|
import './chunk-7X5JST5L.mjs';
|
|
29
|
-
import './chunk-
|
|
30
|
+
import './chunk-LU2CE5AE.mjs';
|
|
30
31
|
import './chunk-R6A773WK.mjs';
|
|
31
32
|
import './chunk-YTJCGKM4.mjs';
|
|
32
33
|
import './chunk-R6PR4WYZ.mjs';
|
|
33
|
-
import './chunk-
|
|
34
|
+
import './chunk-PPY2GSIB.mjs';
|
|
34
35
|
import './chunk-L5ORED7V.mjs';
|
|
35
|
-
import { NarsilError, ErrorCodes } from './chunk-
|
|
36
|
+
import { NarsilError, ErrorCodes } from './chunk-KV3AZFT3.mjs';
|
|
36
37
|
import { decode } from '@msgpack/msgpack';
|
|
37
38
|
|
|
38
39
|
// src/engine/export/json-line.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@delali/narsil",
|
|
3
|
-
"version": "0.3.1-next.
|
|
3
|
+
"version": "0.3.1-next.97",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Distributed search engine with full-text, vector, hybrid, and geosearch. One engine, embedded or on a server, with a cross-language .nrsl format.",
|
|
6
6
|
"author": "Delali (https://sondelali.com)",
|
|
@@ -157,6 +157,10 @@
|
|
|
157
157
|
"import": "./dist/embeddings/openai.mjs",
|
|
158
158
|
"types": "./dist/embeddings/openai.d.ts"
|
|
159
159
|
},
|
|
160
|
+
"./rerankers/http": {
|
|
161
|
+
"import": "./dist/rerankers/http.mjs",
|
|
162
|
+
"types": "./dist/rerankers/http.d.ts"
|
|
163
|
+
},
|
|
160
164
|
"./pattern": {
|
|
161
165
|
"import": "./dist/pattern.mjs",
|
|
162
166
|
"types": "./dist/pattern.d.ts"
|
|
@@ -263,11 +267,11 @@
|
|
|
263
267
|
}
|
|
264
268
|
},
|
|
265
269
|
"optionalDependencies": {
|
|
266
|
-
"@delali/narsil-native-darwin-arm64": "0.3.1-next.
|
|
267
|
-
"@delali/narsil-native-darwin-x64": "0.3.1-next.
|
|
268
|
-
"@delali/narsil-native-linux-arm64": "0.3.1-next.
|
|
269
|
-
"@delali/narsil-native-linux-x64": "0.3.1-next.
|
|
270
|
-
"@delali/narsil-native-win32-arm64": "0.3.1-next.
|
|
271
|
-
"@delali/narsil-native-win32-x64": "0.3.1-next.
|
|
270
|
+
"@delali/narsil-native-darwin-arm64": "0.3.1-next.97",
|
|
271
|
+
"@delali/narsil-native-darwin-x64": "0.3.1-next.97",
|
|
272
|
+
"@delali/narsil-native-linux-arm64": "0.3.1-next.97",
|
|
273
|
+
"@delali/narsil-native-linux-x64": "0.3.1-next.97",
|
|
274
|
+
"@delali/narsil-native-win32-arm64": "0.3.1-next.97",
|
|
275
|
+
"@delali/narsil-native-win32-x64": "0.3.1-next.97"
|
|
272
276
|
}
|
|
273
277
|
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export { createDirectExecutor } from './chunk-3LYY62M6.mjs';
|
|
2
|
-
import './chunk-CHOGQSHK.mjs';
|
|
3
|
-
import './chunk-ZHS44YKF.mjs';
|
|
4
|
-
import './chunk-TGP5M5R7.mjs';
|
|
5
|
-
import './chunk-U2BKYEC7.mjs';
|
|
6
|
-
import './chunk-QM3VPX4Z.mjs';
|
|
7
|
-
import './chunk-WQBCBKY3.mjs';
|
|
8
|
-
import './chunk-SBCEHIPL.mjs';
|
|
9
|
-
import './chunk-4ZJWRETC.mjs';
|
|
10
|
-
import './chunk-FGMGUDHX.mjs';
|
|
11
|
-
import './chunk-KEHK2O6P.mjs';
|
|
12
|
-
import './chunk-GES7U2PM.mjs';
|
|
13
|
-
import './chunk-BB7MASRQ.mjs';
|
|
14
|
-
import './chunk-2GZGBOQI.mjs';
|
|
15
|
-
import './chunk-X5CV2E2B.mjs';
|
|
16
|
-
import './chunk-7X5JST5L.mjs';
|
|
17
|
-
import './chunk-7KC56574.mjs';
|
|
18
|
-
import './chunk-R6A773WK.mjs';
|
|
19
|
-
import './chunk-YTJCGKM4.mjs';
|
|
20
|
-
import './chunk-HBVLF3HA.mjs';
|
|
21
|
-
import './chunk-L5ORED7V.mjs';
|
|
22
|
-
import './chunk-SYWGORQB.mjs';
|