@absolutejs/absolute 0.19.0-beta.520 → 0.19.0-beta.521
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 +67 -1
- package/dist/ai/client/index.js.map +3 -3
- package/dist/ai/index.js +68 -1
- package/dist/ai/index.js.map +3 -3
- package/dist/react/ai/index.js +67 -1
- package/dist/react/ai/index.js.map +3 -3
- package/dist/src/ai/index.d.ts +1 -1
- package/dist/src/ai/rag/index.d.ts +1 -1
- package/dist/src/ai/rag/quality.d.ts +5 -1
- package/dist/svelte/ai/index.js +67 -1
- package/dist/svelte/ai/index.js.map +3 -3
- package/dist/types/ai.d.ts +13 -0
- package/dist/vue/ai/index.js +67 -1
- package/dist/vue/ai/index.js.map +3 -3
- package/package.json +1 -1
package/dist/ai/client/index.js
CHANGED
|
@@ -1716,6 +1716,72 @@ var buildRAGAnswerGroundingEvaluationLeaderboard = (runs) => {
|
|
|
1716
1716
|
totalCases: run.response.totalCases
|
|
1717
1717
|
}));
|
|
1718
1718
|
};
|
|
1719
|
+
var buildRAGAnswerGroundingCaseDifficultyLeaderboard = (entries) => {
|
|
1720
|
+
const grouped = new Map;
|
|
1721
|
+
for (const entry of entries) {
|
|
1722
|
+
for (const result of entry.response.cases) {
|
|
1723
|
+
const current = grouped.get(result.caseId) ?? {
|
|
1724
|
+
caseId: result.caseId,
|
|
1725
|
+
failCount: 0,
|
|
1726
|
+
groundedCount: 0,
|
|
1727
|
+
label: result.label,
|
|
1728
|
+
passCount: 0,
|
|
1729
|
+
partialCount: 0,
|
|
1730
|
+
query: result.query,
|
|
1731
|
+
totalCitationF1: 0,
|
|
1732
|
+
totalEvaluations: 0,
|
|
1733
|
+
totalResolvedCitationRate: 0
|
|
1734
|
+
};
|
|
1735
|
+
current.label ??= result.label;
|
|
1736
|
+
current.query ??= result.query;
|
|
1737
|
+
current.totalEvaluations += 1;
|
|
1738
|
+
current.totalCitationF1 += result.citationF1;
|
|
1739
|
+
current.totalResolvedCitationRate += result.resolvedCitationRate;
|
|
1740
|
+
if (result.status === "pass") {
|
|
1741
|
+
current.passCount += 1;
|
|
1742
|
+
} else if (result.status === "partial") {
|
|
1743
|
+
current.partialCount += 1;
|
|
1744
|
+
} else {
|
|
1745
|
+
current.failCount += 1;
|
|
1746
|
+
}
|
|
1747
|
+
if (result.coverage === "grounded") {
|
|
1748
|
+
current.groundedCount += 1;
|
|
1749
|
+
}
|
|
1750
|
+
grouped.set(result.caseId, current);
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
const ranked = Array.from(grouped.values()).sort((left, right) => {
|
|
1754
|
+
const leftPassRate = left.passCount / left.totalEvaluations;
|
|
1755
|
+
const rightPassRate = right.passCount / right.totalEvaluations;
|
|
1756
|
+
if (leftPassRate !== rightPassRate) {
|
|
1757
|
+
return leftPassRate - rightPassRate;
|
|
1758
|
+
}
|
|
1759
|
+
const leftCitationF1 = left.totalCitationF1 / left.totalEvaluations;
|
|
1760
|
+
const rightCitationF1 = right.totalCitationF1 / right.totalEvaluations;
|
|
1761
|
+
if (leftCitationF1 !== rightCitationF1) {
|
|
1762
|
+
return leftCitationF1 - rightCitationF1;
|
|
1763
|
+
}
|
|
1764
|
+
const leftResolved = left.totalResolvedCitationRate / left.totalEvaluations;
|
|
1765
|
+
const rightResolved = right.totalResolvedCitationRate / right.totalEvaluations;
|
|
1766
|
+
if (leftResolved !== rightResolved) {
|
|
1767
|
+
return leftResolved - rightResolved;
|
|
1768
|
+
}
|
|
1769
|
+
return left.caseId.localeCompare(right.caseId);
|
|
1770
|
+
});
|
|
1771
|
+
return ranked.map((entry, index) => ({
|
|
1772
|
+
averageCitationF1: entry.totalCitationF1 / entry.totalEvaluations,
|
|
1773
|
+
averageResolvedCitationRate: entry.totalResolvedCitationRate / entry.totalEvaluations,
|
|
1774
|
+
caseId: entry.caseId,
|
|
1775
|
+
failRate: entry.failCount / entry.totalEvaluations * 100,
|
|
1776
|
+
groundedRate: entry.groundedCount / entry.totalEvaluations * 100,
|
|
1777
|
+
label: entry.label,
|
|
1778
|
+
passRate: entry.passCount / entry.totalEvaluations * 100,
|
|
1779
|
+
partialRate: entry.partialCount / entry.totalEvaluations * 100,
|
|
1780
|
+
query: entry.query,
|
|
1781
|
+
rank: index + 1,
|
|
1782
|
+
totalEvaluations: entry.totalEvaluations
|
|
1783
|
+
}));
|
|
1784
|
+
};
|
|
1719
1785
|
var toHistorySortOrder = (left, right) => right.finishedAt - left.finishedAt;
|
|
1720
1786
|
var normalizeHistoryRuns = (runs) => [...runs].sort(toHistorySortOrder);
|
|
1721
1787
|
var toGroundingHistorySortOrder = (left, right) => right.finishedAt - left.finishedAt;
|
|
@@ -2345,5 +2411,5 @@ export {
|
|
|
2345
2411
|
buildRAGAnswerWorkflowState
|
|
2346
2412
|
};
|
|
2347
2413
|
|
|
2348
|
-
//# debugId=
|
|
2414
|
+
//# debugId=5A1E0C153D15DC7364756E2164756E21
|
|
2349
2415
|
//# sourceMappingURL=index.js.map
|