@absolutejs/absolute 0.19.0-beta.610 → 0.19.0-beta.612
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 +49 -1
- package/dist/ai/client/index.js.map +3 -3
- package/dist/ai/client/ui.js +49 -1
- package/dist/ai/client/ui.js.map +3 -3
- package/dist/ai/index.js +85 -2
- package/dist/ai/index.js.map +5 -5
- package/dist/ai/rag/ui.js +49 -1
- package/dist/ai/rag/ui.js.map +3 -3
- package/dist/ai-client/angular/ai/index.js +48 -0
- package/dist/ai-client/react/ai/index.js +48 -0
- package/dist/ai-client/vue/ai/index.js +48 -0
- package/dist/angular/ai/index.js +49 -1
- package/dist/angular/ai/index.js.map +3 -3
- package/dist/react/ai/index.js +49 -1
- package/dist/react/ai/index.js.map +3 -3
- package/dist/svelte/ai/index.js +49 -1
- package/dist/svelte/ai/index.js.map +3 -3
- package/dist/types/ai.d.ts +23 -0
- package/dist/vue/ai/index.js +49 -1
- package/dist/vue/ai/index.js.map +3 -3
- package/package.json +1 -1
package/dist/ai/rag/ui.js
CHANGED
|
@@ -1520,6 +1520,8 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
1520
1520
|
}
|
|
1521
1521
|
const diagnostics = [...sections.values()];
|
|
1522
1522
|
const strongestBestHit = diagnostics.reduce((highest, section) => Math.max(highest, section.bestScore), 0);
|
|
1523
|
+
const parentLabelByKey = new Map(diagnostics.map((section) => [section.key, section.parentLabel]));
|
|
1524
|
+
const stageSectionCounts = new Map((trace?.steps ?? []).filter((step) => Array.isArray(step.sectionCounts) && step.sectionCounts.length > 0).map((step) => [step.stage, step.sectionCounts ?? []]));
|
|
1523
1525
|
return diagnostics.map((section) => {
|
|
1524
1526
|
const siblingPool = diagnostics.filter((entry) => entry.parentLabel === section.parentLabel);
|
|
1525
1527
|
const siblings = siblingPool.filter((entry) => entry.key !== section.key);
|
|
@@ -1536,6 +1538,48 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
1536
1538
|
totalScore: entry.totalScore
|
|
1537
1539
|
})).sort((left, right) => right.totalScore - left.totalScore) : [];
|
|
1538
1540
|
const reasons = [];
|
|
1541
|
+
const stageCounts = trace?.steps.map((step) => ({
|
|
1542
|
+
count: step.sectionCounts?.find((entry) => entry.key === section.key)?.count ?? 0,
|
|
1543
|
+
stage: step.stage
|
|
1544
|
+
})).filter((entry) => entry.count > 0) ?? [];
|
|
1545
|
+
const stageWeights = stageCounts.map((entry) => {
|
|
1546
|
+
const stageEntries = stageSectionCounts.get(entry.stage)?.filter((candidate) => candidate.count > 0) ?? [];
|
|
1547
|
+
const stageTotal = stageEntries.reduce((sum, candidate) => sum + candidate.count, 0);
|
|
1548
|
+
const siblingStageEntries = stageEntries.filter((candidate) => candidate.key !== section.key && parentLabelByKey.get(candidate.key) === section.parentLabel);
|
|
1549
|
+
const parentStageEntries = stageEntries.filter((candidate) => parentLabelByKey.get(candidate.key) === section.parentLabel);
|
|
1550
|
+
const strongestStageSibling = siblingStageEntries.slice().sort((left, right) => right.count - left.count)[0];
|
|
1551
|
+
const parentStageTotal = parentStageEntries.reduce((sum, candidate) => sum + candidate.count, 0);
|
|
1552
|
+
const stageShare = stageTotal > 0 ? entry.count / stageTotal : 0;
|
|
1553
|
+
const parentStageShare = parentStageTotal > 0 ? entry.count / parentStageTotal : undefined;
|
|
1554
|
+
const stageShareGap = stageTotal > 0 && strongestStageSibling ? entry.count / stageTotal - strongestStageSibling.count / stageTotal : undefined;
|
|
1555
|
+
const parentStageShareGap = parentStageTotal > 0 && strongestStageSibling ? entry.count / parentStageTotal - strongestStageSibling.count / parentStageTotal : undefined;
|
|
1556
|
+
const reasons2 = [];
|
|
1557
|
+
if (entry.stage === "rerank" && stageShare > 0.5 && (typeof stageShareGap !== "number" || stageShareGap > 0)) {
|
|
1558
|
+
reasons2.push("rerank_preserved_lead");
|
|
1559
|
+
}
|
|
1560
|
+
if (entry.stage === "finalize" && stageShare >= 0.5) {
|
|
1561
|
+
reasons2.push("final_stage_concentration");
|
|
1562
|
+
}
|
|
1563
|
+
if (entry.stage === "finalize" && typeof parentStageShare === "number" && parentStageShare >= 0.6 && (typeof parentStageShareGap !== "number" || parentStageShareGap > 0)) {
|
|
1564
|
+
reasons2.push("final_stage_dominant_within_parent");
|
|
1565
|
+
}
|
|
1566
|
+
if (strongestStageSibling && (typeof stageShareGap === "number" && stageShareGap <= 0.1 || typeof parentStageShareGap === "number" && parentStageShareGap <= 0.1)) {
|
|
1567
|
+
reasons2.push("stage_runner_up_pressure");
|
|
1568
|
+
}
|
|
1569
|
+
return {
|
|
1570
|
+
count: entry.count,
|
|
1571
|
+
parentStageShare,
|
|
1572
|
+
parentStageShareGap,
|
|
1573
|
+
reasons: reasons2,
|
|
1574
|
+
stage: entry.stage,
|
|
1575
|
+
stageShare,
|
|
1576
|
+
stageShareGap,
|
|
1577
|
+
strongestSiblingCount: strongestStageSibling?.count,
|
|
1578
|
+
strongestSiblingLabel: strongestStageSibling ? diagnostics.find((candidate) => candidate.key === strongestStageSibling.key)?.label ?? strongestStageSibling.key : undefined
|
|
1579
|
+
};
|
|
1580
|
+
});
|
|
1581
|
+
const firstSeenStage = stageCounts[0]?.stage;
|
|
1582
|
+
const lastSeenStage = stageCounts.at(-1)?.stage;
|
|
1539
1583
|
if (section.bestScore >= strongestBestHit) {
|
|
1540
1584
|
reasons.push("best_hit");
|
|
1541
1585
|
}
|
|
@@ -1568,11 +1612,15 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
1568
1612
|
parentShare,
|
|
1569
1613
|
parentShareGap: typeof parentShare === "number" && strongestSibling && parentTotal > 0 ? parentShare - strongestSibling.totalScore / parentTotal : undefined,
|
|
1570
1614
|
path: section.path,
|
|
1615
|
+
firstSeenStage,
|
|
1616
|
+
lastSeenStage,
|
|
1571
1617
|
retrievalMode: trace?.mode,
|
|
1572
1618
|
reasons,
|
|
1573
1619
|
rerankApplied: trace?.steps.some((step) => step.stage === "rerank" && step.metadata?.applied === true),
|
|
1574
1620
|
scoreShare,
|
|
1575
1621
|
scoreThresholdApplied: trace?.steps.some((step) => step.stage === "score_filter"),
|
|
1622
|
+
stageCounts,
|
|
1623
|
+
stageWeights,
|
|
1576
1624
|
siblingCount: siblings.length,
|
|
1577
1625
|
siblingScoreGap: strongestSibling ? section.totalScore - strongestSibling.totalScore : undefined,
|
|
1578
1626
|
sourceCount: section.sourceSet.size,
|
|
@@ -2424,5 +2472,5 @@ export {
|
|
|
2424
2472
|
buildRAGAdminActionPresentation
|
|
2425
2473
|
};
|
|
2426
2474
|
|
|
2427
|
-
//# debugId=
|
|
2475
|
+
//# debugId=6FA78F50EB1D56B164756E2164756E21
|
|
2428
2476
|
//# sourceMappingURL=ui.js.map
|