@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/index.js CHANGED
@@ -5195,10 +5195,49 @@ var buildRAGAnswerGroundingCaseDifficultyLeaderboard = (entries) => {
5195
5195
  totalEvaluations: entry.totalEvaluations
5196
5196
  }));
5197
5197
  };
5198
+ var buildGroundingDifficultyDiffEntry = (current, previous) => ({
5199
+ caseId: current.caseId,
5200
+ currentAverageCitationF1: current.averageCitationF1,
5201
+ currentFailRate: current.failRate,
5202
+ currentPassRate: current.passRate,
5203
+ currentRank: current.rank,
5204
+ label: current.label,
5205
+ previousAverageCitationF1: previous?.averageCitationF1,
5206
+ previousFailRate: previous?.failRate,
5207
+ previousPassRate: previous?.passRate,
5208
+ previousRank: previous?.rank,
5209
+ query: current.query
5210
+ });
5211
+ var buildRAGAnswerGroundingCaseDifficultyRunDiff = ({
5212
+ current,
5213
+ previous
5214
+ }) => {
5215
+ const previousEntries = new Map((previous?.entries ?? []).map((entry) => [entry.caseId, entry]));
5216
+ const diffs = current.entries.map((entry) => buildGroundingDifficultyDiffEntry(entry, previousEntries.get(entry.caseId)));
5217
+ return {
5218
+ currentRunId: current.id,
5219
+ easierCases: diffs.filter((entry) => {
5220
+ const previousRank = entry.previousRank ?? entry.currentRank;
5221
+ return entry.currentRank > previousRank;
5222
+ }),
5223
+ harderCases: diffs.filter((entry) => {
5224
+ const previousRank = entry.previousRank ?? Number.MAX_SAFE_INTEGER;
5225
+ return entry.currentRank < previousRank;
5226
+ }),
5227
+ previousRunId: previous?.id,
5228
+ suiteId: current.suiteId,
5229
+ unchangedCases: diffs.filter((entry) => {
5230
+ const previousRank = entry.previousRank ?? entry.currentRank;
5231
+ return entry.currentRank === previousRank;
5232
+ })
5233
+ };
5234
+ };
5198
5235
  var toHistorySortOrder = (left, right) => right.finishedAt - left.finishedAt;
5199
5236
  var normalizeHistoryRuns = (runs) => [...runs].sort(toHistorySortOrder);
5200
5237
  var toGroundingHistorySortOrder = (left, right) => right.finishedAt - left.finishedAt;
5201
5238
  var normalizeGroundingHistoryRuns = (runs) => [...runs].sort(toGroundingHistorySortOrder);
5239
+ var toGroundingDifficultyHistorySortOrder = (left, right) => right.finishedAt - left.finishedAt;
5240
+ var normalizeGroundingDifficultyHistoryRuns = (runs) => [...runs].sort(toGroundingDifficultyHistorySortOrder);
5202
5241
  var buildCaseDiff = (currentCase, previousCase) => ({
5203
5242
  caseId: currentCase.caseId,
5204
5243
  currentF1: currentCase.f1,
@@ -5384,6 +5423,42 @@ var createRAGFileAnswerGroundingEvaluationHistoryStore = (path) => ({
5384
5423
  }, null, 2));
5385
5424
  }
5386
5425
  });
5426
+ var createRAGFileAnswerGroundingCaseDifficultyHistoryStore = (path) => ({
5427
+ async listRuns(input) {
5428
+ try {
5429
+ const raw = await readFile2(path, "utf8");
5430
+ const data = JSON.parse(raw);
5431
+ const runs = Array.isArray(data.runs) ? data.runs : [];
5432
+ const filtered = input?.suiteId ? runs.filter((run) => run.suiteId === input.suiteId) : runs;
5433
+ return normalizeGroundingDifficultyHistoryRuns(filtered).slice(0, input?.limit ?? DEFAULT_HISTORY_LIMIT);
5434
+ } catch (error) {
5435
+ if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
5436
+ return [];
5437
+ }
5438
+ throw error;
5439
+ }
5440
+ },
5441
+ async saveRun(run) {
5442
+ let runs = [];
5443
+ try {
5444
+ const raw = await readFile2(path, "utf8");
5445
+ const data = JSON.parse(raw);
5446
+ runs = Array.isArray(data.runs) ? data.runs : [];
5447
+ } catch (error) {
5448
+ if (!error || typeof error !== "object" || !("code" in error) || error.code !== "ENOENT") {
5449
+ throw error;
5450
+ }
5451
+ }
5452
+ const nextRuns = normalizeGroundingDifficultyHistoryRuns([
5453
+ run,
5454
+ ...runs.filter((entry) => entry.id !== run.id)
5455
+ ]);
5456
+ await mkdir(dirname(path), { recursive: true });
5457
+ await writeFile(path, JSON.stringify({
5458
+ runs: nextRuns
5459
+ }, null, 2));
5460
+ }
5461
+ });
5387
5462
  var loadRAGEvaluationHistory = async ({
5388
5463
  store,
5389
5464
  suite,
@@ -5433,6 +5508,29 @@ var loadRAGAnswerGroundingEvaluationHistory = async ({
5433
5508
  suiteLabel: suite.label ?? suite.id
5434
5509
  };
5435
5510
  };
5511
+ var loadRAGAnswerGroundingCaseDifficultyHistory = async ({
5512
+ store,
5513
+ suite,
5514
+ limit = DEFAULT_HISTORY_LIMIT
5515
+ }) => {
5516
+ const runs = normalizeGroundingDifficultyHistoryRuns(await Promise.resolve(store.listRuns({
5517
+ limit,
5518
+ suiteId: suite.id
5519
+ })));
5520
+ const latestRun = runs[0];
5521
+ const previousRun = runs[1];
5522
+ return {
5523
+ diff: latestRun && previousRun ? buildRAGAnswerGroundingCaseDifficultyRunDiff({
5524
+ current: latestRun,
5525
+ previous: previousRun
5526
+ }) : undefined,
5527
+ latestRun,
5528
+ previousRun,
5529
+ runs,
5530
+ suiteId: suite.id,
5531
+ suiteLabel: suite.label ?? suite.id
5532
+ };
5533
+ };
5436
5534
  var persistRAGEvaluationSuiteRun = async ({
5437
5535
  store,
5438
5536
  run
@@ -5447,6 +5545,13 @@ var persistRAGAnswerGroundingEvaluationRun = async ({
5447
5545
  await Promise.resolve(store.saveRun(run));
5448
5546
  return run;
5449
5547
  };
5548
+ var persistRAGAnswerGroundingCaseDifficultyRun = async ({
5549
+ store,
5550
+ run
5551
+ }) => {
5552
+ await Promise.resolve(store.saveRun(run));
5553
+ return run;
5554
+ };
5450
5555
  var buildRAGEvaluationResponse = (cases) => {
5451
5556
  const totalCases = cases.length;
5452
5557
  const passedCases = cases.filter((entry) => entry.status === "pass").length;
@@ -10783,6 +10888,7 @@ export {
10783
10888
  prepareRAGDirectoryDocuments,
10784
10889
  persistRAGEvaluationSuiteRun,
10785
10890
  persistRAGAnswerGroundingEvaluationRun,
10891
+ persistRAGAnswerGroundingCaseDifficultyRun,
10786
10892
  parseAIMessage,
10787
10893
  openaiTranscriber,
10788
10894
  openaiResponses,
@@ -10810,6 +10916,7 @@ export {
10810
10916
  loadRAGDocumentFromURL,
10811
10917
  loadRAGDocumentFile,
10812
10918
  loadRAGAnswerGroundingEvaluationHistory,
10919
+ loadRAGAnswerGroundingCaseDifficultyHistory,
10813
10920
  ingestRAGDocuments,
10814
10921
  ingestDocuments,
10815
10922
  googleEmbeddings,
@@ -10852,6 +10959,7 @@ export {
10852
10959
  createRAGFileExtractor,
10853
10960
  createRAGFileEvaluationHistoryStore,
10854
10961
  createRAGFileAnswerGroundingEvaluationHistoryStore,
10962
+ createRAGFileAnswerGroundingCaseDifficultyHistoryStore,
10855
10963
  createRAGEvaluationSuite,
10856
10964
  createRAGEmbeddingProvider,
10857
10965
  createRAGEmailSyncSource,
@@ -10894,6 +11002,7 @@ export {
10894
11002
  buildRAGAnswerGroundingEvaluationRunDiff,
10895
11003
  buildRAGAnswerGroundingEvaluationResponse,
10896
11004
  buildRAGAnswerGroundingEvaluationLeaderboard,
11005
+ buildRAGAnswerGroundingCaseDifficultyRunDiff,
10897
11006
  buildRAGAnswerGroundingCaseDifficultyLeaderboard,
10898
11007
  applyRAGReranking,
10899
11008
  applyRAGQueryTransform,
@@ -10903,5 +11012,5 @@ export {
10903
11012
  aiChat
10904
11013
  };
10905
11014
 
10906
- //# debugId=9E8ADC0BDAB94FDA64756E2164756E21
11015
+ //# debugId=6BA83464C7071EAD64756E2164756E21
10907
11016
  //# sourceMappingURL=index.js.map