@absolutejs/absolute 0.19.0-beta.521 → 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/types/ai.d.ts
CHANGED
|
@@ -959,6 +959,51 @@ export type RAGAnswerGroundingEvaluationCaseDifficultyEntry = {
|
|
|
959
959
|
rank: number;
|
|
960
960
|
totalEvaluations: number;
|
|
961
961
|
};
|
|
962
|
+
export type RAGAnswerGroundingCaseDifficultyRun = {
|
|
963
|
+
id: string;
|
|
964
|
+
suiteId: string;
|
|
965
|
+
label: string;
|
|
966
|
+
startedAt: number;
|
|
967
|
+
finishedAt: number;
|
|
968
|
+
entries: RAGAnswerGroundingEvaluationCaseDifficultyEntry[];
|
|
969
|
+
metadata?: Record<string, unknown>;
|
|
970
|
+
};
|
|
971
|
+
export type RAGAnswerGroundingCaseDifficultyHistoryStore = {
|
|
972
|
+
saveRun: (run: RAGAnswerGroundingCaseDifficultyRun) => Promise<void> | void;
|
|
973
|
+
listRuns: (input?: {
|
|
974
|
+
suiteId?: string;
|
|
975
|
+
limit?: number;
|
|
976
|
+
}) => Promise<RAGAnswerGroundingCaseDifficultyRun[]> | RAGAnswerGroundingCaseDifficultyRun[];
|
|
977
|
+
};
|
|
978
|
+
export type RAGAnswerGroundingCaseDifficultyDiffEntry = {
|
|
979
|
+
caseId: string;
|
|
980
|
+
label?: string;
|
|
981
|
+
query?: string;
|
|
982
|
+
previousRank?: number;
|
|
983
|
+
currentRank: number;
|
|
984
|
+
previousPassRate?: number;
|
|
985
|
+
currentPassRate: number;
|
|
986
|
+
previousFailRate?: number;
|
|
987
|
+
currentFailRate: number;
|
|
988
|
+
previousAverageCitationF1?: number;
|
|
989
|
+
currentAverageCitationF1: number;
|
|
990
|
+
};
|
|
991
|
+
export type RAGAnswerGroundingCaseDifficultyRunDiff = {
|
|
992
|
+
suiteId: string;
|
|
993
|
+
currentRunId: string;
|
|
994
|
+
previousRunId?: string;
|
|
995
|
+
harderCases: RAGAnswerGroundingCaseDifficultyDiffEntry[];
|
|
996
|
+
easierCases: RAGAnswerGroundingCaseDifficultyDiffEntry[];
|
|
997
|
+
unchangedCases: RAGAnswerGroundingCaseDifficultyDiffEntry[];
|
|
998
|
+
};
|
|
999
|
+
export type RAGAnswerGroundingCaseDifficultyHistory = {
|
|
1000
|
+
suiteId: string;
|
|
1001
|
+
suiteLabel?: string;
|
|
1002
|
+
runs: RAGAnswerGroundingCaseDifficultyRun[];
|
|
1003
|
+
latestRun?: RAGAnswerGroundingCaseDifficultyRun;
|
|
1004
|
+
previousRun?: RAGAnswerGroundingCaseDifficultyRun;
|
|
1005
|
+
diff?: RAGAnswerGroundingCaseDifficultyRunDiff;
|
|
1006
|
+
};
|
|
962
1007
|
export type RAGAnswerGroundingEvaluationCaseDiff = {
|
|
963
1008
|
caseId: string;
|
|
964
1009
|
label?: string;
|
package/dist/vue/ai/index.js
CHANGED
|
@@ -1806,10 +1806,49 @@ var buildRAGAnswerGroundingCaseDifficultyLeaderboard = (entries) => {
|
|
|
1806
1806
|
totalEvaluations: entry.totalEvaluations
|
|
1807
1807
|
}));
|
|
1808
1808
|
};
|
|
1809
|
+
var buildGroundingDifficultyDiffEntry = (current, previous) => ({
|
|
1810
|
+
caseId: current.caseId,
|
|
1811
|
+
currentAverageCitationF1: current.averageCitationF1,
|
|
1812
|
+
currentFailRate: current.failRate,
|
|
1813
|
+
currentPassRate: current.passRate,
|
|
1814
|
+
currentRank: current.rank,
|
|
1815
|
+
label: current.label,
|
|
1816
|
+
previousAverageCitationF1: previous?.averageCitationF1,
|
|
1817
|
+
previousFailRate: previous?.failRate,
|
|
1818
|
+
previousPassRate: previous?.passRate,
|
|
1819
|
+
previousRank: previous?.rank,
|
|
1820
|
+
query: current.query
|
|
1821
|
+
});
|
|
1822
|
+
var buildRAGAnswerGroundingCaseDifficultyRunDiff = ({
|
|
1823
|
+
current,
|
|
1824
|
+
previous
|
|
1825
|
+
}) => {
|
|
1826
|
+
const previousEntries = new Map((previous?.entries ?? []).map((entry) => [entry.caseId, entry]));
|
|
1827
|
+
const diffs = current.entries.map((entry) => buildGroundingDifficultyDiffEntry(entry, previousEntries.get(entry.caseId)));
|
|
1828
|
+
return {
|
|
1829
|
+
currentRunId: current.id,
|
|
1830
|
+
easierCases: diffs.filter((entry) => {
|
|
1831
|
+
const previousRank = entry.previousRank ?? entry.currentRank;
|
|
1832
|
+
return entry.currentRank > previousRank;
|
|
1833
|
+
}),
|
|
1834
|
+
harderCases: diffs.filter((entry) => {
|
|
1835
|
+
const previousRank = entry.previousRank ?? Number.MAX_SAFE_INTEGER;
|
|
1836
|
+
return entry.currentRank < previousRank;
|
|
1837
|
+
}),
|
|
1838
|
+
previousRunId: previous?.id,
|
|
1839
|
+
suiteId: current.suiteId,
|
|
1840
|
+
unchangedCases: diffs.filter((entry) => {
|
|
1841
|
+
const previousRank = entry.previousRank ?? entry.currentRank;
|
|
1842
|
+
return entry.currentRank === previousRank;
|
|
1843
|
+
})
|
|
1844
|
+
};
|
|
1845
|
+
};
|
|
1809
1846
|
var toHistorySortOrder = (left, right) => right.finishedAt - left.finishedAt;
|
|
1810
1847
|
var normalizeHistoryRuns = (runs) => [...runs].sort(toHistorySortOrder);
|
|
1811
1848
|
var toGroundingHistorySortOrder = (left, right) => right.finishedAt - left.finishedAt;
|
|
1812
1849
|
var normalizeGroundingHistoryRuns = (runs) => [...runs].sort(toGroundingHistorySortOrder);
|
|
1850
|
+
var toGroundingDifficultyHistorySortOrder = (left, right) => right.finishedAt - left.finishedAt;
|
|
1851
|
+
var normalizeGroundingDifficultyHistoryRuns = (runs) => [...runs].sort(toGroundingDifficultyHistorySortOrder);
|
|
1813
1852
|
var buildCaseDiff = (currentCase, previousCase) => ({
|
|
1814
1853
|
caseId: currentCase.caseId,
|
|
1815
1854
|
currentF1: currentCase.f1,
|
|
@@ -1995,6 +2034,42 @@ var createRAGFileAnswerGroundingEvaluationHistoryStore = (path) => ({
|
|
|
1995
2034
|
}, null, 2));
|
|
1996
2035
|
}
|
|
1997
2036
|
});
|
|
2037
|
+
var createRAGFileAnswerGroundingCaseDifficultyHistoryStore = (path) => ({
|
|
2038
|
+
async listRuns(input) {
|
|
2039
|
+
try {
|
|
2040
|
+
const raw = await readFile(path, "utf8");
|
|
2041
|
+
const data = JSON.parse(raw);
|
|
2042
|
+
const runs = Array.isArray(data.runs) ? data.runs : [];
|
|
2043
|
+
const filtered = input?.suiteId ? runs.filter((run) => run.suiteId === input.suiteId) : runs;
|
|
2044
|
+
return normalizeGroundingDifficultyHistoryRuns(filtered).slice(0, input?.limit ?? DEFAULT_HISTORY_LIMIT);
|
|
2045
|
+
} catch (error) {
|
|
2046
|
+
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
|
|
2047
|
+
return [];
|
|
2048
|
+
}
|
|
2049
|
+
throw error;
|
|
2050
|
+
}
|
|
2051
|
+
},
|
|
2052
|
+
async saveRun(run) {
|
|
2053
|
+
let runs = [];
|
|
2054
|
+
try {
|
|
2055
|
+
const raw = await readFile(path, "utf8");
|
|
2056
|
+
const data = JSON.parse(raw);
|
|
2057
|
+
runs = Array.isArray(data.runs) ? data.runs : [];
|
|
2058
|
+
} catch (error) {
|
|
2059
|
+
if (!error || typeof error !== "object" || !("code" in error) || error.code !== "ENOENT") {
|
|
2060
|
+
throw error;
|
|
2061
|
+
}
|
|
2062
|
+
}
|
|
2063
|
+
const nextRuns = normalizeGroundingDifficultyHistoryRuns([
|
|
2064
|
+
run,
|
|
2065
|
+
...runs.filter((entry) => entry.id !== run.id)
|
|
2066
|
+
]);
|
|
2067
|
+
await mkdir(dirname(path), { recursive: true });
|
|
2068
|
+
await writeFile(path, JSON.stringify({
|
|
2069
|
+
runs: nextRuns
|
|
2070
|
+
}, null, 2));
|
|
2071
|
+
}
|
|
2072
|
+
});
|
|
1998
2073
|
var loadRAGEvaluationHistory = async ({
|
|
1999
2074
|
store,
|
|
2000
2075
|
suite,
|
|
@@ -2044,6 +2119,29 @@ var loadRAGAnswerGroundingEvaluationHistory = async ({
|
|
|
2044
2119
|
suiteLabel: suite.label ?? suite.id
|
|
2045
2120
|
};
|
|
2046
2121
|
};
|
|
2122
|
+
var loadRAGAnswerGroundingCaseDifficultyHistory = async ({
|
|
2123
|
+
store,
|
|
2124
|
+
suite,
|
|
2125
|
+
limit = DEFAULT_HISTORY_LIMIT
|
|
2126
|
+
}) => {
|
|
2127
|
+
const runs = normalizeGroundingDifficultyHistoryRuns(await Promise.resolve(store.listRuns({
|
|
2128
|
+
limit,
|
|
2129
|
+
suiteId: suite.id
|
|
2130
|
+
})));
|
|
2131
|
+
const latestRun = runs[0];
|
|
2132
|
+
const previousRun = runs[1];
|
|
2133
|
+
return {
|
|
2134
|
+
diff: latestRun && previousRun ? buildRAGAnswerGroundingCaseDifficultyRunDiff({
|
|
2135
|
+
current: latestRun,
|
|
2136
|
+
previous: previousRun
|
|
2137
|
+
}) : undefined,
|
|
2138
|
+
latestRun,
|
|
2139
|
+
previousRun,
|
|
2140
|
+
runs,
|
|
2141
|
+
suiteId: suite.id,
|
|
2142
|
+
suiteLabel: suite.label ?? suite.id
|
|
2143
|
+
};
|
|
2144
|
+
};
|
|
2047
2145
|
var persistRAGEvaluationSuiteRun = async ({
|
|
2048
2146
|
store,
|
|
2049
2147
|
run
|
|
@@ -2058,6 +2156,13 @@ var persistRAGAnswerGroundingEvaluationRun = async ({
|
|
|
2058
2156
|
await Promise.resolve(store.saveRun(run));
|
|
2059
2157
|
return run;
|
|
2060
2158
|
};
|
|
2159
|
+
var persistRAGAnswerGroundingCaseDifficultyRun = async ({
|
|
2160
|
+
store,
|
|
2161
|
+
run
|
|
2162
|
+
}) => {
|
|
2163
|
+
await Promise.resolve(store.saveRun(run));
|
|
2164
|
+
return run;
|
|
2165
|
+
};
|
|
2061
2166
|
var buildRAGEvaluationResponse = (cases) => {
|
|
2062
2167
|
const totalCases = cases.length;
|
|
2063
2168
|
const passedCases = cases.filter((entry) => entry.status === "pass").length;
|
|
@@ -3074,5 +3179,5 @@ export {
|
|
|
3074
3179
|
AIStreamKey
|
|
3075
3180
|
};
|
|
3076
3181
|
|
|
3077
|
-
//# debugId=
|
|
3182
|
+
//# debugId=8138A6ECFE2C732864756E2164756E21
|
|
3078
3183
|
//# sourceMappingURL=index.js.map
|