@absolutejs/absolute 0.19.0-beta.522 → 0.19.0-beta.523
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 +106 -1
- package/dist/ai/client/index.js.map +3 -3
- package/dist/ai/index.js +110 -1
- package/dist/ai/index.js.map +4 -4
- package/dist/react/ai/index.js +106 -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 +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 +106 -1
- package/dist/svelte/ai/index.js.map +3 -3
- package/dist/types/ai.d.ts +45 -0
- package/dist/vue/ai/index.js +106 -1
- package/dist/vue/ai/index.js.map +3 -3
- package/package.json +1 -1
package/dist/ai/client/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,
|
|
@@ -1971,6 +2010,42 @@ var createRAGFileAnswerGroundingEvaluationHistoryStore = (path) => ({
|
|
|
1971
2010
|
}, null, 2));
|
|
1972
2011
|
}
|
|
1973
2012
|
});
|
|
2013
|
+
var createRAGFileAnswerGroundingCaseDifficultyHistoryStore = (path) => ({
|
|
2014
|
+
async listRuns(input) {
|
|
2015
|
+
try {
|
|
2016
|
+
const raw = await readFile(path, "utf8");
|
|
2017
|
+
const data = JSON.parse(raw);
|
|
2018
|
+
const runs = Array.isArray(data.runs) ? data.runs : [];
|
|
2019
|
+
const filtered = input?.suiteId ? runs.filter((run) => run.suiteId === input.suiteId) : runs;
|
|
2020
|
+
return normalizeGroundingDifficultyHistoryRuns(filtered).slice(0, input?.limit ?? DEFAULT_HISTORY_LIMIT);
|
|
2021
|
+
} catch (error) {
|
|
2022
|
+
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
|
|
2023
|
+
return [];
|
|
2024
|
+
}
|
|
2025
|
+
throw error;
|
|
2026
|
+
}
|
|
2027
|
+
},
|
|
2028
|
+
async saveRun(run) {
|
|
2029
|
+
let runs = [];
|
|
2030
|
+
try {
|
|
2031
|
+
const raw = await readFile(path, "utf8");
|
|
2032
|
+
const data = JSON.parse(raw);
|
|
2033
|
+
runs = Array.isArray(data.runs) ? data.runs : [];
|
|
2034
|
+
} catch (error) {
|
|
2035
|
+
if (!error || typeof error !== "object" || !("code" in error) || error.code !== "ENOENT") {
|
|
2036
|
+
throw error;
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
const nextRuns = normalizeGroundingDifficultyHistoryRuns([
|
|
2040
|
+
run,
|
|
2041
|
+
...runs.filter((entry) => entry.id !== run.id)
|
|
2042
|
+
]);
|
|
2043
|
+
await mkdir(dirname(path), { recursive: true });
|
|
2044
|
+
await writeFile(path, JSON.stringify({
|
|
2045
|
+
runs: nextRuns
|
|
2046
|
+
}, null, 2));
|
|
2047
|
+
}
|
|
2048
|
+
});
|
|
1974
2049
|
var loadRAGEvaluationHistory = async ({
|
|
1975
2050
|
store,
|
|
1976
2051
|
suite,
|
|
@@ -2020,6 +2095,29 @@ var loadRAGAnswerGroundingEvaluationHistory = async ({
|
|
|
2020
2095
|
suiteLabel: suite.label ?? suite.id
|
|
2021
2096
|
};
|
|
2022
2097
|
};
|
|
2098
|
+
var loadRAGAnswerGroundingCaseDifficultyHistory = async ({
|
|
2099
|
+
store,
|
|
2100
|
+
suite,
|
|
2101
|
+
limit = DEFAULT_HISTORY_LIMIT
|
|
2102
|
+
}) => {
|
|
2103
|
+
const runs = normalizeGroundingDifficultyHistoryRuns(await Promise.resolve(store.listRuns({
|
|
2104
|
+
limit,
|
|
2105
|
+
suiteId: suite.id
|
|
2106
|
+
})));
|
|
2107
|
+
const latestRun = runs[0];
|
|
2108
|
+
const previousRun = runs[1];
|
|
2109
|
+
return {
|
|
2110
|
+
diff: latestRun && previousRun ? buildRAGAnswerGroundingCaseDifficultyRunDiff({
|
|
2111
|
+
current: latestRun,
|
|
2112
|
+
previous: previousRun
|
|
2113
|
+
}) : undefined,
|
|
2114
|
+
latestRun,
|
|
2115
|
+
previousRun,
|
|
2116
|
+
runs,
|
|
2117
|
+
suiteId: suite.id,
|
|
2118
|
+
suiteLabel: suite.label ?? suite.id
|
|
2119
|
+
};
|
|
2120
|
+
};
|
|
2023
2121
|
var persistRAGEvaluationSuiteRun = async ({
|
|
2024
2122
|
store,
|
|
2025
2123
|
run
|
|
@@ -2034,6 +2132,13 @@ var persistRAGAnswerGroundingEvaluationRun = async ({
|
|
|
2034
2132
|
await Promise.resolve(store.saveRun(run));
|
|
2035
2133
|
return run;
|
|
2036
2134
|
};
|
|
2135
|
+
var persistRAGAnswerGroundingCaseDifficultyRun = async ({
|
|
2136
|
+
store,
|
|
2137
|
+
run
|
|
2138
|
+
}) => {
|
|
2139
|
+
await Promise.resolve(store.saveRun(run));
|
|
2140
|
+
return run;
|
|
2141
|
+
};
|
|
2037
2142
|
var buildRAGEvaluationResponse = (cases) => {
|
|
2038
2143
|
const totalCases = cases.length;
|
|
2039
2144
|
const passedCases = cases.filter((entry) => entry.status === "pass").length;
|
|
@@ -2411,5 +2516,5 @@ export {
|
|
|
2411
2516
|
buildRAGAnswerWorkflowState
|
|
2412
2517
|
};
|
|
2413
2518
|
|
|
2414
|
-
//# debugId=
|
|
2519
|
+
//# debugId=00A3D464CC429EC964756E2164756E21
|
|
2415
2520
|
//# sourceMappingURL=index.js.map
|