@absolutejs/absolute 0.19.0-beta.612 → 0.19.0-beta.614
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 +160 -11
- 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/angular/index.js +2 -2
- package/dist/angular/index.js.map +1 -1
- package/dist/angular/server.js +2 -2
- package/dist/angular/server.js.map +1 -1
- package/dist/build.js +2 -2
- package/dist/build.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- 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/svelte/ai/index.js
CHANGED
|
@@ -4668,6 +4668,10 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
4668
4668
|
const vectorHits = channels.includes("vector") ? 1 : 0;
|
|
4669
4669
|
const lexicalHits = channels.includes("lexical") ? 1 : 0;
|
|
4670
4670
|
const hybridHits = isHybrid ? 1 : 0;
|
|
4671
|
+
const queryOrigins = Array.isArray(source.metadata?.retrievalQueryOrigins) ? source.metadata.retrievalQueryOrigins.filter((value) => value === "primary" || value === "transformed" || value === "variant") : source.metadata?.retrievalQueryOrigin === "primary" || source.metadata?.retrievalQueryOrigin === "transformed" || source.metadata?.retrievalQueryOrigin === "variant" ? [source.metadata.retrievalQueryOrigin] : [];
|
|
4672
|
+
const primaryHits = queryOrigins.includes("primary") ? 1 : 0;
|
|
4673
|
+
const transformedHits = queryOrigins.includes("transformed") ? 1 : 0;
|
|
4674
|
+
const variantHits = queryOrigins.includes("variant") ? 1 : 0;
|
|
4671
4675
|
if (!existing) {
|
|
4672
4676
|
sections.set(key, {
|
|
4673
4677
|
bestScore: source.score,
|
|
@@ -4678,10 +4682,13 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
4678
4682
|
lexicalHits,
|
|
4679
4683
|
parentLabel,
|
|
4680
4684
|
path,
|
|
4685
|
+
primaryHits,
|
|
4681
4686
|
sourceSet: new Set(source.source ? [source.source] : []),
|
|
4682
4687
|
topChunkId: source.chunkId,
|
|
4683
4688
|
topSource: source.source,
|
|
4684
4689
|
totalScore: source.score,
|
|
4690
|
+
transformedHits,
|
|
4691
|
+
variantHits,
|
|
4685
4692
|
vectorHits
|
|
4686
4693
|
});
|
|
4687
4694
|
continue;
|
|
@@ -4694,6 +4701,9 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
4694
4701
|
existing.vectorHits += vectorHits;
|
|
4695
4702
|
existing.lexicalHits += lexicalHits;
|
|
4696
4703
|
existing.hybridHits += hybridHits;
|
|
4704
|
+
existing.primaryHits += primaryHits;
|
|
4705
|
+
existing.transformedHits += transformedHits;
|
|
4706
|
+
existing.variantHits += variantHits;
|
|
4697
4707
|
if (source.score > existing.bestScore) {
|
|
4698
4708
|
existing.bestScore = source.score;
|
|
4699
4709
|
existing.topChunkId = source.chunkId;
|
|
@@ -4704,6 +4714,7 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
4704
4714
|
const strongestBestHit = diagnostics.reduce((highest, section) => Math.max(highest, section.bestScore), 0);
|
|
4705
4715
|
const parentLabelByKey = new Map(diagnostics.map((section) => [section.key, section.parentLabel]));
|
|
4706
4716
|
const stageSectionCounts = new Map((trace?.steps ?? []).filter((step) => Array.isArray(step.sectionCounts) && step.sectionCounts.length > 0).map((step) => [step.stage, step.sectionCounts ?? []]));
|
|
4717
|
+
const stageSectionScores = new Map((trace?.steps ?? []).filter((step) => Array.isArray(step.sectionScores) && step.sectionScores.length > 0).map((step) => [step.stage, step.sectionScores ?? []]));
|
|
4707
4718
|
return diagnostics.map((section) => {
|
|
4708
4719
|
const siblingPool = diagnostics.filter((entry) => entry.parentLabel === section.parentLabel);
|
|
4709
4720
|
const siblings = siblingPool.filter((entry) => entry.key !== section.key);
|
|
@@ -4725,16 +4736,30 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
4725
4736
|
stage: step.stage
|
|
4726
4737
|
})).filter((entry) => entry.count > 0) ?? [];
|
|
4727
4738
|
const stageWeights = stageCounts.map((entry) => {
|
|
4739
|
+
const previousStageEntry = stageCounts[stageCounts.findIndex((candidate) => candidate.stage === entry.stage) - 1];
|
|
4728
4740
|
const stageEntries = stageSectionCounts.get(entry.stage)?.filter((candidate) => candidate.count > 0) ?? [];
|
|
4741
|
+
const stageScoreEntries = stageSectionScores.get(entry.stage)?.filter((candidate) => candidate.totalScore > 0) ?? [];
|
|
4729
4742
|
const stageTotal = stageEntries.reduce((sum, candidate) => sum + candidate.count, 0);
|
|
4743
|
+
const stageScoreTotal = stageScoreEntries.reduce((sum, candidate) => sum + candidate.totalScore, 0);
|
|
4730
4744
|
const siblingStageEntries = stageEntries.filter((candidate) => candidate.key !== section.key && parentLabelByKey.get(candidate.key) === section.parentLabel);
|
|
4731
4745
|
const parentStageEntries = stageEntries.filter((candidate) => parentLabelByKey.get(candidate.key) === section.parentLabel);
|
|
4746
|
+
const siblingStageScoreEntries = stageScoreEntries.filter((candidate) => candidate.key !== section.key && parentLabelByKey.get(candidate.key) === section.parentLabel);
|
|
4747
|
+
const parentStageScoreEntries = stageScoreEntries.filter((candidate) => parentLabelByKey.get(candidate.key) === section.parentLabel);
|
|
4732
4748
|
const strongestStageSibling = siblingStageEntries.slice().sort((left, right) => right.count - left.count)[0];
|
|
4733
4749
|
const parentStageTotal = parentStageEntries.reduce((sum, candidate) => sum + candidate.count, 0);
|
|
4750
|
+
const activeStageScore = stageScoreEntries.find((candidate) => candidate.key === section.key)?.totalScore;
|
|
4751
|
+
const strongestStageScoreSibling = siblingStageScoreEntries.slice().sort((left, right) => right.totalScore - left.totalScore)[0];
|
|
4752
|
+
const parentStageScoreTotal = parentStageScoreEntries.reduce((sum, candidate) => sum + candidate.totalScore, 0);
|
|
4734
4753
|
const stageShare = stageTotal > 0 ? entry.count / stageTotal : 0;
|
|
4754
|
+
const retentionRate = typeof previousStageEntry?.count === "number" && previousStageEntry.count > 0 ? entry.count / previousStageEntry.count : undefined;
|
|
4755
|
+
const countDelta = typeof previousStageEntry?.count === "number" ? entry.count - previousStageEntry.count : undefined;
|
|
4735
4756
|
const parentStageShare = parentStageTotal > 0 ? entry.count / parentStageTotal : undefined;
|
|
4757
|
+
const stageScoreShare = typeof activeStageScore === "number" && stageScoreTotal > 0 ? activeStageScore / stageScoreTotal : undefined;
|
|
4758
|
+
const parentStageScoreShare = typeof activeStageScore === "number" && parentStageScoreTotal > 0 ? activeStageScore / parentStageScoreTotal : undefined;
|
|
4736
4759
|
const stageShareGap = stageTotal > 0 && strongestStageSibling ? entry.count / stageTotal - strongestStageSibling.count / stageTotal : undefined;
|
|
4737
4760
|
const parentStageShareGap = parentStageTotal > 0 && strongestStageSibling ? entry.count / parentStageTotal - strongestStageSibling.count / parentStageTotal : undefined;
|
|
4761
|
+
const stageScoreShareGap = typeof activeStageScore === "number" && stageScoreTotal > 0 && strongestStageScoreSibling ? activeStageScore / stageScoreTotal - strongestStageScoreSibling.totalScore / stageScoreTotal : undefined;
|
|
4762
|
+
const parentStageScoreShareGap = typeof activeStageScore === "number" && parentStageScoreTotal > 0 && strongestStageScoreSibling ? activeStageScore / parentStageScoreTotal - strongestStageScoreSibling.totalScore / parentStageScoreTotal : undefined;
|
|
4738
4763
|
const reasons2 = [];
|
|
4739
4764
|
if (entry.stage === "rerank" && stageShare > 0.5 && (typeof stageShareGap !== "number" || stageShareGap > 0)) {
|
|
4740
4765
|
reasons2.push("rerank_preserved_lead");
|
|
@@ -4748,20 +4773,65 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
4748
4773
|
if (strongestStageSibling && (typeof stageShareGap === "number" && stageShareGap <= 0.1 || typeof parentStageShareGap === "number" && parentStageShareGap <= 0.1)) {
|
|
4749
4774
|
reasons2.push("stage_runner_up_pressure");
|
|
4750
4775
|
}
|
|
4776
|
+
if (typeof countDelta === "number") {
|
|
4777
|
+
if (countDelta > 0) {
|
|
4778
|
+
reasons2.push("stage_expanded");
|
|
4779
|
+
} else if (countDelta < 0) {
|
|
4780
|
+
reasons2.push("stage_narrowed");
|
|
4781
|
+
} else {
|
|
4782
|
+
reasons2.push("stage_held");
|
|
4783
|
+
}
|
|
4784
|
+
}
|
|
4751
4785
|
return {
|
|
4752
4786
|
count: entry.count,
|
|
4787
|
+
countDelta,
|
|
4788
|
+
parentStageScoreShare,
|
|
4753
4789
|
parentStageShare,
|
|
4754
4790
|
parentStageShareGap,
|
|
4791
|
+
previousCount: previousStageEntry?.count,
|
|
4792
|
+
previousStage: previousStageEntry?.stage,
|
|
4755
4793
|
reasons: reasons2,
|
|
4794
|
+
retentionRate,
|
|
4756
4795
|
stage: entry.stage,
|
|
4796
|
+
stageScoreShare,
|
|
4797
|
+
stageScoreShareGap,
|
|
4757
4798
|
stageShare,
|
|
4758
4799
|
stageShareGap,
|
|
4800
|
+
totalScore: activeStageScore,
|
|
4759
4801
|
strongestSiblingCount: strongestStageSibling?.count,
|
|
4760
4802
|
strongestSiblingLabel: strongestStageSibling ? diagnostics.find((candidate) => candidate.key === strongestStageSibling.key)?.label ?? strongestStageSibling.key : undefined
|
|
4761
4803
|
};
|
|
4762
4804
|
});
|
|
4763
4805
|
const firstSeenStage = stageCounts[0]?.stage;
|
|
4764
4806
|
const lastSeenStage = stageCounts.at(-1)?.stage;
|
|
4807
|
+
const peakStageEntry = stageCounts.reduce((highest, entry) => !highest || entry.count > highest.count ? entry : highest, undefined);
|
|
4808
|
+
const finalStageEntry = stageCounts.at(-1);
|
|
4809
|
+
const peakCount = peakStageEntry?.count ?? section.count;
|
|
4810
|
+
const finalCount = finalStageEntry?.count;
|
|
4811
|
+
const finalRetentionRate = typeof finalCount === "number" && peakCount > 0 ? finalCount / peakCount : undefined;
|
|
4812
|
+
const dropFromPeak = typeof finalCount === "number" ? peakCount - finalCount : undefined;
|
|
4813
|
+
const queryAttributionReasons = [];
|
|
4814
|
+
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";
|
|
4815
|
+
if (queryAttributionMode === "primary") {
|
|
4816
|
+
queryAttributionReasons.push("base_query_only");
|
|
4817
|
+
}
|
|
4818
|
+
if (queryAttributionMode === "transformed") {
|
|
4819
|
+
queryAttributionReasons.push("transformed_query_only");
|
|
4820
|
+
queryAttributionReasons.push("transform_introduced");
|
|
4821
|
+
}
|
|
4822
|
+
if (queryAttributionMode === "variant") {
|
|
4823
|
+
queryAttributionReasons.push("variant_only");
|
|
4824
|
+
queryAttributionReasons.push("variant_supported");
|
|
4825
|
+
}
|
|
4826
|
+
if (queryAttributionMode === "mixed") {
|
|
4827
|
+
queryAttributionReasons.push("mixed_query_sources");
|
|
4828
|
+
if (section.variantHits > 0) {
|
|
4829
|
+
queryAttributionReasons.push("variant_supported");
|
|
4830
|
+
}
|
|
4831
|
+
if (section.transformedHits > 0 && section.primaryHits === 0) {
|
|
4832
|
+
queryAttributionReasons.push("transform_introduced");
|
|
4833
|
+
}
|
|
4834
|
+
}
|
|
4765
4835
|
if (section.bestScore >= strongestBestHit) {
|
|
4766
4836
|
reasons.push("best_hit");
|
|
4767
4837
|
}
|
|
@@ -4795,7 +4865,19 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
4795
4865
|
parentShareGap: typeof parentShare === "number" && strongestSibling && parentTotal > 0 ? parentShare - strongestSibling.totalScore / parentTotal : undefined,
|
|
4796
4866
|
path: section.path,
|
|
4797
4867
|
firstSeenStage,
|
|
4868
|
+
finalCount,
|
|
4869
|
+
finalRetentionRate,
|
|
4798
4870
|
lastSeenStage,
|
|
4871
|
+
dropFromPeak,
|
|
4872
|
+
peakCount,
|
|
4873
|
+
peakStage: peakStageEntry?.stage,
|
|
4874
|
+
queryAttribution: {
|
|
4875
|
+
mode: queryAttributionMode,
|
|
4876
|
+
primaryHits: section.primaryHits,
|
|
4877
|
+
reasons: queryAttributionReasons,
|
|
4878
|
+
transformedHits: section.transformedHits,
|
|
4879
|
+
variantHits: section.variantHits
|
|
4880
|
+
},
|
|
4799
4881
|
retrievalMode: trace?.mode,
|
|
4800
4882
|
reasons,
|
|
4801
4883
|
rerankApplied: trace?.steps.some((step) => step.stage === "rerank" && step.metadata?.applied === true),
|
|
@@ -8138,5 +8220,5 @@ export {
|
|
|
8138
8220
|
createAIStream
|
|
8139
8221
|
};
|
|
8140
8222
|
|
|
8141
|
-
//# debugId=
|
|
8223
|
+
//# debugId=C6968126E498A97164756E2164756E21
|
|
8142
8224
|
//# sourceMappingURL=index.js.map
|