@absolutejs/absolute 0.19.0-beta.610 → 0.19.0-beta.611
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 +10 -1
- package/dist/ai/client/index.js.map +3 -3
- package/dist/ai/client/ui.js +10 -1
- package/dist/ai/client/ui.js.map +3 -3
- package/dist/ai/index.js +46 -2
- package/dist/ai/index.js.map +5 -5
- package/dist/ai/rag/ui.js +10 -1
- package/dist/ai/rag/ui.js.map +3 -3
- package/dist/ai-client/angular/ai/index.js +9 -0
- package/dist/ai-client/react/ai/index.js +9 -0
- package/dist/ai-client/vue/ai/index.js +9 -0
- package/dist/angular/ai/index.js +10 -1
- package/dist/angular/ai/index.js.map +3 -3
- package/dist/react/ai/index.js +10 -1
- package/dist/react/ai/index.js.map +3 -3
- package/dist/svelte/ai/index.js +10 -1
- package/dist/svelte/ai/index.js.map +3 -3
- package/dist/types/ai.d.ts +11 -0
- package/dist/vue/ai/index.js +10 -1
- package/dist/vue/ai/index.js.map +3 -3
- package/package.json +1 -1
package/dist/ai/index.js
CHANGED
|
@@ -4718,6 +4718,12 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
4718
4718
|
totalScore: entry.totalScore
|
|
4719
4719
|
})).sort((left, right) => right.totalScore - left.totalScore) : [];
|
|
4720
4720
|
const reasons = [];
|
|
4721
|
+
const stageCounts = trace?.steps.map((step) => ({
|
|
4722
|
+
count: step.sectionCounts?.find((entry) => entry.key === section.key)?.count ?? 0,
|
|
4723
|
+
stage: step.stage
|
|
4724
|
+
})).filter((entry) => entry.count > 0) ?? [];
|
|
4725
|
+
const firstSeenStage = stageCounts[0]?.stage;
|
|
4726
|
+
const lastSeenStage = stageCounts.at(-1)?.stage;
|
|
4721
4727
|
if (section.bestScore >= strongestBestHit) {
|
|
4722
4728
|
reasons.push("best_hit");
|
|
4723
4729
|
}
|
|
@@ -4750,11 +4756,14 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
4750
4756
|
parentShare,
|
|
4751
4757
|
parentShareGap: typeof parentShare === "number" && strongestSibling && parentTotal > 0 ? parentShare - strongestSibling.totalScore / parentTotal : undefined,
|
|
4752
4758
|
path: section.path,
|
|
4759
|
+
firstSeenStage,
|
|
4760
|
+
lastSeenStage,
|
|
4753
4761
|
retrievalMode: trace?.mode,
|
|
4754
4762
|
reasons,
|
|
4755
4763
|
rerankApplied: trace?.steps.some((step) => step.stage === "rerank" && step.metadata?.applied === true),
|
|
4756
4764
|
scoreShare,
|
|
4757
4765
|
scoreThresholdApplied: trace?.steps.some((step) => step.stage === "score_filter"),
|
|
4766
|
+
stageCounts,
|
|
4758
4767
|
siblingCount: siblings.length,
|
|
4759
4768
|
siblingScoreGap: strongestSibling ? section.totalScore - strongestSibling.totalScore : undefined,
|
|
4760
4769
|
sourceCount: section.sourceSet.size,
|
|
@@ -10548,6 +10557,32 @@ var annotateRetrievalChannels = (input) => {
|
|
|
10548
10557
|
};
|
|
10549
10558
|
});
|
|
10550
10559
|
};
|
|
10560
|
+
var buildTraceSectionCounts = (results) => {
|
|
10561
|
+
const sections = new Map;
|
|
10562
|
+
for (const result of results) {
|
|
10563
|
+
const path = Array.isArray(result.metadata?.sectionPath) ? result.metadata.sectionPath.filter((value) => typeof value === "string" && value.trim().length > 0) : [];
|
|
10564
|
+
if (path.length === 0) {
|
|
10565
|
+
continue;
|
|
10566
|
+
}
|
|
10567
|
+
const key = path.join(" > ");
|
|
10568
|
+
const existing = sections.get(key);
|
|
10569
|
+
if (existing) {
|
|
10570
|
+
existing.count += 1;
|
|
10571
|
+
continue;
|
|
10572
|
+
}
|
|
10573
|
+
sections.set(key, {
|
|
10574
|
+
count: 1,
|
|
10575
|
+
key,
|
|
10576
|
+
label: path.at(-1) ?? key
|
|
10577
|
+
});
|
|
10578
|
+
}
|
|
10579
|
+
return [...sections.values()].sort((left, right) => {
|
|
10580
|
+
if (right.count !== left.count) {
|
|
10581
|
+
return right.count - left.count;
|
|
10582
|
+
}
|
|
10583
|
+
return left.key.localeCompare(right.key);
|
|
10584
|
+
});
|
|
10585
|
+
};
|
|
10551
10586
|
var shouldRunVectorRetrieval = (mode) => mode === "vector" || mode === "hybrid";
|
|
10552
10587
|
var shouldRunLexicalRetrieval = (mode, store) => mode === "lexical" || mode === "hybrid" && Boolean(store.queryLexical);
|
|
10553
10588
|
var createRAGCollection = (options) => {
|
|
@@ -10661,6 +10696,7 @@ var createRAGCollection = (options) => {
|
|
|
10661
10696
|
queryCount: searchQueries.length,
|
|
10662
10697
|
topK: candidateTopK
|
|
10663
10698
|
},
|
|
10699
|
+
sectionCounts: buildTraceSectionCounts(vectorResults),
|
|
10664
10700
|
stage: "vector_search"
|
|
10665
10701
|
});
|
|
10666
10702
|
}
|
|
@@ -10673,6 +10709,7 @@ var createRAGCollection = (options) => {
|
|
|
10673
10709
|
queryCount: searchQueries.length,
|
|
10674
10710
|
topK: lexicalTopK
|
|
10675
10711
|
},
|
|
10712
|
+
sectionCounts: buildTraceSectionCounts(lexicalResults),
|
|
10676
10713
|
stage: "lexical_search"
|
|
10677
10714
|
});
|
|
10678
10715
|
}
|
|
@@ -10690,6 +10727,7 @@ var createRAGCollection = (options) => {
|
|
|
10690
10727
|
metadata: {
|
|
10691
10728
|
mode: retrieval.mode
|
|
10692
10729
|
},
|
|
10730
|
+
sectionCounts: buildTraceSectionCounts(results),
|
|
10693
10731
|
stage: "fusion"
|
|
10694
10732
|
});
|
|
10695
10733
|
const rerankInput = {
|
|
@@ -10712,6 +10750,7 @@ var createRAGCollection = (options) => {
|
|
|
10712
10750
|
metadata: {
|
|
10713
10751
|
applied: hasReranker
|
|
10714
10752
|
},
|
|
10753
|
+
sectionCounts: buildTraceSectionCounts(reranked),
|
|
10715
10754
|
stage: "rerank"
|
|
10716
10755
|
});
|
|
10717
10756
|
const diversityAdjusted = retrieval.diversityStrategy === "mmr" ? applyRAGMMRDiversity(reranked, queryVector, retrieval.mmrLambda) : reranked;
|
|
@@ -10723,6 +10762,7 @@ var createRAGCollection = (options) => {
|
|
|
10723
10762
|
applied: queryVector.length > 0 && diversityAdjusted.some((entry) => Array.isArray(entry.embedding)),
|
|
10724
10763
|
mmrLambda: retrieval.mmrLambda
|
|
10725
10764
|
},
|
|
10765
|
+
sectionCounts: buildTraceSectionCounts(diversityAdjusted),
|
|
10726
10766
|
stage: "diversity"
|
|
10727
10767
|
});
|
|
10728
10768
|
}
|
|
@@ -10735,6 +10775,7 @@ var createRAGCollection = (options) => {
|
|
|
10735
10775
|
maxResultsPerSource: retrieval.maxResultsPerSource,
|
|
10736
10776
|
strategy: retrieval.sourceBalanceStrategy
|
|
10737
10777
|
},
|
|
10778
|
+
sectionCounts: buildTraceSectionCounts(diversified),
|
|
10738
10779
|
stage: "source_balance"
|
|
10739
10780
|
});
|
|
10740
10781
|
}
|
|
@@ -10750,6 +10791,7 @@ var createRAGCollection = (options) => {
|
|
|
10750
10791
|
metadata: {
|
|
10751
10792
|
appliedScoreThreshold: false
|
|
10752
10793
|
},
|
|
10794
|
+
sectionCounts: buildTraceSectionCounts(limited),
|
|
10753
10795
|
stage: "finalize"
|
|
10754
10796
|
});
|
|
10755
10797
|
return {
|
|
@@ -10787,6 +10829,7 @@ var createRAGCollection = (options) => {
|
|
|
10787
10829
|
metadata: {
|
|
10788
10830
|
scoreThreshold
|
|
10789
10831
|
},
|
|
10832
|
+
sectionCounts: buildTraceSectionCounts(filtered),
|
|
10790
10833
|
stage: "score_filter"
|
|
10791
10834
|
});
|
|
10792
10835
|
steps.push({
|
|
@@ -10795,6 +10838,7 @@ var createRAGCollection = (options) => {
|
|
|
10795
10838
|
metadata: {
|
|
10796
10839
|
appliedScoreThreshold: true
|
|
10797
10840
|
},
|
|
10841
|
+
sectionCounts: buildTraceSectionCounts(filtered),
|
|
10798
10842
|
stage: "finalize"
|
|
10799
10843
|
});
|
|
10800
10844
|
return {
|
|
@@ -10913,7 +10957,7 @@ var renderSectionDiagnostics = (diagnostics) => {
|
|
|
10913
10957
|
if (diagnostics.length === 0) {
|
|
10914
10958
|
return "";
|
|
10915
10959
|
}
|
|
10916
|
-
return `<section class="rag-search-results"><h3>Section diagnostics</h3>` + diagnostics.map((diagnostic) => `<article class="rag-search-result" id="rag-section-diagnostic-${escapeHtml2(diagnostic.key)}">` + `<h4>${escapeHtml2(diagnostic.path?.join(" > ") ?? diagnostic.label)}</h4>` + `<p class="rag-search-source">${escapeHtml2(diagnostic.summary)}</p>` + `<ul class="rag-source-labels">` + `<li><strong>Top hit</strong> ${diagnostic.bestScore.toFixed(RAG_SEARCH_SCORE_DECIMAL_PLACES)}</li>` + `<li><strong>Average</strong> ${diagnostic.averageScore.toFixed(RAG_SEARCH_SCORE_DECIMAL_PLACES)}</li>` + `<li><strong>Sources</strong> ${diagnostic.sourceCount}</li>` + `<li><strong>Channels</strong> vector ${diagnostic.vectorHits} \xB7 lexical ${diagnostic.lexicalHits} \xB7 hybrid ${diagnostic.hybridHits}</li>` + `${diagnostic.retrievalMode ? `<li><strong>Trace mode</strong> ${escapeHtml2(diagnostic.retrievalMode)}</li>` : ""}` + `${diagnostic.rerankApplied !== undefined ? `<li><strong>Rerank</strong> ${diagnostic.rerankApplied ? "applied" : "skipped"}</li>` : ""}` + `${diagnostic.sourceBalanceApplied ? `<li><strong>Source balance</strong> applied</li>` : ""}` + `${diagnostic.scoreThresholdApplied ? `<li><strong>Score threshold</strong> applied</li>` : ""}` + `<li><strong>Reasons</strong> ${escapeHtml2(diagnostic.reasons.join(", ") || "none")}</li>` + `${diagnostic.strongestSiblingLabel ? `<li><strong>Strongest sibling</strong> ${escapeHtml2(diagnostic.strongestSiblingLabel)} (${diagnostic.strongestSiblingScore?.toFixed(RAG_SEARCH_SCORE_DECIMAL_PLACES) ?? "n/a"})</li>` : ""}` + `${typeof diagnostic.parentShareGap === "number" ? `<li><strong>Parent share gap</strong> ${(diagnostic.parentShareGap * 100).toFixed(0)}%</li>` : ""}` + `</ul>` + `${diagnostic.parentDistribution.length > 0 ? `<ul class="rag-source-labels">${diagnostic.parentDistribution.map((entry) => `<li><strong>${entry.isActive ? "Active section" : "Peer section"}</strong> ${escapeHtml2(entry.label)} \xB7 ${(entry.parentShare * 100).toFixed(0)}% \xB7 ${entry.count} hit${entry.count === 1 ? "" : "s"}</li>`).join("")}</ul>` : ""}` + `</article>`).join("") + `</section>`;
|
|
10960
|
+
return `<section class="rag-search-results"><h3>Section diagnostics</h3>` + diagnostics.map((diagnostic) => `<article class="rag-search-result" id="rag-section-diagnostic-${escapeHtml2(diagnostic.key)}">` + `<h4>${escapeHtml2(diagnostic.path?.join(" > ") ?? diagnostic.label)}</h4>` + `<p class="rag-search-source">${escapeHtml2(diagnostic.summary)}</p>` + `<ul class="rag-source-labels">` + `<li><strong>Top hit</strong> ${diagnostic.bestScore.toFixed(RAG_SEARCH_SCORE_DECIMAL_PLACES)}</li>` + `<li><strong>Average</strong> ${diagnostic.averageScore.toFixed(RAG_SEARCH_SCORE_DECIMAL_PLACES)}</li>` + `<li><strong>Sources</strong> ${diagnostic.sourceCount}</li>` + `<li><strong>Channels</strong> vector ${diagnostic.vectorHits} \xB7 lexical ${diagnostic.lexicalHits} \xB7 hybrid ${diagnostic.hybridHits}</li>` + `${diagnostic.stageCounts.length > 0 ? `<li><strong>Stage flow</strong> ${escapeHtml2(diagnostic.stageCounts.map((entry) => `${entry.stage} ${entry.count}`).join(" \u2192 "))}</li>` : ""}` + `${diagnostic.firstSeenStage ? `<li><strong>First seen</strong> ${escapeHtml2(diagnostic.firstSeenStage)}</li>` : ""}` + `${diagnostic.lastSeenStage ? `<li><strong>Last seen</strong> ${escapeHtml2(diagnostic.lastSeenStage)}</li>` : ""}` + `${diagnostic.retrievalMode ? `<li><strong>Trace mode</strong> ${escapeHtml2(diagnostic.retrievalMode)}</li>` : ""}` + `${diagnostic.rerankApplied !== undefined ? `<li><strong>Rerank</strong> ${diagnostic.rerankApplied ? "applied" : "skipped"}</li>` : ""}` + `${diagnostic.sourceBalanceApplied ? `<li><strong>Source balance</strong> applied</li>` : ""}` + `${diagnostic.scoreThresholdApplied ? `<li><strong>Score threshold</strong> applied</li>` : ""}` + `<li><strong>Reasons</strong> ${escapeHtml2(diagnostic.reasons.join(", ") || "none")}</li>` + `${diagnostic.strongestSiblingLabel ? `<li><strong>Strongest sibling</strong> ${escapeHtml2(diagnostic.strongestSiblingLabel)} (${diagnostic.strongestSiblingScore?.toFixed(RAG_SEARCH_SCORE_DECIMAL_PLACES) ?? "n/a"})</li>` : ""}` + `${typeof diagnostic.parentShareGap === "number" ? `<li><strong>Parent share gap</strong> ${(diagnostic.parentShareGap * 100).toFixed(0)}%</li>` : ""}` + `</ul>` + `${diagnostic.parentDistribution.length > 0 ? `<ul class="rag-source-labels">${diagnostic.parentDistribution.map((entry) => `<li><strong>${entry.isActive ? "Active section" : "Peer section"}</strong> ${escapeHtml2(entry.label)} \xB7 ${(entry.parentShare * 100).toFixed(0)}% \xB7 ${entry.count} hit${entry.count === 1 ? "" : "s"}</li>`).join("")}</ul>` : ""}` + `</article>`).join("") + `</section>`;
|
|
10917
10961
|
};
|
|
10918
10962
|
var renderEmptyState = (kind) => {
|
|
10919
10963
|
switch (kind) {
|
|
@@ -22208,5 +22252,5 @@ export {
|
|
|
22208
22252
|
aiChat
|
|
22209
22253
|
};
|
|
22210
22254
|
|
|
22211
|
-
//# debugId=
|
|
22255
|
+
//# debugId=405B1228CB22607264756E2164756E21
|
|
22212
22256
|
//# sourceMappingURL=index.js.map
|