@absolutejs/absolute 0.19.0-beta.522 → 0.19.0-beta.524
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/ai/client/index.js +125 -2
- package/dist/ai/client/index.js.map +3 -3
- package/dist/ai/index.js +129 -2
- package/dist/ai/index.js.map +4 -4
- package/dist/react/ai/index.js +125 -2
- package/dist/react/ai/index.js.map +3 -3
- package/dist/src/ai/index.d.ts +2 -2
- package/dist/src/ai/rag/index.d.ts +1 -1
- package/dist/src/ai/rag/quality.d.ts +15 -1
- package/dist/src/ai/rag/types.d.ts +1 -1
- package/dist/svelte/ai/index.js +125 -2
- package/dist/svelte/ai/index.js.map +3 -3
- package/dist/types/ai.d.ts +63 -0
- package/dist/vue/ai/index.js +125 -2
- package/dist/vue/ai/index.js.map +3 -3
- package/package.json +1 -1
package/dist/ai/index.js
CHANGED
|
@@ -5195,10 +5195,49 @@ var buildRAGAnswerGroundingCaseDifficultyLeaderboard = (entries) => {
|
|
|
5195
5195
|
totalEvaluations: entry.totalEvaluations
|
|
5196
5196
|
}));
|
|
5197
5197
|
};
|
|
5198
|
+
var buildGroundingDifficultyDiffEntry = (current, previous) => ({
|
|
5199
|
+
caseId: current.caseId,
|
|
5200
|
+
currentAverageCitationF1: current.averageCitationF1,
|
|
5201
|
+
currentFailRate: current.failRate,
|
|
5202
|
+
currentPassRate: current.passRate,
|
|
5203
|
+
currentRank: current.rank,
|
|
5204
|
+
label: current.label,
|
|
5205
|
+
previousAverageCitationF1: previous?.averageCitationF1,
|
|
5206
|
+
previousFailRate: previous?.failRate,
|
|
5207
|
+
previousPassRate: previous?.passRate,
|
|
5208
|
+
previousRank: previous?.rank,
|
|
5209
|
+
query: current.query
|
|
5210
|
+
});
|
|
5211
|
+
var buildRAGAnswerGroundingCaseDifficultyRunDiff = ({
|
|
5212
|
+
current,
|
|
5213
|
+
previous
|
|
5214
|
+
}) => {
|
|
5215
|
+
const previousEntries = new Map((previous?.entries ?? []).map((entry) => [entry.caseId, entry]));
|
|
5216
|
+
const diffs = current.entries.map((entry) => buildGroundingDifficultyDiffEntry(entry, previousEntries.get(entry.caseId)));
|
|
5217
|
+
return {
|
|
5218
|
+
currentRunId: current.id,
|
|
5219
|
+
easierCases: diffs.filter((entry) => {
|
|
5220
|
+
const previousRank = entry.previousRank ?? entry.currentRank;
|
|
5221
|
+
return entry.currentRank > previousRank;
|
|
5222
|
+
}),
|
|
5223
|
+
harderCases: diffs.filter((entry) => {
|
|
5224
|
+
const previousRank = entry.previousRank ?? Number.MAX_SAFE_INTEGER;
|
|
5225
|
+
return entry.currentRank < previousRank;
|
|
5226
|
+
}),
|
|
5227
|
+
previousRunId: previous?.id,
|
|
5228
|
+
suiteId: current.suiteId,
|
|
5229
|
+
unchangedCases: diffs.filter((entry) => {
|
|
5230
|
+
const previousRank = entry.previousRank ?? entry.currentRank;
|
|
5231
|
+
return entry.currentRank === previousRank;
|
|
5232
|
+
})
|
|
5233
|
+
};
|
|
5234
|
+
};
|
|
5198
5235
|
var toHistorySortOrder = (left, right) => right.finishedAt - left.finishedAt;
|
|
5199
5236
|
var normalizeHistoryRuns = (runs) => [...runs].sort(toHistorySortOrder);
|
|
5200
5237
|
var toGroundingHistorySortOrder = (left, right) => right.finishedAt - left.finishedAt;
|
|
5201
5238
|
var normalizeGroundingHistoryRuns = (runs) => [...runs].sort(toGroundingHistorySortOrder);
|
|
5239
|
+
var toGroundingDifficultyHistorySortOrder = (left, right) => right.finishedAt - left.finishedAt;
|
|
5240
|
+
var normalizeGroundingDifficultyHistoryRuns = (runs) => [...runs].sort(toGroundingDifficultyHistorySortOrder);
|
|
5202
5241
|
var buildCaseDiff = (currentCase, previousCase) => ({
|
|
5203
5242
|
caseId: currentCase.caseId,
|
|
5204
5243
|
currentF1: currentCase.f1,
|
|
@@ -5216,18 +5255,30 @@ var buildGroundingCaseDiff = (currentCase, previousCase) => ({
|
|
|
5216
5255
|
answerChanged: typeof previousCase?.answer === "string" ? previousCase.answer !== currentCase.answer : true,
|
|
5217
5256
|
caseId: currentCase.caseId,
|
|
5218
5257
|
currentCitationF1: currentCase.citationF1,
|
|
5258
|
+
currentCitedIds: currentCase.citedIds,
|
|
5219
5259
|
currentCoverage: currentCase.coverage,
|
|
5260
|
+
currentExtraIds: currentCase.extraIds,
|
|
5220
5261
|
currentMatchedIds: currentCase.matchedIds,
|
|
5221
5262
|
currentMissingIds: currentCase.missingIds,
|
|
5263
|
+
currentReferenceCount: currentCase.referenceCount,
|
|
5264
|
+
currentResolvedCitationCount: currentCase.resolvedCitationCount,
|
|
5222
5265
|
currentAnswer: currentCase.answer,
|
|
5223
5266
|
currentStatus: currentCase.status,
|
|
5267
|
+
currentUngroundedReferenceNumbers: currentCase.groundedAnswer.ungroundedReferenceNumbers,
|
|
5268
|
+
currentUnresolvedCitationCount: currentCase.unresolvedCitationCount,
|
|
5224
5269
|
label: currentCase.label,
|
|
5225
5270
|
previousAnswer: previousCase?.answer,
|
|
5226
5271
|
previousCitationF1: previousCase?.citationF1,
|
|
5272
|
+
previousCitedIds: previousCase?.citedIds ?? [],
|
|
5227
5273
|
previousCoverage: previousCase?.coverage,
|
|
5274
|
+
previousExtraIds: previousCase?.extraIds ?? [],
|
|
5228
5275
|
previousMatchedIds: previousCase?.matchedIds ?? [],
|
|
5229
5276
|
previousMissingIds: previousCase?.missingIds ?? [],
|
|
5277
|
+
previousReferenceCount: previousCase?.referenceCount,
|
|
5278
|
+
previousResolvedCitationCount: previousCase?.resolvedCitationCount,
|
|
5230
5279
|
previousStatus: previousCase?.status,
|
|
5280
|
+
previousUngroundedReferenceNumbers: previousCase?.groundedAnswer.ungroundedReferenceNumbers ?? [],
|
|
5281
|
+
previousUnresolvedCitationCount: previousCase?.unresolvedCitationCount,
|
|
5231
5282
|
query: currentCase.query
|
|
5232
5283
|
});
|
|
5233
5284
|
var buildGroundingCaseSnapshots = ({
|
|
@@ -5244,7 +5295,9 @@ var buildGroundingCaseSnapshots = ({
|
|
|
5244
5295
|
answer: entry.answer,
|
|
5245
5296
|
answerChange: typeof previousCase?.answer === "string" ? previousCase.answer === entry.answer ? "unchanged" : "changed" : "new",
|
|
5246
5297
|
caseId: entry.caseId,
|
|
5298
|
+
citationCount: entry.citationCount,
|
|
5247
5299
|
citationF1: entry.citationF1,
|
|
5300
|
+
citedIds: entry.citedIds,
|
|
5248
5301
|
coverage: entry.coverage,
|
|
5249
5302
|
extraIds: entry.extraIds,
|
|
5250
5303
|
label: entry.label,
|
|
@@ -5252,8 +5305,12 @@ var buildGroundingCaseSnapshots = ({
|
|
|
5252
5305
|
missingIds: entry.missingIds,
|
|
5253
5306
|
previousAnswer: previousCase?.answer,
|
|
5254
5307
|
query: entry.query,
|
|
5308
|
+
referenceCount: entry.referenceCount,
|
|
5309
|
+
resolvedCitationCount: entry.resolvedCitationCount,
|
|
5255
5310
|
resolvedCitationRate: entry.resolvedCitationRate,
|
|
5256
|
-
status: entry.status
|
|
5311
|
+
status: entry.status,
|
|
5312
|
+
ungroundedReferenceNumbers: entry.groundedAnswer.ungroundedReferenceNumbers,
|
|
5313
|
+
unresolvedCitationCount: entry.unresolvedCitationCount
|
|
5257
5314
|
};
|
|
5258
5315
|
});
|
|
5259
5316
|
};
|
|
@@ -5384,6 +5441,42 @@ var createRAGFileAnswerGroundingEvaluationHistoryStore = (path) => ({
|
|
|
5384
5441
|
}, null, 2));
|
|
5385
5442
|
}
|
|
5386
5443
|
});
|
|
5444
|
+
var createRAGFileAnswerGroundingCaseDifficultyHistoryStore = (path) => ({
|
|
5445
|
+
async listRuns(input) {
|
|
5446
|
+
try {
|
|
5447
|
+
const raw = await readFile2(path, "utf8");
|
|
5448
|
+
const data = JSON.parse(raw);
|
|
5449
|
+
const runs = Array.isArray(data.runs) ? data.runs : [];
|
|
5450
|
+
const filtered = input?.suiteId ? runs.filter((run) => run.suiteId === input.suiteId) : runs;
|
|
5451
|
+
return normalizeGroundingDifficultyHistoryRuns(filtered).slice(0, input?.limit ?? DEFAULT_HISTORY_LIMIT);
|
|
5452
|
+
} catch (error) {
|
|
5453
|
+
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
|
|
5454
|
+
return [];
|
|
5455
|
+
}
|
|
5456
|
+
throw error;
|
|
5457
|
+
}
|
|
5458
|
+
},
|
|
5459
|
+
async saveRun(run) {
|
|
5460
|
+
let runs = [];
|
|
5461
|
+
try {
|
|
5462
|
+
const raw = await readFile2(path, "utf8");
|
|
5463
|
+
const data = JSON.parse(raw);
|
|
5464
|
+
runs = Array.isArray(data.runs) ? data.runs : [];
|
|
5465
|
+
} catch (error) {
|
|
5466
|
+
if (!error || typeof error !== "object" || !("code" in error) || error.code !== "ENOENT") {
|
|
5467
|
+
throw error;
|
|
5468
|
+
}
|
|
5469
|
+
}
|
|
5470
|
+
const nextRuns = normalizeGroundingDifficultyHistoryRuns([
|
|
5471
|
+
run,
|
|
5472
|
+
...runs.filter((entry) => entry.id !== run.id)
|
|
5473
|
+
]);
|
|
5474
|
+
await mkdir(dirname(path), { recursive: true });
|
|
5475
|
+
await writeFile(path, JSON.stringify({
|
|
5476
|
+
runs: nextRuns
|
|
5477
|
+
}, null, 2));
|
|
5478
|
+
}
|
|
5479
|
+
});
|
|
5387
5480
|
var loadRAGEvaluationHistory = async ({
|
|
5388
5481
|
store,
|
|
5389
5482
|
suite,
|
|
@@ -5433,6 +5526,29 @@ var loadRAGAnswerGroundingEvaluationHistory = async ({
|
|
|
5433
5526
|
suiteLabel: suite.label ?? suite.id
|
|
5434
5527
|
};
|
|
5435
5528
|
};
|
|
5529
|
+
var loadRAGAnswerGroundingCaseDifficultyHistory = async ({
|
|
5530
|
+
store,
|
|
5531
|
+
suite,
|
|
5532
|
+
limit = DEFAULT_HISTORY_LIMIT
|
|
5533
|
+
}) => {
|
|
5534
|
+
const runs = normalizeGroundingDifficultyHistoryRuns(await Promise.resolve(store.listRuns({
|
|
5535
|
+
limit,
|
|
5536
|
+
suiteId: suite.id
|
|
5537
|
+
})));
|
|
5538
|
+
const latestRun = runs[0];
|
|
5539
|
+
const previousRun = runs[1];
|
|
5540
|
+
return {
|
|
5541
|
+
diff: latestRun && previousRun ? buildRAGAnswerGroundingCaseDifficultyRunDiff({
|
|
5542
|
+
current: latestRun,
|
|
5543
|
+
previous: previousRun
|
|
5544
|
+
}) : undefined,
|
|
5545
|
+
latestRun,
|
|
5546
|
+
previousRun,
|
|
5547
|
+
runs,
|
|
5548
|
+
suiteId: suite.id,
|
|
5549
|
+
suiteLabel: suite.label ?? suite.id
|
|
5550
|
+
};
|
|
5551
|
+
};
|
|
5436
5552
|
var persistRAGEvaluationSuiteRun = async ({
|
|
5437
5553
|
store,
|
|
5438
5554
|
run
|
|
@@ -5447,6 +5563,13 @@ var persistRAGAnswerGroundingEvaluationRun = async ({
|
|
|
5447
5563
|
await Promise.resolve(store.saveRun(run));
|
|
5448
5564
|
return run;
|
|
5449
5565
|
};
|
|
5566
|
+
var persistRAGAnswerGroundingCaseDifficultyRun = async ({
|
|
5567
|
+
store,
|
|
5568
|
+
run
|
|
5569
|
+
}) => {
|
|
5570
|
+
await Promise.resolve(store.saveRun(run));
|
|
5571
|
+
return run;
|
|
5572
|
+
};
|
|
5450
5573
|
var buildRAGEvaluationResponse = (cases) => {
|
|
5451
5574
|
const totalCases = cases.length;
|
|
5452
5575
|
const passedCases = cases.filter((entry) => entry.status === "pass").length;
|
|
@@ -10783,6 +10906,7 @@ export {
|
|
|
10783
10906
|
prepareRAGDirectoryDocuments,
|
|
10784
10907
|
persistRAGEvaluationSuiteRun,
|
|
10785
10908
|
persistRAGAnswerGroundingEvaluationRun,
|
|
10909
|
+
persistRAGAnswerGroundingCaseDifficultyRun,
|
|
10786
10910
|
parseAIMessage,
|
|
10787
10911
|
openaiTranscriber,
|
|
10788
10912
|
openaiResponses,
|
|
@@ -10810,6 +10934,7 @@ export {
|
|
|
10810
10934
|
loadRAGDocumentFromURL,
|
|
10811
10935
|
loadRAGDocumentFile,
|
|
10812
10936
|
loadRAGAnswerGroundingEvaluationHistory,
|
|
10937
|
+
loadRAGAnswerGroundingCaseDifficultyHistory,
|
|
10813
10938
|
ingestRAGDocuments,
|
|
10814
10939
|
ingestDocuments,
|
|
10815
10940
|
googleEmbeddings,
|
|
@@ -10852,6 +10977,7 @@ export {
|
|
|
10852
10977
|
createRAGFileExtractor,
|
|
10853
10978
|
createRAGFileEvaluationHistoryStore,
|
|
10854
10979
|
createRAGFileAnswerGroundingEvaluationHistoryStore,
|
|
10980
|
+
createRAGFileAnswerGroundingCaseDifficultyHistoryStore,
|
|
10855
10981
|
createRAGEvaluationSuite,
|
|
10856
10982
|
createRAGEmbeddingProvider,
|
|
10857
10983
|
createRAGEmailSyncSource,
|
|
@@ -10894,6 +11020,7 @@ export {
|
|
|
10894
11020
|
buildRAGAnswerGroundingEvaluationRunDiff,
|
|
10895
11021
|
buildRAGAnswerGroundingEvaluationResponse,
|
|
10896
11022
|
buildRAGAnswerGroundingEvaluationLeaderboard,
|
|
11023
|
+
buildRAGAnswerGroundingCaseDifficultyRunDiff,
|
|
10897
11024
|
buildRAGAnswerGroundingCaseDifficultyLeaderboard,
|
|
10898
11025
|
applyRAGReranking,
|
|
10899
11026
|
applyRAGQueryTransform,
|
|
@@ -10903,5 +11030,5 @@ export {
|
|
|
10903
11030
|
aiChat
|
|
10904
11031
|
};
|
|
10905
11032
|
|
|
10906
|
-
//# debugId=
|
|
11033
|
+
//# debugId=65A77674EF81027664756E2164756E21
|
|
10907
11034
|
//# sourceMappingURL=index.js.map
|