@absolutejs/absolute 0.19.0-beta.516 → 0.19.0-beta.518
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 +108 -1
- package/dist/ai/client/index.js.map +3 -3
- package/dist/ai/index.js +113 -1
- package/dist/ai/index.js.map +4 -4
- package/dist/react/ai/index.js +108 -1
- 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 +2 -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 +108 -1
- package/dist/svelte/ai/index.js.map +3 -3
- package/dist/types/ai.d.ts +54 -0
- package/dist/vue/ai/index.js +108 -1
- package/dist/vue/ai/index.js.map +3 -3
- package/package.json +1 -1
package/dist/ai/index.js
CHANGED
|
@@ -5107,6 +5107,8 @@ var buildRAGEvaluationLeaderboard = (runs) => {
|
|
|
5107
5107
|
};
|
|
5108
5108
|
var toHistorySortOrder = (left, right) => right.finishedAt - left.finishedAt;
|
|
5109
5109
|
var normalizeHistoryRuns = (runs) => [...runs].sort(toHistorySortOrder);
|
|
5110
|
+
var toGroundingHistorySortOrder = (left, right) => right.finishedAt - left.finishedAt;
|
|
5111
|
+
var normalizeGroundingHistoryRuns = (runs) => [...runs].sort(toGroundingHistorySortOrder);
|
|
5110
5112
|
var buildCaseDiff = (currentCase, previousCase) => ({
|
|
5111
5113
|
caseId: currentCase.caseId,
|
|
5112
5114
|
currentF1: currentCase.f1,
|
|
@@ -5120,6 +5122,19 @@ var buildCaseDiff = (currentCase, previousCase) => ({
|
|
|
5120
5122
|
previousStatus: previousCase?.status,
|
|
5121
5123
|
query: currentCase.query
|
|
5122
5124
|
});
|
|
5125
|
+
var buildGroundingCaseDiff = (currentCase, previousCase) => ({
|
|
5126
|
+
caseId: currentCase.caseId,
|
|
5127
|
+
currentCitationF1: currentCase.citationF1,
|
|
5128
|
+
currentMatchedIds: currentCase.matchedIds,
|
|
5129
|
+
currentMissingIds: currentCase.missingIds,
|
|
5130
|
+
currentStatus: currentCase.status,
|
|
5131
|
+
label: currentCase.label,
|
|
5132
|
+
previousCitationF1: previousCase?.citationF1,
|
|
5133
|
+
previousMatchedIds: previousCase?.matchedIds ?? [],
|
|
5134
|
+
previousMissingIds: previousCase?.missingIds ?? [],
|
|
5135
|
+
previousStatus: previousCase?.status,
|
|
5136
|
+
query: currentCase.query
|
|
5137
|
+
});
|
|
5123
5138
|
var getStatusRank = (status) => status === "pass" ? 2 : status === "partial" ? 1 : 0;
|
|
5124
5139
|
var buildRAGEvaluationRunDiff = ({
|
|
5125
5140
|
current,
|
|
@@ -5147,6 +5162,32 @@ var buildRAGEvaluationRunDiff = ({
|
|
|
5147
5162
|
unchangedCases
|
|
5148
5163
|
};
|
|
5149
5164
|
};
|
|
5165
|
+
var buildRAGAnswerGroundingEvaluationRunDiff = ({
|
|
5166
|
+
current,
|
|
5167
|
+
previous
|
|
5168
|
+
}) => {
|
|
5169
|
+
const previousCases = new Map((previous?.response.cases ?? []).map((entry) => [entry.caseId, entry]));
|
|
5170
|
+
const diffs = current.response.cases.map((entry) => buildGroundingCaseDiff(entry, previousCases.get(entry.caseId)));
|
|
5171
|
+
const regressedCases = diffs.filter((entry) => getStatusRank(entry.currentStatus) < getStatusRank(entry.previousStatus ?? "fail"));
|
|
5172
|
+
const improvedCases = diffs.filter((entry) => getStatusRank(entry.currentStatus) > getStatusRank(entry.previousStatus ?? "fail"));
|
|
5173
|
+
const unchangedCases = diffs.filter((entry) => getStatusRank(entry.currentStatus) === getStatusRank(entry.previousStatus ?? "fail"));
|
|
5174
|
+
return {
|
|
5175
|
+
currentRunId: current.id,
|
|
5176
|
+
improvedCases,
|
|
5177
|
+
previousRunId: previous?.id,
|
|
5178
|
+
regressedCases,
|
|
5179
|
+
suiteId: current.suiteId,
|
|
5180
|
+
summaryDelta: {
|
|
5181
|
+
averageCitationF1: current.response.summary.averageCitationF1 - (previous?.response.summary.averageCitationF1 ?? 0),
|
|
5182
|
+
averageResolvedCitationRate: current.response.summary.averageResolvedCitationRate - (previous?.response.summary.averageResolvedCitationRate ?? 0),
|
|
5183
|
+
failedCases: current.response.summary.failedCases - (previous?.response.summary.failedCases ?? 0),
|
|
5184
|
+
passedCases: current.response.summary.passedCases - (previous?.response.summary.passedCases ?? 0),
|
|
5185
|
+
passingRate: current.response.passingRate - (previous?.response.passingRate ?? 0),
|
|
5186
|
+
partialCases: current.response.summary.partialCases - (previous?.response.summary.partialCases ?? 0)
|
|
5187
|
+
},
|
|
5188
|
+
unchangedCases
|
|
5189
|
+
};
|
|
5190
|
+
};
|
|
5150
5191
|
var createRAGFileEvaluationHistoryStore = (path) => ({
|
|
5151
5192
|
listRuns: async ({ limit, suiteId } = {}) => {
|
|
5152
5193
|
let parsed = [];
|
|
@@ -5185,6 +5226,42 @@ var createRAGFileEvaluationHistoryStore = (path) => ({
|
|
|
5185
5226
|
`, "utf8");
|
|
5186
5227
|
}
|
|
5187
5228
|
});
|
|
5229
|
+
var createRAGFileAnswerGroundingEvaluationHistoryStore = (path) => ({
|
|
5230
|
+
async listRuns(input) {
|
|
5231
|
+
try {
|
|
5232
|
+
const raw = await readFile2(path, "utf8");
|
|
5233
|
+
const data = JSON.parse(raw);
|
|
5234
|
+
const runs = Array.isArray(data.runs) ? data.runs : [];
|
|
5235
|
+
const filtered = input?.suiteId ? runs.filter((run) => run.suiteId === input.suiteId) : runs;
|
|
5236
|
+
return filtered.sort(toGroundingHistorySortOrder).slice(0, input?.limit ?? DEFAULT_HISTORY_LIMIT);
|
|
5237
|
+
} catch (error) {
|
|
5238
|
+
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
|
|
5239
|
+
return [];
|
|
5240
|
+
}
|
|
5241
|
+
throw error;
|
|
5242
|
+
}
|
|
5243
|
+
},
|
|
5244
|
+
async saveRun(run) {
|
|
5245
|
+
let runs = [];
|
|
5246
|
+
try {
|
|
5247
|
+
const raw = await readFile2(path, "utf8");
|
|
5248
|
+
const data = JSON.parse(raw);
|
|
5249
|
+
runs = Array.isArray(data.runs) ? data.runs : [];
|
|
5250
|
+
} catch (error) {
|
|
5251
|
+
if (!error || typeof error !== "object" || !("code" in error) || error.code !== "ENOENT") {
|
|
5252
|
+
throw error;
|
|
5253
|
+
}
|
|
5254
|
+
}
|
|
5255
|
+
const nextRuns = normalizeGroundingHistoryRuns([
|
|
5256
|
+
run,
|
|
5257
|
+
...runs.filter((entry) => entry.id !== run.id)
|
|
5258
|
+
]);
|
|
5259
|
+
await mkdir(dirname(path), { recursive: true });
|
|
5260
|
+
await writeFile(path, JSON.stringify({
|
|
5261
|
+
runs: nextRuns
|
|
5262
|
+
}, null, 2));
|
|
5263
|
+
}
|
|
5264
|
+
});
|
|
5188
5265
|
var loadRAGEvaluationHistory = async ({
|
|
5189
5266
|
store,
|
|
5190
5267
|
suite,
|
|
@@ -5206,6 +5283,29 @@ var loadRAGEvaluationHistory = async ({
|
|
|
5206
5283
|
suiteLabel: suite.label ?? suite.id
|
|
5207
5284
|
};
|
|
5208
5285
|
};
|
|
5286
|
+
var loadRAGAnswerGroundingEvaluationHistory = async ({
|
|
5287
|
+
store,
|
|
5288
|
+
suite,
|
|
5289
|
+
limit = DEFAULT_HISTORY_LIMIT
|
|
5290
|
+
}) => {
|
|
5291
|
+
const runs = normalizeGroundingHistoryRuns(await Promise.resolve(store.listRuns({
|
|
5292
|
+
limit,
|
|
5293
|
+
suiteId: suite.id
|
|
5294
|
+
})));
|
|
5295
|
+
const latestRun = runs[0];
|
|
5296
|
+
const previousRun = runs[1];
|
|
5297
|
+
return {
|
|
5298
|
+
diff: latestRun && previousRun ? buildRAGAnswerGroundingEvaluationRunDiff({
|
|
5299
|
+
current: latestRun,
|
|
5300
|
+
previous: previousRun
|
|
5301
|
+
}) : undefined,
|
|
5302
|
+
latestRun,
|
|
5303
|
+
previousRun,
|
|
5304
|
+
runs,
|
|
5305
|
+
suiteId: suite.id,
|
|
5306
|
+
suiteLabel: suite.label ?? suite.id
|
|
5307
|
+
};
|
|
5308
|
+
};
|
|
5209
5309
|
var persistRAGEvaluationSuiteRun = async ({
|
|
5210
5310
|
store,
|
|
5211
5311
|
run
|
|
@@ -5213,6 +5313,13 @@ var persistRAGEvaluationSuiteRun = async ({
|
|
|
5213
5313
|
await Promise.resolve(store.saveRun(run));
|
|
5214
5314
|
return run;
|
|
5215
5315
|
};
|
|
5316
|
+
var persistRAGAnswerGroundingEvaluationRun = async ({
|
|
5317
|
+
store,
|
|
5318
|
+
run
|
|
5319
|
+
}) => {
|
|
5320
|
+
await Promise.resolve(store.saveRun(run));
|
|
5321
|
+
return run;
|
|
5322
|
+
};
|
|
5216
5323
|
var buildRAGEvaluationResponse = (cases) => {
|
|
5217
5324
|
const totalCases = cases.length;
|
|
5218
5325
|
const passedCases = cases.filter((entry) => entry.status === "pass").length;
|
|
@@ -10548,6 +10655,7 @@ export {
|
|
|
10548
10655
|
prepareRAGDocument,
|
|
10549
10656
|
prepareRAGDirectoryDocuments,
|
|
10550
10657
|
persistRAGEvaluationSuiteRun,
|
|
10658
|
+
persistRAGAnswerGroundingEvaluationRun,
|
|
10551
10659
|
parseAIMessage,
|
|
10552
10660
|
openaiTranscriber,
|
|
10553
10661
|
openaiResponses,
|
|
@@ -10574,6 +10682,7 @@ export {
|
|
|
10574
10682
|
loadRAGDocumentUpload,
|
|
10575
10683
|
loadRAGDocumentFromURL,
|
|
10576
10684
|
loadRAGDocumentFile,
|
|
10685
|
+
loadRAGAnswerGroundingEvaluationHistory,
|
|
10577
10686
|
ingestRAGDocuments,
|
|
10578
10687
|
ingestDocuments,
|
|
10579
10688
|
googleEmbeddings,
|
|
@@ -10615,6 +10724,7 @@ export {
|
|
|
10615
10724
|
createRAGFileSyncStateStore,
|
|
10616
10725
|
createRAGFileExtractor,
|
|
10617
10726
|
createRAGFileEvaluationHistoryStore,
|
|
10727
|
+
createRAGFileAnswerGroundingEvaluationHistoryStore,
|
|
10618
10728
|
createRAGEvaluationSuite,
|
|
10619
10729
|
createRAGEmbeddingProvider,
|
|
10620
10730
|
createRAGEmailSyncSource,
|
|
@@ -10651,8 +10761,10 @@ export {
|
|
|
10651
10761
|
buildRAGEvaluationRunDiff,
|
|
10652
10762
|
buildRAGEvaluationResponse,
|
|
10653
10763
|
buildRAGEvaluationLeaderboard,
|
|
10764
|
+
buildRAGContext,
|
|
10654
10765
|
buildRAGCitations,
|
|
10655
10766
|
buildRAGCitationReferenceMap,
|
|
10767
|
+
buildRAGAnswerGroundingEvaluationRunDiff,
|
|
10656
10768
|
buildRAGAnswerGroundingEvaluationResponse,
|
|
10657
10769
|
applyRAGReranking,
|
|
10658
10770
|
applyRAGQueryTransform,
|
|
@@ -10662,5 +10774,5 @@ export {
|
|
|
10662
10774
|
aiChat
|
|
10663
10775
|
};
|
|
10664
10776
|
|
|
10665
|
-
//# debugId=
|
|
10777
|
+
//# debugId=158918BE9DABD34C64756E2164756E21
|
|
10666
10778
|
//# sourceMappingURL=index.js.map
|