@absolutejs/absolute 0.19.0-beta.612 → 0.19.0-beta.613
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 +83 -1
- package/dist/ai/client/index.js.map +3 -3
- package/dist/ai/client/ui.js +83 -1
- package/dist/ai/client/ui.js.map +3 -3
- package/dist/ai/index.js +149 -8
- package/dist/ai/index.js.map +5 -5
- package/dist/ai/rag/ui.js +83 -1
- package/dist/ai/rag/ui.js.map +3 -3
- package/dist/ai-client/angular/ai/index.js +82 -0
- package/dist/ai-client/react/ai/index.js +82 -0
- package/dist/ai-client/vue/ai/index.js +82 -0
- package/dist/angular/ai/index.js +83 -1
- package/dist/angular/ai/index.js.map +3 -3
- package/dist/react/ai/index.js +83 -1
- package/dist/react/ai/index.js.map +3 -3
- package/dist/svelte/ai/index.js +83 -1
- package/dist/svelte/ai/index.js.map +3 -3
- package/dist/types/ai.d.ts +28 -1
- package/dist/vue/ai/index.js +83 -1
- package/dist/vue/ai/index.js.map +3 -3
- package/package.json +7 -7
package/dist/ai/client/index.js
CHANGED
|
@@ -5265,6 +5265,10 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
5265
5265
|
const vectorHits = channels.includes("vector") ? 1 : 0;
|
|
5266
5266
|
const lexicalHits = channels.includes("lexical") ? 1 : 0;
|
|
5267
5267
|
const hybridHits = isHybrid ? 1 : 0;
|
|
5268
|
+
const queryOrigin = source.metadata?.retrievalQueryOrigin;
|
|
5269
|
+
const primaryHits = queryOrigin === "primary" ? 1 : 0;
|
|
5270
|
+
const transformedHits = queryOrigin === "transformed" ? 1 : 0;
|
|
5271
|
+
const variantHits = queryOrigin === "variant" ? 1 : 0;
|
|
5268
5272
|
if (!existing) {
|
|
5269
5273
|
sections.set(key, {
|
|
5270
5274
|
bestScore: source.score,
|
|
@@ -5275,10 +5279,13 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
5275
5279
|
lexicalHits,
|
|
5276
5280
|
parentLabel,
|
|
5277
5281
|
path,
|
|
5282
|
+
primaryHits,
|
|
5278
5283
|
sourceSet: new Set(source.source ? [source.source] : []),
|
|
5279
5284
|
topChunkId: source.chunkId,
|
|
5280
5285
|
topSource: source.source,
|
|
5281
5286
|
totalScore: source.score,
|
|
5287
|
+
transformedHits,
|
|
5288
|
+
variantHits,
|
|
5282
5289
|
vectorHits
|
|
5283
5290
|
});
|
|
5284
5291
|
continue;
|
|
@@ -5291,6 +5298,9 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
5291
5298
|
existing.vectorHits += vectorHits;
|
|
5292
5299
|
existing.lexicalHits += lexicalHits;
|
|
5293
5300
|
existing.hybridHits += hybridHits;
|
|
5301
|
+
existing.primaryHits += primaryHits;
|
|
5302
|
+
existing.transformedHits += transformedHits;
|
|
5303
|
+
existing.variantHits += variantHits;
|
|
5294
5304
|
if (source.score > existing.bestScore) {
|
|
5295
5305
|
existing.bestScore = source.score;
|
|
5296
5306
|
existing.topChunkId = source.chunkId;
|
|
@@ -5301,6 +5311,7 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
5301
5311
|
const strongestBestHit = diagnostics.reduce((highest, section) => Math.max(highest, section.bestScore), 0);
|
|
5302
5312
|
const parentLabelByKey = new Map(diagnostics.map((section) => [section.key, section.parentLabel]));
|
|
5303
5313
|
const stageSectionCounts = new Map((trace?.steps ?? []).filter((step) => Array.isArray(step.sectionCounts) && step.sectionCounts.length > 0).map((step) => [step.stage, step.sectionCounts ?? []]));
|
|
5314
|
+
const stageSectionScores = new Map((trace?.steps ?? []).filter((step) => Array.isArray(step.sectionScores) && step.sectionScores.length > 0).map((step) => [step.stage, step.sectionScores ?? []]));
|
|
5304
5315
|
return diagnostics.map((section) => {
|
|
5305
5316
|
const siblingPool = diagnostics.filter((entry) => entry.parentLabel === section.parentLabel);
|
|
5306
5317
|
const siblings = siblingPool.filter((entry) => entry.key !== section.key);
|
|
@@ -5322,16 +5333,30 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
5322
5333
|
stage: step.stage
|
|
5323
5334
|
})).filter((entry) => entry.count > 0) ?? [];
|
|
5324
5335
|
const stageWeights = stageCounts.map((entry) => {
|
|
5336
|
+
const previousStageEntry = stageCounts[stageCounts.findIndex((candidate) => candidate.stage === entry.stage) - 1];
|
|
5325
5337
|
const stageEntries = stageSectionCounts.get(entry.stage)?.filter((candidate) => candidate.count > 0) ?? [];
|
|
5338
|
+
const stageScoreEntries = stageSectionScores.get(entry.stage)?.filter((candidate) => candidate.totalScore > 0) ?? [];
|
|
5326
5339
|
const stageTotal = stageEntries.reduce((sum, candidate) => sum + candidate.count, 0);
|
|
5340
|
+
const stageScoreTotal = stageScoreEntries.reduce((sum, candidate) => sum + candidate.totalScore, 0);
|
|
5327
5341
|
const siblingStageEntries = stageEntries.filter((candidate) => candidate.key !== section.key && parentLabelByKey.get(candidate.key) === section.parentLabel);
|
|
5328
5342
|
const parentStageEntries = stageEntries.filter((candidate) => parentLabelByKey.get(candidate.key) === section.parentLabel);
|
|
5343
|
+
const siblingStageScoreEntries = stageScoreEntries.filter((candidate) => candidate.key !== section.key && parentLabelByKey.get(candidate.key) === section.parentLabel);
|
|
5344
|
+
const parentStageScoreEntries = stageScoreEntries.filter((candidate) => parentLabelByKey.get(candidate.key) === section.parentLabel);
|
|
5329
5345
|
const strongestStageSibling = siblingStageEntries.slice().sort((left, right) => right.count - left.count)[0];
|
|
5330
5346
|
const parentStageTotal = parentStageEntries.reduce((sum, candidate) => sum + candidate.count, 0);
|
|
5347
|
+
const activeStageScore = stageScoreEntries.find((candidate) => candidate.key === section.key)?.totalScore;
|
|
5348
|
+
const strongestStageScoreSibling = siblingStageScoreEntries.slice().sort((left, right) => right.totalScore - left.totalScore)[0];
|
|
5349
|
+
const parentStageScoreTotal = parentStageScoreEntries.reduce((sum, candidate) => sum + candidate.totalScore, 0);
|
|
5331
5350
|
const stageShare = stageTotal > 0 ? entry.count / stageTotal : 0;
|
|
5351
|
+
const retentionRate = typeof previousStageEntry?.count === "number" && previousStageEntry.count > 0 ? entry.count / previousStageEntry.count : undefined;
|
|
5352
|
+
const countDelta = typeof previousStageEntry?.count === "number" ? entry.count - previousStageEntry.count : undefined;
|
|
5332
5353
|
const parentStageShare = parentStageTotal > 0 ? entry.count / parentStageTotal : undefined;
|
|
5354
|
+
const stageScoreShare = typeof activeStageScore === "number" && stageScoreTotal > 0 ? activeStageScore / stageScoreTotal : undefined;
|
|
5355
|
+
const parentStageScoreShare = typeof activeStageScore === "number" && parentStageScoreTotal > 0 ? activeStageScore / parentStageScoreTotal : undefined;
|
|
5333
5356
|
const stageShareGap = stageTotal > 0 && strongestStageSibling ? entry.count / stageTotal - strongestStageSibling.count / stageTotal : undefined;
|
|
5334
5357
|
const parentStageShareGap = parentStageTotal > 0 && strongestStageSibling ? entry.count / parentStageTotal - strongestStageSibling.count / parentStageTotal : undefined;
|
|
5358
|
+
const stageScoreShareGap = typeof activeStageScore === "number" && stageScoreTotal > 0 && strongestStageScoreSibling ? activeStageScore / stageScoreTotal - strongestStageScoreSibling.totalScore / stageScoreTotal : undefined;
|
|
5359
|
+
const parentStageScoreShareGap = typeof activeStageScore === "number" && parentStageScoreTotal > 0 && strongestStageScoreSibling ? activeStageScore / parentStageScoreTotal - strongestStageScoreSibling.totalScore / parentStageScoreTotal : undefined;
|
|
5335
5360
|
const reasons2 = [];
|
|
5336
5361
|
if (entry.stage === "rerank" && stageShare > 0.5 && (typeof stageShareGap !== "number" || stageShareGap > 0)) {
|
|
5337
5362
|
reasons2.push("rerank_preserved_lead");
|
|
@@ -5345,20 +5370,65 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
5345
5370
|
if (strongestStageSibling && (typeof stageShareGap === "number" && stageShareGap <= 0.1 || typeof parentStageShareGap === "number" && parentStageShareGap <= 0.1)) {
|
|
5346
5371
|
reasons2.push("stage_runner_up_pressure");
|
|
5347
5372
|
}
|
|
5373
|
+
if (typeof countDelta === "number") {
|
|
5374
|
+
if (countDelta > 0) {
|
|
5375
|
+
reasons2.push("stage_expanded");
|
|
5376
|
+
} else if (countDelta < 0) {
|
|
5377
|
+
reasons2.push("stage_narrowed");
|
|
5378
|
+
} else {
|
|
5379
|
+
reasons2.push("stage_held");
|
|
5380
|
+
}
|
|
5381
|
+
}
|
|
5348
5382
|
return {
|
|
5349
5383
|
count: entry.count,
|
|
5384
|
+
countDelta,
|
|
5385
|
+
parentStageScoreShare,
|
|
5350
5386
|
parentStageShare,
|
|
5351
5387
|
parentStageShareGap,
|
|
5388
|
+
previousCount: previousStageEntry?.count,
|
|
5389
|
+
previousStage: previousStageEntry?.stage,
|
|
5352
5390
|
reasons: reasons2,
|
|
5391
|
+
retentionRate,
|
|
5353
5392
|
stage: entry.stage,
|
|
5393
|
+
stageScoreShare,
|
|
5394
|
+
stageScoreShareGap,
|
|
5354
5395
|
stageShare,
|
|
5355
5396
|
stageShareGap,
|
|
5397
|
+
totalScore: activeStageScore,
|
|
5356
5398
|
strongestSiblingCount: strongestStageSibling?.count,
|
|
5357
5399
|
strongestSiblingLabel: strongestStageSibling ? diagnostics.find((candidate) => candidate.key === strongestStageSibling.key)?.label ?? strongestStageSibling.key : undefined
|
|
5358
5400
|
};
|
|
5359
5401
|
});
|
|
5360
5402
|
const firstSeenStage = stageCounts[0]?.stage;
|
|
5361
5403
|
const lastSeenStage = stageCounts.at(-1)?.stage;
|
|
5404
|
+
const peakStageEntry = stageCounts.reduce((highest, entry) => !highest || entry.count > highest.count ? entry : highest, undefined);
|
|
5405
|
+
const finalStageEntry = stageCounts.at(-1);
|
|
5406
|
+
const peakCount = peakStageEntry?.count ?? section.count;
|
|
5407
|
+
const finalCount = finalStageEntry?.count;
|
|
5408
|
+
const finalRetentionRate = typeof finalCount === "number" && peakCount > 0 ? finalCount / peakCount : undefined;
|
|
5409
|
+
const dropFromPeak = typeof finalCount === "number" ? peakCount - finalCount : undefined;
|
|
5410
|
+
const queryAttributionReasons = [];
|
|
5411
|
+
const queryAttributionMode = section.primaryHits > 0 && section.transformedHits === 0 && section.variantHits === 0 ? "primary" : section.transformedHits > 0 && section.primaryHits === 0 && section.variantHits === 0 ? "transformed" : section.variantHits > 0 && section.primaryHits === 0 && section.transformedHits === 0 ? "variant" : "mixed";
|
|
5412
|
+
if (queryAttributionMode === "primary") {
|
|
5413
|
+
queryAttributionReasons.push("base_query_only");
|
|
5414
|
+
}
|
|
5415
|
+
if (queryAttributionMode === "transformed") {
|
|
5416
|
+
queryAttributionReasons.push("transformed_query_only");
|
|
5417
|
+
queryAttributionReasons.push("transform_introduced");
|
|
5418
|
+
}
|
|
5419
|
+
if (queryAttributionMode === "variant") {
|
|
5420
|
+
queryAttributionReasons.push("variant_only");
|
|
5421
|
+
queryAttributionReasons.push("variant_supported");
|
|
5422
|
+
}
|
|
5423
|
+
if (queryAttributionMode === "mixed") {
|
|
5424
|
+
queryAttributionReasons.push("mixed_query_sources");
|
|
5425
|
+
if (section.variantHits > 0) {
|
|
5426
|
+
queryAttributionReasons.push("variant_supported");
|
|
5427
|
+
}
|
|
5428
|
+
if (section.transformedHits > 0 && section.primaryHits === 0) {
|
|
5429
|
+
queryAttributionReasons.push("transform_introduced");
|
|
5430
|
+
}
|
|
5431
|
+
}
|
|
5362
5432
|
if (section.bestScore >= strongestBestHit) {
|
|
5363
5433
|
reasons.push("best_hit");
|
|
5364
5434
|
}
|
|
@@ -5392,7 +5462,19 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
5392
5462
|
parentShareGap: typeof parentShare === "number" && strongestSibling && parentTotal > 0 ? parentShare - strongestSibling.totalScore / parentTotal : undefined,
|
|
5393
5463
|
path: section.path,
|
|
5394
5464
|
firstSeenStage,
|
|
5465
|
+
finalCount,
|
|
5466
|
+
finalRetentionRate,
|
|
5395
5467
|
lastSeenStage,
|
|
5468
|
+
dropFromPeak,
|
|
5469
|
+
peakCount,
|
|
5470
|
+
peakStage: peakStageEntry?.stage,
|
|
5471
|
+
queryAttribution: {
|
|
5472
|
+
mode: queryAttributionMode,
|
|
5473
|
+
primaryHits: section.primaryHits,
|
|
5474
|
+
reasons: queryAttributionReasons,
|
|
5475
|
+
transformedHits: section.transformedHits,
|
|
5476
|
+
variantHits: section.variantHits
|
|
5477
|
+
},
|
|
5396
5478
|
retrievalMode: trace?.mode,
|
|
5397
5479
|
reasons,
|
|
5398
5480
|
rerankApplied: trace?.steps.some((step) => step.stage === "rerank" && step.metadata?.applied === true),
|
|
@@ -7354,5 +7436,5 @@ export {
|
|
|
7354
7436
|
buildRAGEvaluationLeaderboard
|
|
7355
7437
|
};
|
|
7356
7438
|
|
|
7357
|
-
//# debugId=
|
|
7439
|
+
//# debugId=7134089E98D0712964756E2164756E21
|
|
7358
7440
|
//# sourceMappingURL=index.js.map
|