@absolutejs/absolute 0.19.0-beta.611 → 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 +40 -1
- package/dist/ai/client/index.js.map +3 -3
- package/dist/ai/client/ui.js +40 -1
- package/dist/ai/client/ui.js.map +3 -3
- package/dist/ai/index.js +41 -2
- package/dist/ai/index.js.map +4 -4
- package/dist/ai/rag/ui.js +40 -1
- package/dist/ai/rag/ui.js.map +3 -3
- package/dist/ai-client/angular/ai/index.js +39 -0
- package/dist/ai-client/react/ai/index.js +39 -0
- package/dist/ai-client/vue/ai/index.js +39 -0
- package/dist/angular/ai/index.js +40 -1
- package/dist/angular/ai/index.js.map +3 -3
- package/dist/react/ai/index.js +40 -1
- package/dist/react/ai/index.js.map +3 -3
- package/dist/svelte/ai/index.js +40 -1
- package/dist/svelte/ai/index.js.map +3 -3
- package/dist/types/ai.d.ts +12 -0
- package/dist/vue/ai/index.js +40 -1
- package/dist/vue/ai/index.js.map +3 -3
- package/package.json +1 -1
package/dist/types/ai.d.ts
CHANGED
|
@@ -66,6 +66,7 @@ export type RAGSourceSummary = {
|
|
|
66
66
|
structure?: RAGChunkStructure;
|
|
67
67
|
};
|
|
68
68
|
export type RAGSectionRetrievalReason = 'best_hit' | 'multi_hit_section' | 'dominant_within_parent' | 'only_section_in_parent' | 'concentrated_evidence';
|
|
69
|
+
export type RAGSectionTraceWeightReason = 'rerank_preserved_lead' | 'final_stage_concentration' | 'final_stage_dominant_within_parent' | 'stage_runner_up_pressure';
|
|
69
70
|
export type RAGSectionRetrievalDiagnostic = {
|
|
70
71
|
key: string;
|
|
71
72
|
label: string;
|
|
@@ -92,6 +93,17 @@ export type RAGSectionRetrievalDiagnostic = {
|
|
|
92
93
|
stage: RAGRetrievalTraceStage;
|
|
93
94
|
count: number;
|
|
94
95
|
}>;
|
|
96
|
+
stageWeights: Array<{
|
|
97
|
+
stage: RAGRetrievalTraceStage;
|
|
98
|
+
count: number;
|
|
99
|
+
stageShare: number;
|
|
100
|
+
parentStageShare?: number;
|
|
101
|
+
stageShareGap?: number;
|
|
102
|
+
parentStageShareGap?: number;
|
|
103
|
+
strongestSiblingLabel?: string;
|
|
104
|
+
strongestSiblingCount?: number;
|
|
105
|
+
reasons: RAGSectionTraceWeightReason[];
|
|
106
|
+
}>;
|
|
95
107
|
firstSeenStage?: RAGRetrievalTraceStage;
|
|
96
108
|
lastSeenStage?: RAGRetrievalTraceStage;
|
|
97
109
|
retrievalMode?: RAGHybridRetrievalMode;
|
package/dist/vue/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);
|
|
@@ -4722,6 +4724,42 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
4722
4724
|
count: step.sectionCounts?.find((entry) => entry.key === section.key)?.count ?? 0,
|
|
4723
4725
|
stage: step.stage
|
|
4724
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
|
+
});
|
|
4725
4763
|
const firstSeenStage = stageCounts[0]?.stage;
|
|
4726
4764
|
const lastSeenStage = stageCounts.at(-1)?.stage;
|
|
4727
4765
|
if (section.bestScore >= strongestBestHit) {
|
|
@@ -4764,6 +4802,7 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
4764
4802
|
scoreShare,
|
|
4765
4803
|
scoreThresholdApplied: trace?.steps.some((step) => step.stage === "score_filter"),
|
|
4766
4804
|
stageCounts,
|
|
4805
|
+
stageWeights,
|
|
4767
4806
|
siblingCount: siblings.length,
|
|
4768
4807
|
siblingScoreGap: strongestSibling ? section.totalScore - strongestSibling.totalScore : undefined,
|
|
4769
4808
|
sourceCount: section.sourceSet.size,
|
|
@@ -8070,5 +8109,5 @@ export {
|
|
|
8070
8109
|
AIStreamKey
|
|
8071
8110
|
};
|
|
8072
8111
|
|
|
8073
|
-
//# debugId=
|
|
8112
|
+
//# debugId=E536AFF01F55D6B764756E2164756E21
|
|
8074
8113
|
//# sourceMappingURL=index.js.map
|