searchsocket 0.3.2 → 0.3.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.
- package/dist/cli.js +14 -6
- package/dist/index.cjs +13 -5
- package/dist/index.js +13 -5
- package/dist/sveltekit.cjs +13 -5
- package/dist/sveltekit.js +13 -5
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -12,7 +12,7 @@ import { Command } from "commander";
|
|
|
12
12
|
// package.json
|
|
13
13
|
var package_default = {
|
|
14
14
|
name: "searchsocket",
|
|
15
|
-
version: "0.3.
|
|
15
|
+
version: "0.3.3",
|
|
16
16
|
description: "Semantic site search and MCP retrieval for SvelteKit static sites",
|
|
17
17
|
license: "MIT",
|
|
18
18
|
author: "Greg Priday <greg@siteorigin.com>",
|
|
@@ -2854,7 +2854,7 @@ var JinaReranker = class {
|
|
|
2854
2854
|
constructor(options) {
|
|
2855
2855
|
this.apiKey = options.apiKey;
|
|
2856
2856
|
this.model = options.model;
|
|
2857
|
-
this.maxRetries = options.maxRetries ??
|
|
2857
|
+
this.maxRetries = options.maxRetries ?? 2;
|
|
2858
2858
|
}
|
|
2859
2859
|
async rerank(query, candidates, topN) {
|
|
2860
2860
|
if (candidates.length === 0) {
|
|
@@ -2864,7 +2864,8 @@ var JinaReranker = class {
|
|
|
2864
2864
|
model: this.model,
|
|
2865
2865
|
query,
|
|
2866
2866
|
documents: candidates.map((candidate) => candidate.text),
|
|
2867
|
-
top_n: topN ?? candidates.length
|
|
2867
|
+
top_n: topN ?? candidates.length,
|
|
2868
|
+
return_documents: false
|
|
2868
2869
|
};
|
|
2869
2870
|
let attempt = 0;
|
|
2870
2871
|
while (attempt <= this.maxRetries) {
|
|
@@ -3236,6 +3237,7 @@ var SearchEngine = class _SearchEngine {
|
|
|
3236
3237
|
const MAX_CHUNKS_PER_PAGE = 5;
|
|
3237
3238
|
const MIN_CHUNKS_PER_PAGE = 1;
|
|
3238
3239
|
const MIN_CHUNK_SCORE_RATIO = 0.5;
|
|
3240
|
+
const MAX_DOC_CHARS = 2e3;
|
|
3239
3241
|
const pageCandidates = [];
|
|
3240
3242
|
for (const [url, chunks] of pageGroups) {
|
|
3241
3243
|
const byScore = [...chunks].sort((a, b) => b.finalScore - a.finalScore);
|
|
@@ -3255,12 +3257,18 @@ var SearchEngine = class _SearchEngine {
|
|
|
3255
3257
|
}
|
|
3256
3258
|
const body = selected.map((c) => c.hit.metadata.chunkText || c.hit.metadata.snippet).join("\n\n");
|
|
3257
3259
|
parts.push(body);
|
|
3258
|
-
|
|
3260
|
+
let text = parts.join("\n\n");
|
|
3261
|
+
if (text.length > MAX_DOC_CHARS) {
|
|
3262
|
+
text = text.slice(0, MAX_DOC_CHARS);
|
|
3263
|
+
}
|
|
3264
|
+
pageCandidates.push({ id: url, text });
|
|
3259
3265
|
}
|
|
3266
|
+
const maxCandidates = Math.max(topK, this.config.rerank.topN);
|
|
3267
|
+
const cappedCandidates = pageCandidates.slice(0, maxCandidates);
|
|
3260
3268
|
const reranked = await this.reranker.rerank(
|
|
3261
3269
|
query,
|
|
3262
|
-
|
|
3263
|
-
|
|
3270
|
+
cappedCandidates,
|
|
3271
|
+
maxCandidates
|
|
3264
3272
|
);
|
|
3265
3273
|
const scoreByUrl = new Map(reranked.map((e) => [e.id, e.score]));
|
|
3266
3274
|
return ranked.map((entry) => {
|
package/dist/index.cjs
CHANGED
|
@@ -17273,7 +17273,7 @@ var JinaReranker = class {
|
|
|
17273
17273
|
constructor(options) {
|
|
17274
17274
|
this.apiKey = options.apiKey;
|
|
17275
17275
|
this.model = options.model;
|
|
17276
|
-
this.maxRetries = options.maxRetries ??
|
|
17276
|
+
this.maxRetries = options.maxRetries ?? 2;
|
|
17277
17277
|
}
|
|
17278
17278
|
async rerank(query, candidates, topN) {
|
|
17279
17279
|
if (candidates.length === 0) {
|
|
@@ -17283,7 +17283,8 @@ var JinaReranker = class {
|
|
|
17283
17283
|
model: this.model,
|
|
17284
17284
|
query,
|
|
17285
17285
|
documents: candidates.map((candidate) => candidate.text),
|
|
17286
|
-
top_n: topN ?? candidates.length
|
|
17286
|
+
top_n: topN ?? candidates.length,
|
|
17287
|
+
return_documents: false
|
|
17287
17288
|
};
|
|
17288
17289
|
let attempt = 0;
|
|
17289
17290
|
while (attempt <= this.maxRetries) {
|
|
@@ -20505,6 +20506,7 @@ var SearchEngine = class _SearchEngine {
|
|
|
20505
20506
|
const MAX_CHUNKS_PER_PAGE = 5;
|
|
20506
20507
|
const MIN_CHUNKS_PER_PAGE = 1;
|
|
20507
20508
|
const MIN_CHUNK_SCORE_RATIO = 0.5;
|
|
20509
|
+
const MAX_DOC_CHARS = 2e3;
|
|
20508
20510
|
const pageCandidates = [];
|
|
20509
20511
|
for (const [url, chunks] of pageGroups) {
|
|
20510
20512
|
const byScore = [...chunks].sort((a, b) => b.finalScore - a.finalScore);
|
|
@@ -20524,12 +20526,18 @@ var SearchEngine = class _SearchEngine {
|
|
|
20524
20526
|
}
|
|
20525
20527
|
const body = selected.map((c) => c.hit.metadata.chunkText || c.hit.metadata.snippet).join("\n\n");
|
|
20526
20528
|
parts.push(body);
|
|
20527
|
-
|
|
20529
|
+
let text = parts.join("\n\n");
|
|
20530
|
+
if (text.length > MAX_DOC_CHARS) {
|
|
20531
|
+
text = text.slice(0, MAX_DOC_CHARS);
|
|
20532
|
+
}
|
|
20533
|
+
pageCandidates.push({ id: url, text });
|
|
20528
20534
|
}
|
|
20535
|
+
const maxCandidates = Math.max(topK, this.config.rerank.topN);
|
|
20536
|
+
const cappedCandidates = pageCandidates.slice(0, maxCandidates);
|
|
20529
20537
|
const reranked = await this.reranker.rerank(
|
|
20530
20538
|
query,
|
|
20531
|
-
|
|
20532
|
-
|
|
20539
|
+
cappedCandidates,
|
|
20540
|
+
maxCandidates
|
|
20533
20541
|
);
|
|
20534
20542
|
const scoreByUrl = new Map(reranked.map((e) => [e.id, e.score]));
|
|
20535
20543
|
return ranked.map((entry) => {
|
package/dist/index.js
CHANGED
|
@@ -17261,7 +17261,7 @@ var JinaReranker = class {
|
|
|
17261
17261
|
constructor(options) {
|
|
17262
17262
|
this.apiKey = options.apiKey;
|
|
17263
17263
|
this.model = options.model;
|
|
17264
|
-
this.maxRetries = options.maxRetries ??
|
|
17264
|
+
this.maxRetries = options.maxRetries ?? 2;
|
|
17265
17265
|
}
|
|
17266
17266
|
async rerank(query, candidates, topN) {
|
|
17267
17267
|
if (candidates.length === 0) {
|
|
@@ -17271,7 +17271,8 @@ var JinaReranker = class {
|
|
|
17271
17271
|
model: this.model,
|
|
17272
17272
|
query,
|
|
17273
17273
|
documents: candidates.map((candidate) => candidate.text),
|
|
17274
|
-
top_n: topN ?? candidates.length
|
|
17274
|
+
top_n: topN ?? candidates.length,
|
|
17275
|
+
return_documents: false
|
|
17275
17276
|
};
|
|
17276
17277
|
let attempt = 0;
|
|
17277
17278
|
while (attempt <= this.maxRetries) {
|
|
@@ -20493,6 +20494,7 @@ var SearchEngine = class _SearchEngine {
|
|
|
20493
20494
|
const MAX_CHUNKS_PER_PAGE = 5;
|
|
20494
20495
|
const MIN_CHUNKS_PER_PAGE = 1;
|
|
20495
20496
|
const MIN_CHUNK_SCORE_RATIO = 0.5;
|
|
20497
|
+
const MAX_DOC_CHARS = 2e3;
|
|
20496
20498
|
const pageCandidates = [];
|
|
20497
20499
|
for (const [url, chunks] of pageGroups) {
|
|
20498
20500
|
const byScore = [...chunks].sort((a, b) => b.finalScore - a.finalScore);
|
|
@@ -20512,12 +20514,18 @@ var SearchEngine = class _SearchEngine {
|
|
|
20512
20514
|
}
|
|
20513
20515
|
const body = selected.map((c) => c.hit.metadata.chunkText || c.hit.metadata.snippet).join("\n\n");
|
|
20514
20516
|
parts.push(body);
|
|
20515
|
-
|
|
20517
|
+
let text = parts.join("\n\n");
|
|
20518
|
+
if (text.length > MAX_DOC_CHARS) {
|
|
20519
|
+
text = text.slice(0, MAX_DOC_CHARS);
|
|
20520
|
+
}
|
|
20521
|
+
pageCandidates.push({ id: url, text });
|
|
20516
20522
|
}
|
|
20523
|
+
const maxCandidates = Math.max(topK, this.config.rerank.topN);
|
|
20524
|
+
const cappedCandidates = pageCandidates.slice(0, maxCandidates);
|
|
20517
20525
|
const reranked = await this.reranker.rerank(
|
|
20518
20526
|
query,
|
|
20519
|
-
|
|
20520
|
-
|
|
20527
|
+
cappedCandidates,
|
|
20528
|
+
maxCandidates
|
|
20521
20529
|
);
|
|
20522
20530
|
const scoreByUrl = new Map(reranked.map((e) => [e.id, e.score]));
|
|
20523
20531
|
return ranked.map((entry) => {
|
package/dist/sveltekit.cjs
CHANGED
|
@@ -17254,7 +17254,7 @@ var JinaReranker = class {
|
|
|
17254
17254
|
constructor(options) {
|
|
17255
17255
|
this.apiKey = options.apiKey;
|
|
17256
17256
|
this.model = options.model;
|
|
17257
|
-
this.maxRetries = options.maxRetries ??
|
|
17257
|
+
this.maxRetries = options.maxRetries ?? 2;
|
|
17258
17258
|
}
|
|
17259
17259
|
async rerank(query, candidates, topN) {
|
|
17260
17260
|
if (candidates.length === 0) {
|
|
@@ -17264,7 +17264,8 @@ var JinaReranker = class {
|
|
|
17264
17264
|
model: this.model,
|
|
17265
17265
|
query,
|
|
17266
17266
|
documents: candidates.map((candidate) => candidate.text),
|
|
17267
|
-
top_n: topN ?? candidates.length
|
|
17267
|
+
top_n: topN ?? candidates.length,
|
|
17268
|
+
return_documents: false
|
|
17268
17269
|
};
|
|
17269
17270
|
let attempt = 0;
|
|
17270
17271
|
while (attempt <= this.maxRetries) {
|
|
@@ -18166,6 +18167,7 @@ var SearchEngine = class _SearchEngine {
|
|
|
18166
18167
|
const MAX_CHUNKS_PER_PAGE = 5;
|
|
18167
18168
|
const MIN_CHUNKS_PER_PAGE = 1;
|
|
18168
18169
|
const MIN_CHUNK_SCORE_RATIO = 0.5;
|
|
18170
|
+
const MAX_DOC_CHARS = 2e3;
|
|
18169
18171
|
const pageCandidates = [];
|
|
18170
18172
|
for (const [url, chunks] of pageGroups) {
|
|
18171
18173
|
const byScore = [...chunks].sort((a, b) => b.finalScore - a.finalScore);
|
|
@@ -18185,12 +18187,18 @@ var SearchEngine = class _SearchEngine {
|
|
|
18185
18187
|
}
|
|
18186
18188
|
const body = selected.map((c) => c.hit.metadata.chunkText || c.hit.metadata.snippet).join("\n\n");
|
|
18187
18189
|
parts.push(body);
|
|
18188
|
-
|
|
18190
|
+
let text = parts.join("\n\n");
|
|
18191
|
+
if (text.length > MAX_DOC_CHARS) {
|
|
18192
|
+
text = text.slice(0, MAX_DOC_CHARS);
|
|
18193
|
+
}
|
|
18194
|
+
pageCandidates.push({ id: url, text });
|
|
18189
18195
|
}
|
|
18196
|
+
const maxCandidates = Math.max(topK, this.config.rerank.topN);
|
|
18197
|
+
const cappedCandidates = pageCandidates.slice(0, maxCandidates);
|
|
18190
18198
|
const reranked = await this.reranker.rerank(
|
|
18191
18199
|
query,
|
|
18192
|
-
|
|
18193
|
-
|
|
18200
|
+
cappedCandidates,
|
|
18201
|
+
maxCandidates
|
|
18194
18202
|
);
|
|
18195
18203
|
const scoreByUrl = new Map(reranked.map((e) => [e.id, e.score]));
|
|
18196
18204
|
return ranked.map((entry) => {
|
package/dist/sveltekit.js
CHANGED
|
@@ -17242,7 +17242,7 @@ var JinaReranker = class {
|
|
|
17242
17242
|
constructor(options) {
|
|
17243
17243
|
this.apiKey = options.apiKey;
|
|
17244
17244
|
this.model = options.model;
|
|
17245
|
-
this.maxRetries = options.maxRetries ??
|
|
17245
|
+
this.maxRetries = options.maxRetries ?? 2;
|
|
17246
17246
|
}
|
|
17247
17247
|
async rerank(query, candidates, topN) {
|
|
17248
17248
|
if (candidates.length === 0) {
|
|
@@ -17252,7 +17252,8 @@ var JinaReranker = class {
|
|
|
17252
17252
|
model: this.model,
|
|
17253
17253
|
query,
|
|
17254
17254
|
documents: candidates.map((candidate) => candidate.text),
|
|
17255
|
-
top_n: topN ?? candidates.length
|
|
17255
|
+
top_n: topN ?? candidates.length,
|
|
17256
|
+
return_documents: false
|
|
17256
17257
|
};
|
|
17257
17258
|
let attempt = 0;
|
|
17258
17259
|
while (attempt <= this.maxRetries) {
|
|
@@ -18154,6 +18155,7 @@ var SearchEngine = class _SearchEngine {
|
|
|
18154
18155
|
const MAX_CHUNKS_PER_PAGE = 5;
|
|
18155
18156
|
const MIN_CHUNKS_PER_PAGE = 1;
|
|
18156
18157
|
const MIN_CHUNK_SCORE_RATIO = 0.5;
|
|
18158
|
+
const MAX_DOC_CHARS = 2e3;
|
|
18157
18159
|
const pageCandidates = [];
|
|
18158
18160
|
for (const [url, chunks] of pageGroups) {
|
|
18159
18161
|
const byScore = [...chunks].sort((a, b) => b.finalScore - a.finalScore);
|
|
@@ -18173,12 +18175,18 @@ var SearchEngine = class _SearchEngine {
|
|
|
18173
18175
|
}
|
|
18174
18176
|
const body = selected.map((c) => c.hit.metadata.chunkText || c.hit.metadata.snippet).join("\n\n");
|
|
18175
18177
|
parts.push(body);
|
|
18176
|
-
|
|
18178
|
+
let text = parts.join("\n\n");
|
|
18179
|
+
if (text.length > MAX_DOC_CHARS) {
|
|
18180
|
+
text = text.slice(0, MAX_DOC_CHARS);
|
|
18181
|
+
}
|
|
18182
|
+
pageCandidates.push({ id: url, text });
|
|
18177
18183
|
}
|
|
18184
|
+
const maxCandidates = Math.max(topK, this.config.rerank.topN);
|
|
18185
|
+
const cappedCandidates = pageCandidates.slice(0, maxCandidates);
|
|
18178
18186
|
const reranked = await this.reranker.rerank(
|
|
18179
18187
|
query,
|
|
18180
|
-
|
|
18181
|
-
|
|
18188
|
+
cappedCandidates,
|
|
18189
|
+
maxCandidates
|
|
18182
18190
|
);
|
|
18183
18191
|
const scoreByUrl = new Map(reranked.map((e) => [e.id, e.score]));
|
|
18184
18192
|
return ranked.map((entry) => {
|