@absolutejs/absolute 0.19.0-beta.516 → 0.19.0-beta.518
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 +108 -1
- package/dist/ai/client/index.js.map +3 -3
- package/dist/ai/index.js +113 -1
- package/dist/ai/index.js.map +4 -4
- package/dist/react/ai/index.js +108 -1
- package/dist/react/ai/index.js.map +3 -3
- package/dist/src/ai/index.d.ts +2 -2
- package/dist/src/ai/rag/index.d.ts +2 -1
- package/dist/src/ai/rag/quality.d.ts +15 -1
- package/dist/src/ai/rag/types.d.ts +1 -1
- package/dist/svelte/ai/index.js +108 -1
- package/dist/svelte/ai/index.js.map +3 -3
- package/dist/types/ai.d.ts +54 -0
- package/dist/vue/ai/index.js +108 -1
- package/dist/vue/ai/index.js.map +3 -3
- package/package.json +1 -1
package/dist/react/ai/index.js
CHANGED
|
@@ -1694,6 +1694,8 @@ var buildRAGEvaluationLeaderboard = (runs) => {
|
|
|
1694
1694
|
};
|
|
1695
1695
|
var toHistorySortOrder = (left, right) => right.finishedAt - left.finishedAt;
|
|
1696
1696
|
var normalizeHistoryRuns = (runs) => [...runs].sort(toHistorySortOrder);
|
|
1697
|
+
var toGroundingHistorySortOrder = (left, right) => right.finishedAt - left.finishedAt;
|
|
1698
|
+
var normalizeGroundingHistoryRuns = (runs) => [...runs].sort(toGroundingHistorySortOrder);
|
|
1697
1699
|
var buildCaseDiff = (currentCase, previousCase) => ({
|
|
1698
1700
|
caseId: currentCase.caseId,
|
|
1699
1701
|
currentF1: currentCase.f1,
|
|
@@ -1707,6 +1709,19 @@ var buildCaseDiff = (currentCase, previousCase) => ({
|
|
|
1707
1709
|
previousStatus: previousCase?.status,
|
|
1708
1710
|
query: currentCase.query
|
|
1709
1711
|
});
|
|
1712
|
+
var buildGroundingCaseDiff = (currentCase, previousCase) => ({
|
|
1713
|
+
caseId: currentCase.caseId,
|
|
1714
|
+
currentCitationF1: currentCase.citationF1,
|
|
1715
|
+
currentMatchedIds: currentCase.matchedIds,
|
|
1716
|
+
currentMissingIds: currentCase.missingIds,
|
|
1717
|
+
currentStatus: currentCase.status,
|
|
1718
|
+
label: currentCase.label,
|
|
1719
|
+
previousCitationF1: previousCase?.citationF1,
|
|
1720
|
+
previousMatchedIds: previousCase?.matchedIds ?? [],
|
|
1721
|
+
previousMissingIds: previousCase?.missingIds ?? [],
|
|
1722
|
+
previousStatus: previousCase?.status,
|
|
1723
|
+
query: currentCase.query
|
|
1724
|
+
});
|
|
1710
1725
|
var getStatusRank = (status) => status === "pass" ? 2 : status === "partial" ? 1 : 0;
|
|
1711
1726
|
var buildRAGEvaluationRunDiff = ({
|
|
1712
1727
|
current,
|
|
@@ -1734,6 +1749,32 @@ var buildRAGEvaluationRunDiff = ({
|
|
|
1734
1749
|
unchangedCases
|
|
1735
1750
|
};
|
|
1736
1751
|
};
|
|
1752
|
+
var buildRAGAnswerGroundingEvaluationRunDiff = ({
|
|
1753
|
+
current,
|
|
1754
|
+
previous
|
|
1755
|
+
}) => {
|
|
1756
|
+
const previousCases = new Map((previous?.response.cases ?? []).map((entry) => [entry.caseId, entry]));
|
|
1757
|
+
const diffs = current.response.cases.map((entry) => buildGroundingCaseDiff(entry, previousCases.get(entry.caseId)));
|
|
1758
|
+
const regressedCases = diffs.filter((entry) => getStatusRank(entry.currentStatus) < getStatusRank(entry.previousStatus ?? "fail"));
|
|
1759
|
+
const improvedCases = diffs.filter((entry) => getStatusRank(entry.currentStatus) > getStatusRank(entry.previousStatus ?? "fail"));
|
|
1760
|
+
const unchangedCases = diffs.filter((entry) => getStatusRank(entry.currentStatus) === getStatusRank(entry.previousStatus ?? "fail"));
|
|
1761
|
+
return {
|
|
1762
|
+
currentRunId: current.id,
|
|
1763
|
+
improvedCases,
|
|
1764
|
+
previousRunId: previous?.id,
|
|
1765
|
+
regressedCases,
|
|
1766
|
+
suiteId: current.suiteId,
|
|
1767
|
+
summaryDelta: {
|
|
1768
|
+
averageCitationF1: current.response.summary.averageCitationF1 - (previous?.response.summary.averageCitationF1 ?? 0),
|
|
1769
|
+
averageResolvedCitationRate: current.response.summary.averageResolvedCitationRate - (previous?.response.summary.averageResolvedCitationRate ?? 0),
|
|
1770
|
+
failedCases: current.response.summary.failedCases - (previous?.response.summary.failedCases ?? 0),
|
|
1771
|
+
passedCases: current.response.summary.passedCases - (previous?.response.summary.passedCases ?? 0),
|
|
1772
|
+
passingRate: current.response.passingRate - (previous?.response.passingRate ?? 0),
|
|
1773
|
+
partialCases: current.response.summary.partialCases - (previous?.response.summary.partialCases ?? 0)
|
|
1774
|
+
},
|
|
1775
|
+
unchangedCases
|
|
1776
|
+
};
|
|
1777
|
+
};
|
|
1737
1778
|
var createRAGFileEvaluationHistoryStore = (path) => ({
|
|
1738
1779
|
listRuns: async ({ limit, suiteId } = {}) => {
|
|
1739
1780
|
let parsed = [];
|
|
@@ -1772,6 +1813,42 @@ var createRAGFileEvaluationHistoryStore = (path) => ({
|
|
|
1772
1813
|
`, "utf8");
|
|
1773
1814
|
}
|
|
1774
1815
|
});
|
|
1816
|
+
var createRAGFileAnswerGroundingEvaluationHistoryStore = (path) => ({
|
|
1817
|
+
async listRuns(input) {
|
|
1818
|
+
try {
|
|
1819
|
+
const raw = await readFile(path, "utf8");
|
|
1820
|
+
const data = JSON.parse(raw);
|
|
1821
|
+
const runs = Array.isArray(data.runs) ? data.runs : [];
|
|
1822
|
+
const filtered = input?.suiteId ? runs.filter((run) => run.suiteId === input.suiteId) : runs;
|
|
1823
|
+
return filtered.sort(toGroundingHistorySortOrder).slice(0, input?.limit ?? DEFAULT_HISTORY_LIMIT);
|
|
1824
|
+
} catch (error) {
|
|
1825
|
+
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
|
|
1826
|
+
return [];
|
|
1827
|
+
}
|
|
1828
|
+
throw error;
|
|
1829
|
+
}
|
|
1830
|
+
},
|
|
1831
|
+
async saveRun(run) {
|
|
1832
|
+
let runs = [];
|
|
1833
|
+
try {
|
|
1834
|
+
const raw = await readFile(path, "utf8");
|
|
1835
|
+
const data = JSON.parse(raw);
|
|
1836
|
+
runs = Array.isArray(data.runs) ? data.runs : [];
|
|
1837
|
+
} catch (error) {
|
|
1838
|
+
if (!error || typeof error !== "object" || !("code" in error) || error.code !== "ENOENT") {
|
|
1839
|
+
throw error;
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
const nextRuns = normalizeGroundingHistoryRuns([
|
|
1843
|
+
run,
|
|
1844
|
+
...runs.filter((entry) => entry.id !== run.id)
|
|
1845
|
+
]);
|
|
1846
|
+
await mkdir(dirname(path), { recursive: true });
|
|
1847
|
+
await writeFile(path, JSON.stringify({
|
|
1848
|
+
runs: nextRuns
|
|
1849
|
+
}, null, 2));
|
|
1850
|
+
}
|
|
1851
|
+
});
|
|
1775
1852
|
var loadRAGEvaluationHistory = async ({
|
|
1776
1853
|
store,
|
|
1777
1854
|
suite,
|
|
@@ -1793,6 +1870,29 @@ var loadRAGEvaluationHistory = async ({
|
|
|
1793
1870
|
suiteLabel: suite.label ?? suite.id
|
|
1794
1871
|
};
|
|
1795
1872
|
};
|
|
1873
|
+
var loadRAGAnswerGroundingEvaluationHistory = async ({
|
|
1874
|
+
store,
|
|
1875
|
+
suite,
|
|
1876
|
+
limit = DEFAULT_HISTORY_LIMIT
|
|
1877
|
+
}) => {
|
|
1878
|
+
const runs = normalizeGroundingHistoryRuns(await Promise.resolve(store.listRuns({
|
|
1879
|
+
limit,
|
|
1880
|
+
suiteId: suite.id
|
|
1881
|
+
})));
|
|
1882
|
+
const latestRun = runs[0];
|
|
1883
|
+
const previousRun = runs[1];
|
|
1884
|
+
return {
|
|
1885
|
+
diff: latestRun && previousRun ? buildRAGAnswerGroundingEvaluationRunDiff({
|
|
1886
|
+
current: latestRun,
|
|
1887
|
+
previous: previousRun
|
|
1888
|
+
}) : undefined,
|
|
1889
|
+
latestRun,
|
|
1890
|
+
previousRun,
|
|
1891
|
+
runs,
|
|
1892
|
+
suiteId: suite.id,
|
|
1893
|
+
suiteLabel: suite.label ?? suite.id
|
|
1894
|
+
};
|
|
1895
|
+
};
|
|
1796
1896
|
var persistRAGEvaluationSuiteRun = async ({
|
|
1797
1897
|
store,
|
|
1798
1898
|
run
|
|
@@ -1800,6 +1900,13 @@ var persistRAGEvaluationSuiteRun = async ({
|
|
|
1800
1900
|
await Promise.resolve(store.saveRun(run));
|
|
1801
1901
|
return run;
|
|
1802
1902
|
};
|
|
1903
|
+
var persistRAGAnswerGroundingEvaluationRun = async ({
|
|
1904
|
+
store,
|
|
1905
|
+
run
|
|
1906
|
+
}) => {
|
|
1907
|
+
await Promise.resolve(store.saveRun(run));
|
|
1908
|
+
return run;
|
|
1909
|
+
};
|
|
1803
1910
|
var buildRAGEvaluationResponse = (cases) => {
|
|
1804
1911
|
const totalCases = cases.length;
|
|
1805
1912
|
const passedCases = cases.filter((entry) => entry.status === "pass").length;
|
|
@@ -3064,5 +3171,5 @@ export {
|
|
|
3064
3171
|
AIStreamProvider
|
|
3065
3172
|
};
|
|
3066
3173
|
|
|
3067
|
-
//# debugId=
|
|
3174
|
+
//# debugId=1A1FBFF18C24A71964756E2164756E21
|
|
3068
3175
|
//# sourceMappingURL=index.js.map
|