@absolutejs/absolute 0.19.0-beta.522 → 0.19.0-beta.524
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 +125 -2
- package/dist/ai/client/index.js.map +3 -3
- package/dist/ai/index.js +129 -2
- package/dist/ai/index.js.map +4 -4
- package/dist/react/ai/index.js +125 -2
- 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 +1 -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 +125 -2
- package/dist/svelte/ai/index.js.map +3 -3
- package/dist/types/ai.d.ts +63 -0
- package/dist/vue/ai/index.js +125 -2
- package/dist/vue/ai/index.js.map +3 -3
- package/package.json +1 -1
package/dist/react/ai/index.js
CHANGED
|
@@ -1782,10 +1782,49 @@ var buildRAGAnswerGroundingCaseDifficultyLeaderboard = (entries) => {
|
|
|
1782
1782
|
totalEvaluations: entry.totalEvaluations
|
|
1783
1783
|
}));
|
|
1784
1784
|
};
|
|
1785
|
+
var buildGroundingDifficultyDiffEntry = (current, previous) => ({
|
|
1786
|
+
caseId: current.caseId,
|
|
1787
|
+
currentAverageCitationF1: current.averageCitationF1,
|
|
1788
|
+
currentFailRate: current.failRate,
|
|
1789
|
+
currentPassRate: current.passRate,
|
|
1790
|
+
currentRank: current.rank,
|
|
1791
|
+
label: current.label,
|
|
1792
|
+
previousAverageCitationF1: previous?.averageCitationF1,
|
|
1793
|
+
previousFailRate: previous?.failRate,
|
|
1794
|
+
previousPassRate: previous?.passRate,
|
|
1795
|
+
previousRank: previous?.rank,
|
|
1796
|
+
query: current.query
|
|
1797
|
+
});
|
|
1798
|
+
var buildRAGAnswerGroundingCaseDifficultyRunDiff = ({
|
|
1799
|
+
current,
|
|
1800
|
+
previous
|
|
1801
|
+
}) => {
|
|
1802
|
+
const previousEntries = new Map((previous?.entries ?? []).map((entry) => [entry.caseId, entry]));
|
|
1803
|
+
const diffs = current.entries.map((entry) => buildGroundingDifficultyDiffEntry(entry, previousEntries.get(entry.caseId)));
|
|
1804
|
+
return {
|
|
1805
|
+
currentRunId: current.id,
|
|
1806
|
+
easierCases: diffs.filter((entry) => {
|
|
1807
|
+
const previousRank = entry.previousRank ?? entry.currentRank;
|
|
1808
|
+
return entry.currentRank > previousRank;
|
|
1809
|
+
}),
|
|
1810
|
+
harderCases: diffs.filter((entry) => {
|
|
1811
|
+
const previousRank = entry.previousRank ?? Number.MAX_SAFE_INTEGER;
|
|
1812
|
+
return entry.currentRank < previousRank;
|
|
1813
|
+
}),
|
|
1814
|
+
previousRunId: previous?.id,
|
|
1815
|
+
suiteId: current.suiteId,
|
|
1816
|
+
unchangedCases: diffs.filter((entry) => {
|
|
1817
|
+
const previousRank = entry.previousRank ?? entry.currentRank;
|
|
1818
|
+
return entry.currentRank === previousRank;
|
|
1819
|
+
})
|
|
1820
|
+
};
|
|
1821
|
+
};
|
|
1785
1822
|
var toHistorySortOrder = (left, right) => right.finishedAt - left.finishedAt;
|
|
1786
1823
|
var normalizeHistoryRuns = (runs) => [...runs].sort(toHistorySortOrder);
|
|
1787
1824
|
var toGroundingHistorySortOrder = (left, right) => right.finishedAt - left.finishedAt;
|
|
1788
1825
|
var normalizeGroundingHistoryRuns = (runs) => [...runs].sort(toGroundingHistorySortOrder);
|
|
1826
|
+
var toGroundingDifficultyHistorySortOrder = (left, right) => right.finishedAt - left.finishedAt;
|
|
1827
|
+
var normalizeGroundingDifficultyHistoryRuns = (runs) => [...runs].sort(toGroundingDifficultyHistorySortOrder);
|
|
1789
1828
|
var buildCaseDiff = (currentCase, previousCase) => ({
|
|
1790
1829
|
caseId: currentCase.caseId,
|
|
1791
1830
|
currentF1: currentCase.f1,
|
|
@@ -1803,18 +1842,30 @@ var buildGroundingCaseDiff = (currentCase, previousCase) => ({
|
|
|
1803
1842
|
answerChanged: typeof previousCase?.answer === "string" ? previousCase.answer !== currentCase.answer : true,
|
|
1804
1843
|
caseId: currentCase.caseId,
|
|
1805
1844
|
currentCitationF1: currentCase.citationF1,
|
|
1845
|
+
currentCitedIds: currentCase.citedIds,
|
|
1806
1846
|
currentCoverage: currentCase.coverage,
|
|
1847
|
+
currentExtraIds: currentCase.extraIds,
|
|
1807
1848
|
currentMatchedIds: currentCase.matchedIds,
|
|
1808
1849
|
currentMissingIds: currentCase.missingIds,
|
|
1850
|
+
currentReferenceCount: currentCase.referenceCount,
|
|
1851
|
+
currentResolvedCitationCount: currentCase.resolvedCitationCount,
|
|
1809
1852
|
currentAnswer: currentCase.answer,
|
|
1810
1853
|
currentStatus: currentCase.status,
|
|
1854
|
+
currentUngroundedReferenceNumbers: currentCase.groundedAnswer.ungroundedReferenceNumbers,
|
|
1855
|
+
currentUnresolvedCitationCount: currentCase.unresolvedCitationCount,
|
|
1811
1856
|
label: currentCase.label,
|
|
1812
1857
|
previousAnswer: previousCase?.answer,
|
|
1813
1858
|
previousCitationF1: previousCase?.citationF1,
|
|
1859
|
+
previousCitedIds: previousCase?.citedIds ?? [],
|
|
1814
1860
|
previousCoverage: previousCase?.coverage,
|
|
1861
|
+
previousExtraIds: previousCase?.extraIds ?? [],
|
|
1815
1862
|
previousMatchedIds: previousCase?.matchedIds ?? [],
|
|
1816
1863
|
previousMissingIds: previousCase?.missingIds ?? [],
|
|
1864
|
+
previousReferenceCount: previousCase?.referenceCount,
|
|
1865
|
+
previousResolvedCitationCount: previousCase?.resolvedCitationCount,
|
|
1817
1866
|
previousStatus: previousCase?.status,
|
|
1867
|
+
previousUngroundedReferenceNumbers: previousCase?.groundedAnswer.ungroundedReferenceNumbers ?? [],
|
|
1868
|
+
previousUnresolvedCitationCount: previousCase?.unresolvedCitationCount,
|
|
1818
1869
|
query: currentCase.query
|
|
1819
1870
|
});
|
|
1820
1871
|
var buildGroundingCaseSnapshots = ({
|
|
@@ -1831,7 +1882,9 @@ var buildGroundingCaseSnapshots = ({
|
|
|
1831
1882
|
answer: entry.answer,
|
|
1832
1883
|
answerChange: typeof previousCase?.answer === "string" ? previousCase.answer === entry.answer ? "unchanged" : "changed" : "new",
|
|
1833
1884
|
caseId: entry.caseId,
|
|
1885
|
+
citationCount: entry.citationCount,
|
|
1834
1886
|
citationF1: entry.citationF1,
|
|
1887
|
+
citedIds: entry.citedIds,
|
|
1835
1888
|
coverage: entry.coverage,
|
|
1836
1889
|
extraIds: entry.extraIds,
|
|
1837
1890
|
label: entry.label,
|
|
@@ -1839,8 +1892,12 @@ var buildGroundingCaseSnapshots = ({
|
|
|
1839
1892
|
missingIds: entry.missingIds,
|
|
1840
1893
|
previousAnswer: previousCase?.answer,
|
|
1841
1894
|
query: entry.query,
|
|
1895
|
+
referenceCount: entry.referenceCount,
|
|
1896
|
+
resolvedCitationCount: entry.resolvedCitationCount,
|
|
1842
1897
|
resolvedCitationRate: entry.resolvedCitationRate,
|
|
1843
|
-
status: entry.status
|
|
1898
|
+
status: entry.status,
|
|
1899
|
+
ungroundedReferenceNumbers: entry.groundedAnswer.ungroundedReferenceNumbers,
|
|
1900
|
+
unresolvedCitationCount: entry.unresolvedCitationCount
|
|
1844
1901
|
};
|
|
1845
1902
|
});
|
|
1846
1903
|
};
|
|
@@ -1971,6 +2028,42 @@ var createRAGFileAnswerGroundingEvaluationHistoryStore = (path) => ({
|
|
|
1971
2028
|
}, null, 2));
|
|
1972
2029
|
}
|
|
1973
2030
|
});
|
|
2031
|
+
var createRAGFileAnswerGroundingCaseDifficultyHistoryStore = (path) => ({
|
|
2032
|
+
async listRuns(input) {
|
|
2033
|
+
try {
|
|
2034
|
+
const raw = await readFile(path, "utf8");
|
|
2035
|
+
const data = JSON.parse(raw);
|
|
2036
|
+
const runs = Array.isArray(data.runs) ? data.runs : [];
|
|
2037
|
+
const filtered = input?.suiteId ? runs.filter((run) => run.suiteId === input.suiteId) : runs;
|
|
2038
|
+
return normalizeGroundingDifficultyHistoryRuns(filtered).slice(0, input?.limit ?? DEFAULT_HISTORY_LIMIT);
|
|
2039
|
+
} catch (error) {
|
|
2040
|
+
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
|
|
2041
|
+
return [];
|
|
2042
|
+
}
|
|
2043
|
+
throw error;
|
|
2044
|
+
}
|
|
2045
|
+
},
|
|
2046
|
+
async saveRun(run) {
|
|
2047
|
+
let runs = [];
|
|
2048
|
+
try {
|
|
2049
|
+
const raw = await readFile(path, "utf8");
|
|
2050
|
+
const data = JSON.parse(raw);
|
|
2051
|
+
runs = Array.isArray(data.runs) ? data.runs : [];
|
|
2052
|
+
} catch (error) {
|
|
2053
|
+
if (!error || typeof error !== "object" || !("code" in error) || error.code !== "ENOENT") {
|
|
2054
|
+
throw error;
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2057
|
+
const nextRuns = normalizeGroundingDifficultyHistoryRuns([
|
|
2058
|
+
run,
|
|
2059
|
+
...runs.filter((entry) => entry.id !== run.id)
|
|
2060
|
+
]);
|
|
2061
|
+
await mkdir(dirname(path), { recursive: true });
|
|
2062
|
+
await writeFile(path, JSON.stringify({
|
|
2063
|
+
runs: nextRuns
|
|
2064
|
+
}, null, 2));
|
|
2065
|
+
}
|
|
2066
|
+
});
|
|
1974
2067
|
var loadRAGEvaluationHistory = async ({
|
|
1975
2068
|
store,
|
|
1976
2069
|
suite,
|
|
@@ -2020,6 +2113,29 @@ var loadRAGAnswerGroundingEvaluationHistory = async ({
|
|
|
2020
2113
|
suiteLabel: suite.label ?? suite.id
|
|
2021
2114
|
};
|
|
2022
2115
|
};
|
|
2116
|
+
var loadRAGAnswerGroundingCaseDifficultyHistory = async ({
|
|
2117
|
+
store,
|
|
2118
|
+
suite,
|
|
2119
|
+
limit = DEFAULT_HISTORY_LIMIT
|
|
2120
|
+
}) => {
|
|
2121
|
+
const runs = normalizeGroundingDifficultyHistoryRuns(await Promise.resolve(store.listRuns({
|
|
2122
|
+
limit,
|
|
2123
|
+
suiteId: suite.id
|
|
2124
|
+
})));
|
|
2125
|
+
const latestRun = runs[0];
|
|
2126
|
+
const previousRun = runs[1];
|
|
2127
|
+
return {
|
|
2128
|
+
diff: latestRun && previousRun ? buildRAGAnswerGroundingCaseDifficultyRunDiff({
|
|
2129
|
+
current: latestRun,
|
|
2130
|
+
previous: previousRun
|
|
2131
|
+
}) : undefined,
|
|
2132
|
+
latestRun,
|
|
2133
|
+
previousRun,
|
|
2134
|
+
runs,
|
|
2135
|
+
suiteId: suite.id,
|
|
2136
|
+
suiteLabel: suite.label ?? suite.id
|
|
2137
|
+
};
|
|
2138
|
+
};
|
|
2023
2139
|
var persistRAGEvaluationSuiteRun = async ({
|
|
2024
2140
|
store,
|
|
2025
2141
|
run
|
|
@@ -2034,6 +2150,13 @@ var persistRAGAnswerGroundingEvaluationRun = async ({
|
|
|
2034
2150
|
await Promise.resolve(store.saveRun(run));
|
|
2035
2151
|
return run;
|
|
2036
2152
|
};
|
|
2153
|
+
var persistRAGAnswerGroundingCaseDifficultyRun = async ({
|
|
2154
|
+
store,
|
|
2155
|
+
run
|
|
2156
|
+
}) => {
|
|
2157
|
+
await Promise.resolve(store.saveRun(run));
|
|
2158
|
+
return run;
|
|
2159
|
+
};
|
|
2037
2160
|
var buildRAGEvaluationResponse = (cases) => {
|
|
2038
2161
|
const totalCases = cases.length;
|
|
2039
2162
|
const passedCases = cases.filter((entry) => entry.status === "pass").length;
|
|
@@ -3298,5 +3421,5 @@ export {
|
|
|
3298
3421
|
AIStreamProvider
|
|
3299
3422
|
};
|
|
3300
3423
|
|
|
3301
|
-
//# debugId=
|
|
3424
|
+
//# debugId=93CE50A710F19DA364756E2164756E21
|
|
3302
3425
|
//# sourceMappingURL=index.js.map
|