@absolutejs/rag 0.0.22 → 0.0.23
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/index.js +22 -3
- package/dist/index.js.map +4 -4
- package/dist/src/adapters/postgres.d.ts +1 -0
- package/dist/src/adapters/sqlite.d.ts +1 -0
- package/package.json +11 -9
package/dist/index.js
CHANGED
|
@@ -31440,6 +31440,10 @@ var limitCandidates = (input) => {
|
|
|
31440
31440
|
const cap = input.candidateTopK ?? input.results.length;
|
|
31441
31441
|
return input.results.slice(0, Math.max(0, cap));
|
|
31442
31442
|
};
|
|
31443
|
+
var readHttpErrorDetail = async (response) => {
|
|
31444
|
+
const text = await response.clone().text().catch(() => "");
|
|
31445
|
+
return text.trim();
|
|
31446
|
+
};
|
|
31443
31447
|
var createHttpCrossEncoderReranker = (options) => {
|
|
31444
31448
|
const fetchImpl = options.config.fetch ?? fetch;
|
|
31445
31449
|
const defaultModel = options.config.defaultModel ?? options.fallbackModel;
|
|
@@ -31463,7 +31467,8 @@ var createHttpCrossEncoderReranker = (options) => {
|
|
|
31463
31467
|
method: "POST"
|
|
31464
31468
|
});
|
|
31465
31469
|
if (!response.ok) {
|
|
31466
|
-
|
|
31470
|
+
const detail = await readHttpErrorDetail(response);
|
|
31471
|
+
throw new Error(`${options.providerName} rerank failed: HTTP ${response.status}${detail ? `: ${detail}` : ""}`);
|
|
31467
31472
|
}
|
|
31468
31473
|
const payload = await response.json();
|
|
31469
31474
|
const rows = payload.results ?? payload.data ?? [];
|
|
@@ -32248,6 +32253,19 @@ var createGmailHttpError = async (label, response) => {
|
|
|
32248
32253
|
const suffix = [reason, detailMessage].filter((value, index, values) => typeof value === "string" && value.length > 0 && values.indexOf(value) === index).join(" | ");
|
|
32249
32254
|
return new Error(`${label}: ${response.status} ${response.statusText}${suffix ? ` (${suffix})` : ""}`);
|
|
32250
32255
|
};
|
|
32256
|
+
var readGraphErrorDetail = async (response) => {
|
|
32257
|
+
try {
|
|
32258
|
+
const body = await response.clone().json();
|
|
32259
|
+
const parts = [body.error?.code, body.error?.message].filter((value, index, values) => typeof value === "string" && value.length > 0 && values.indexOf(value) === index);
|
|
32260
|
+
if (parts.length > 0) {
|
|
32261
|
+
return parts.join(" | ");
|
|
32262
|
+
}
|
|
32263
|
+
} catch {
|
|
32264
|
+
const text = await response.clone().text().catch(() => "");
|
|
32265
|
+
return text.trim().length > 0 ? text.trim() : undefined;
|
|
32266
|
+
}
|
|
32267
|
+
return;
|
|
32268
|
+
};
|
|
32251
32269
|
var fetchGmailWithRetry = async (fetchImpl, url, init, label) => {
|
|
32252
32270
|
for (let attempt = 0;attempt <= GMAIL_MAX_RETRY_ATTEMPTS; attempt += 1) {
|
|
32253
32271
|
const response = await fetchImpl(url, init);
|
|
@@ -32409,7 +32427,8 @@ var createRAGGraphEmailSyncClient = (config) => ({
|
|
|
32409
32427
|
}
|
|
32410
32428
|
});
|
|
32411
32429
|
if (!listResponse.ok) {
|
|
32412
|
-
|
|
32430
|
+
const detail = await readGraphErrorDetail(listResponse);
|
|
32431
|
+
throw new Error(`Graph message list failed: ${listResponse.status} ${listResponse.statusText}${detail ? ` (${detail})` : ""}`);
|
|
32413
32432
|
}
|
|
32414
32433
|
const listJson = await listResponse.json();
|
|
32415
32434
|
const messages = await Promise.all((listJson.value ?? []).map(async (message) => {
|
|
@@ -36133,5 +36152,5 @@ export {
|
|
|
36133
36152
|
addRAGEvaluationSuiteCase
|
|
36134
36153
|
};
|
|
36135
36154
|
|
|
36136
|
-
//# debugId=
|
|
36155
|
+
//# debugId=97FCF5C3C3EC8FDD64756E2164756E21
|
|
36137
36156
|
//# sourceMappingURL=index.js.map
|