@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/svelte/ai/index.js
CHANGED
|
@@ -4702,6 +4702,8 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
4702
4702
|
}
|
|
4703
4703
|
const diagnostics = [...sections.values()];
|
|
4704
4704
|
const strongestBestHit = diagnostics.reduce((highest, section) => Math.max(highest, section.bestScore), 0);
|
|
4705
|
+
const parentLabelByKey = new Map(diagnostics.map((section) => [section.key, section.parentLabel]));
|
|
4706
|
+
const stageSectionCounts = new Map((trace?.steps ?? []).filter((step) => Array.isArray(step.sectionCounts) && step.sectionCounts.length > 0).map((step) => [step.stage, step.sectionCounts ?? []]));
|
|
4705
4707
|
return diagnostics.map((section) => {
|
|
4706
4708
|
const siblingPool = diagnostics.filter((entry) => entry.parentLabel === section.parentLabel);
|
|
4707
4709
|
const siblings = siblingPool.filter((entry) => entry.key !== section.key);
|
|
@@ -4718,6 +4720,48 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
4718
4720
|
totalScore: entry.totalScore
|
|
4719
4721
|
})).sort((left, right) => right.totalScore - left.totalScore) : [];
|
|
4720
4722
|
const reasons = [];
|
|
4723
|
+
const stageCounts = trace?.steps.map((step) => ({
|
|
4724
|
+
count: step.sectionCounts?.find((entry) => entry.key === section.key)?.count ?? 0,
|
|
4725
|
+
stage: step.stage
|
|
4726
|
+
})).filter((entry) => entry.count > 0) ?? [];
|
|
4727
|
+
const stageWeights = stageCounts.map((entry) => {
|
|
4728
|
+
const stageEntries = stageSectionCounts.get(entry.stage)?.filter((candidate) => candidate.count > 0) ?? [];
|
|
4729
|
+
const stageTotal = stageEntries.reduce((sum, candidate) => sum + candidate.count, 0);
|
|
4730
|
+
const siblingStageEntries = stageEntries.filter((candidate) => candidate.key !== section.key && parentLabelByKey.get(candidate.key) === section.parentLabel);
|
|
4731
|
+
const parentStageEntries = stageEntries.filter((candidate) => parentLabelByKey.get(candidate.key) === section.parentLabel);
|
|
4732
|
+
const strongestStageSibling = siblingStageEntries.slice().sort((left, right) => right.count - left.count)[0];
|
|
4733
|
+
const parentStageTotal = parentStageEntries.reduce((sum, candidate) => sum + candidate.count, 0);
|
|
4734
|
+
const stageShare = stageTotal > 0 ? entry.count / stageTotal : 0;
|
|
4735
|
+
const parentStageShare = parentStageTotal > 0 ? entry.count / parentStageTotal : undefined;
|
|
4736
|
+
const stageShareGap = stageTotal > 0 && strongestStageSibling ? entry.count / stageTotal - strongestStageSibling.count / stageTotal : undefined;
|
|
4737
|
+
const parentStageShareGap = parentStageTotal > 0 && strongestStageSibling ? entry.count / parentStageTotal - strongestStageSibling.count / parentStageTotal : undefined;
|
|
4738
|
+
const reasons2 = [];
|
|
4739
|
+
if (entry.stage === "rerank" && stageShare > 0.5 && (typeof stageShareGap !== "number" || stageShareGap > 0)) {
|
|
4740
|
+
reasons2.push("rerank_preserved_lead");
|
|
4741
|
+
}
|
|
4742
|
+
if (entry.stage === "finalize" && stageShare >= 0.5) {
|
|
4743
|
+
reasons2.push("final_stage_concentration");
|
|
4744
|
+
}
|
|
4745
|
+
if (entry.stage === "finalize" && typeof parentStageShare === "number" && parentStageShare >= 0.6 && (typeof parentStageShareGap !== "number" || parentStageShareGap > 0)) {
|
|
4746
|
+
reasons2.push("final_stage_dominant_within_parent");
|
|
4747
|
+
}
|
|
4748
|
+
if (strongestStageSibling && (typeof stageShareGap === "number" && stageShareGap <= 0.1 || typeof parentStageShareGap === "number" && parentStageShareGap <= 0.1)) {
|
|
4749
|
+
reasons2.push("stage_runner_up_pressure");
|
|
4750
|
+
}
|
|
4751
|
+
return {
|
|
4752
|
+
count: entry.count,
|
|
4753
|
+
parentStageShare,
|
|
4754
|
+
parentStageShareGap,
|
|
4755
|
+
reasons: reasons2,
|
|
4756
|
+
stage: entry.stage,
|
|
4757
|
+
stageShare,
|
|
4758
|
+
stageShareGap,
|
|
4759
|
+
strongestSiblingCount: strongestStageSibling?.count,
|
|
4760
|
+
strongestSiblingLabel: strongestStageSibling ? diagnostics.find((candidate) => candidate.key === strongestStageSibling.key)?.label ?? strongestStageSibling.key : undefined
|
|
4761
|
+
};
|
|
4762
|
+
});
|
|
4763
|
+
const firstSeenStage = stageCounts[0]?.stage;
|
|
4764
|
+
const lastSeenStage = stageCounts.at(-1)?.stage;
|
|
4721
4765
|
if (section.bestScore >= strongestBestHit) {
|
|
4722
4766
|
reasons.push("best_hit");
|
|
4723
4767
|
}
|
|
@@ -4750,11 +4794,15 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
4750
4794
|
parentShare,
|
|
4751
4795
|
parentShareGap: typeof parentShare === "number" && strongestSibling && parentTotal > 0 ? parentShare - strongestSibling.totalScore / parentTotal : undefined,
|
|
4752
4796
|
path: section.path,
|
|
4797
|
+
firstSeenStage,
|
|
4798
|
+
lastSeenStage,
|
|
4753
4799
|
retrievalMode: trace?.mode,
|
|
4754
4800
|
reasons,
|
|
4755
4801
|
rerankApplied: trace?.steps.some((step) => step.stage === "rerank" && step.metadata?.applied === true),
|
|
4756
4802
|
scoreShare,
|
|
4757
4803
|
scoreThresholdApplied: trace?.steps.some((step) => step.stage === "score_filter"),
|
|
4804
|
+
stageCounts,
|
|
4805
|
+
stageWeights,
|
|
4758
4806
|
siblingCount: siblings.length,
|
|
4759
4807
|
siblingScoreGap: strongestSibling ? section.totalScore - strongestSibling.totalScore : undefined,
|
|
4760
4808
|
sourceCount: section.sourceSet.size,
|
|
@@ -8090,5 +8138,5 @@ export {
|
|
|
8090
8138
|
createAIStream
|
|
8091
8139
|
};
|
|
8092
8140
|
|
|
8093
|
-
//# debugId=
|
|
8141
|
+
//# debugId=F26E4DDE93B27DEF64756E2164756E21
|
|
8094
8142
|
//# sourceMappingURL=index.js.map
|