@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/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;
|
|
@@ -969,10 +1014,22 @@ export type RAGAnswerGroundingEvaluationCaseDiff = {
|
|
|
969
1014
|
currentCoverage: RAGAnswerGroundingEvaluationCaseResult['coverage'];
|
|
970
1015
|
previousCitationF1?: number;
|
|
971
1016
|
currentCitationF1: number;
|
|
1017
|
+
previousCitedIds: string[];
|
|
1018
|
+
currentCitedIds: string[];
|
|
972
1019
|
previousMatchedIds: string[];
|
|
973
1020
|
currentMatchedIds: string[];
|
|
974
1021
|
previousMissingIds: string[];
|
|
975
1022
|
currentMissingIds: string[];
|
|
1023
|
+
previousExtraIds: string[];
|
|
1024
|
+
currentExtraIds: string[];
|
|
1025
|
+
previousReferenceCount?: number;
|
|
1026
|
+
currentReferenceCount: number;
|
|
1027
|
+
previousResolvedCitationCount?: number;
|
|
1028
|
+
currentResolvedCitationCount: number;
|
|
1029
|
+
previousUnresolvedCitationCount?: number;
|
|
1030
|
+
currentUnresolvedCitationCount: number;
|
|
1031
|
+
previousUngroundedReferenceNumbers: number[];
|
|
1032
|
+
currentUngroundedReferenceNumbers: number[];
|
|
976
1033
|
previousAnswer?: string;
|
|
977
1034
|
currentAnswer: string;
|
|
978
1035
|
answerChanged: boolean;
|
|
@@ -985,9 +1042,15 @@ export type RAGAnswerGroundingEvaluationCaseSnapshot = {
|
|
|
985
1042
|
coverage: RAGAnswerGroundingEvaluationCaseResult['coverage'];
|
|
986
1043
|
citationF1: number;
|
|
987
1044
|
resolvedCitationRate: number;
|
|
1045
|
+
citationCount: number;
|
|
1046
|
+
referenceCount: number;
|
|
1047
|
+
resolvedCitationCount: number;
|
|
1048
|
+
unresolvedCitationCount: number;
|
|
1049
|
+
citedIds: string[];
|
|
988
1050
|
matchedIds: string[];
|
|
989
1051
|
missingIds: string[];
|
|
990
1052
|
extraIds: string[];
|
|
1053
|
+
ungroundedReferenceNumbers: number[];
|
|
991
1054
|
answer: string;
|
|
992
1055
|
previousAnswer?: string;
|
|
993
1056
|
answerChange: 'new' | 'changed' | 'unchanged';
|
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,
|
|
@@ -1827,18 +1866,30 @@ var buildGroundingCaseDiff = (currentCase, previousCase) => ({
|
|
|
1827
1866
|
answerChanged: typeof previousCase?.answer === "string" ? previousCase.answer !== currentCase.answer : true,
|
|
1828
1867
|
caseId: currentCase.caseId,
|
|
1829
1868
|
currentCitationF1: currentCase.citationF1,
|
|
1869
|
+
currentCitedIds: currentCase.citedIds,
|
|
1830
1870
|
currentCoverage: currentCase.coverage,
|
|
1871
|
+
currentExtraIds: currentCase.extraIds,
|
|
1831
1872
|
currentMatchedIds: currentCase.matchedIds,
|
|
1832
1873
|
currentMissingIds: currentCase.missingIds,
|
|
1874
|
+
currentReferenceCount: currentCase.referenceCount,
|
|
1875
|
+
currentResolvedCitationCount: currentCase.resolvedCitationCount,
|
|
1833
1876
|
currentAnswer: currentCase.answer,
|
|
1834
1877
|
currentStatus: currentCase.status,
|
|
1878
|
+
currentUngroundedReferenceNumbers: currentCase.groundedAnswer.ungroundedReferenceNumbers,
|
|
1879
|
+
currentUnresolvedCitationCount: currentCase.unresolvedCitationCount,
|
|
1835
1880
|
label: currentCase.label,
|
|
1836
1881
|
previousAnswer: previousCase?.answer,
|
|
1837
1882
|
previousCitationF1: previousCase?.citationF1,
|
|
1883
|
+
previousCitedIds: previousCase?.citedIds ?? [],
|
|
1838
1884
|
previousCoverage: previousCase?.coverage,
|
|
1885
|
+
previousExtraIds: previousCase?.extraIds ?? [],
|
|
1839
1886
|
previousMatchedIds: previousCase?.matchedIds ?? [],
|
|
1840
1887
|
previousMissingIds: previousCase?.missingIds ?? [],
|
|
1888
|
+
previousReferenceCount: previousCase?.referenceCount,
|
|
1889
|
+
previousResolvedCitationCount: previousCase?.resolvedCitationCount,
|
|
1841
1890
|
previousStatus: previousCase?.status,
|
|
1891
|
+
previousUngroundedReferenceNumbers: previousCase?.groundedAnswer.ungroundedReferenceNumbers ?? [],
|
|
1892
|
+
previousUnresolvedCitationCount: previousCase?.unresolvedCitationCount,
|
|
1842
1893
|
query: currentCase.query
|
|
1843
1894
|
});
|
|
1844
1895
|
var buildGroundingCaseSnapshots = ({
|
|
@@ -1855,7 +1906,9 @@ var buildGroundingCaseSnapshots = ({
|
|
|
1855
1906
|
answer: entry.answer,
|
|
1856
1907
|
answerChange: typeof previousCase?.answer === "string" ? previousCase.answer === entry.answer ? "unchanged" : "changed" : "new",
|
|
1857
1908
|
caseId: entry.caseId,
|
|
1909
|
+
citationCount: entry.citationCount,
|
|
1858
1910
|
citationF1: entry.citationF1,
|
|
1911
|
+
citedIds: entry.citedIds,
|
|
1859
1912
|
coverage: entry.coverage,
|
|
1860
1913
|
extraIds: entry.extraIds,
|
|
1861
1914
|
label: entry.label,
|
|
@@ -1863,8 +1916,12 @@ var buildGroundingCaseSnapshots = ({
|
|
|
1863
1916
|
missingIds: entry.missingIds,
|
|
1864
1917
|
previousAnswer: previousCase?.answer,
|
|
1865
1918
|
query: entry.query,
|
|
1919
|
+
referenceCount: entry.referenceCount,
|
|
1920
|
+
resolvedCitationCount: entry.resolvedCitationCount,
|
|
1866
1921
|
resolvedCitationRate: entry.resolvedCitationRate,
|
|
1867
|
-
status: entry.status
|
|
1922
|
+
status: entry.status,
|
|
1923
|
+
ungroundedReferenceNumbers: entry.groundedAnswer.ungroundedReferenceNumbers,
|
|
1924
|
+
unresolvedCitationCount: entry.unresolvedCitationCount
|
|
1868
1925
|
};
|
|
1869
1926
|
});
|
|
1870
1927
|
};
|
|
@@ -1995,6 +2052,42 @@ var createRAGFileAnswerGroundingEvaluationHistoryStore = (path) => ({
|
|
|
1995
2052
|
}, null, 2));
|
|
1996
2053
|
}
|
|
1997
2054
|
});
|
|
2055
|
+
var createRAGFileAnswerGroundingCaseDifficultyHistoryStore = (path) => ({
|
|
2056
|
+
async listRuns(input) {
|
|
2057
|
+
try {
|
|
2058
|
+
const raw = await readFile(path, "utf8");
|
|
2059
|
+
const data = JSON.parse(raw);
|
|
2060
|
+
const runs = Array.isArray(data.runs) ? data.runs : [];
|
|
2061
|
+
const filtered = input?.suiteId ? runs.filter((run) => run.suiteId === input.suiteId) : runs;
|
|
2062
|
+
return normalizeGroundingDifficultyHistoryRuns(filtered).slice(0, input?.limit ?? DEFAULT_HISTORY_LIMIT);
|
|
2063
|
+
} catch (error) {
|
|
2064
|
+
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
|
|
2065
|
+
return [];
|
|
2066
|
+
}
|
|
2067
|
+
throw error;
|
|
2068
|
+
}
|
|
2069
|
+
},
|
|
2070
|
+
async saveRun(run) {
|
|
2071
|
+
let runs = [];
|
|
2072
|
+
try {
|
|
2073
|
+
const raw = await readFile(path, "utf8");
|
|
2074
|
+
const data = JSON.parse(raw);
|
|
2075
|
+
runs = Array.isArray(data.runs) ? data.runs : [];
|
|
2076
|
+
} catch (error) {
|
|
2077
|
+
if (!error || typeof error !== "object" || !("code" in error) || error.code !== "ENOENT") {
|
|
2078
|
+
throw error;
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2081
|
+
const nextRuns = normalizeGroundingDifficultyHistoryRuns([
|
|
2082
|
+
run,
|
|
2083
|
+
...runs.filter((entry) => entry.id !== run.id)
|
|
2084
|
+
]);
|
|
2085
|
+
await mkdir(dirname(path), { recursive: true });
|
|
2086
|
+
await writeFile(path, JSON.stringify({
|
|
2087
|
+
runs: nextRuns
|
|
2088
|
+
}, null, 2));
|
|
2089
|
+
}
|
|
2090
|
+
});
|
|
1998
2091
|
var loadRAGEvaluationHistory = async ({
|
|
1999
2092
|
store,
|
|
2000
2093
|
suite,
|
|
@@ -2044,6 +2137,29 @@ var loadRAGAnswerGroundingEvaluationHistory = async ({
|
|
|
2044
2137
|
suiteLabel: suite.label ?? suite.id
|
|
2045
2138
|
};
|
|
2046
2139
|
};
|
|
2140
|
+
var loadRAGAnswerGroundingCaseDifficultyHistory = async ({
|
|
2141
|
+
store,
|
|
2142
|
+
suite,
|
|
2143
|
+
limit = DEFAULT_HISTORY_LIMIT
|
|
2144
|
+
}) => {
|
|
2145
|
+
const runs = normalizeGroundingDifficultyHistoryRuns(await Promise.resolve(store.listRuns({
|
|
2146
|
+
limit,
|
|
2147
|
+
suiteId: suite.id
|
|
2148
|
+
})));
|
|
2149
|
+
const latestRun = runs[0];
|
|
2150
|
+
const previousRun = runs[1];
|
|
2151
|
+
return {
|
|
2152
|
+
diff: latestRun && previousRun ? buildRAGAnswerGroundingCaseDifficultyRunDiff({
|
|
2153
|
+
current: latestRun,
|
|
2154
|
+
previous: previousRun
|
|
2155
|
+
}) : undefined,
|
|
2156
|
+
latestRun,
|
|
2157
|
+
previousRun,
|
|
2158
|
+
runs,
|
|
2159
|
+
suiteId: suite.id,
|
|
2160
|
+
suiteLabel: suite.label ?? suite.id
|
|
2161
|
+
};
|
|
2162
|
+
};
|
|
2047
2163
|
var persistRAGEvaluationSuiteRun = async ({
|
|
2048
2164
|
store,
|
|
2049
2165
|
run
|
|
@@ -2058,6 +2174,13 @@ var persistRAGAnswerGroundingEvaluationRun = async ({
|
|
|
2058
2174
|
await Promise.resolve(store.saveRun(run));
|
|
2059
2175
|
return run;
|
|
2060
2176
|
};
|
|
2177
|
+
var persistRAGAnswerGroundingCaseDifficultyRun = async ({
|
|
2178
|
+
store,
|
|
2179
|
+
run
|
|
2180
|
+
}) => {
|
|
2181
|
+
await Promise.resolve(store.saveRun(run));
|
|
2182
|
+
return run;
|
|
2183
|
+
};
|
|
2061
2184
|
var buildRAGEvaluationResponse = (cases) => {
|
|
2062
2185
|
const totalCases = cases.length;
|
|
2063
2186
|
const passedCases = cases.filter((entry) => entry.status === "pass").length;
|
|
@@ -3074,5 +3197,5 @@ export {
|
|
|
3074
3197
|
AIStreamKey
|
|
3075
3198
|
};
|
|
3076
3199
|
|
|
3077
|
-
//# debugId=
|
|
3200
|
+
//# debugId=C3E8EFD0B7AD1FB864756E2164756E21
|
|
3078
3201
|
//# sourceMappingURL=index.js.map
|