@absolutejs/absolute 0.19.0-beta.535 → 0.19.0-beta.537

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.
@@ -1286,6 +1286,24 @@ export type RAGLabelValueRow = {
1286
1286
  label: string;
1287
1287
  value: string;
1288
1288
  };
1289
+ export type RAGRetrievalTraceStepPresentation = {
1290
+ stage: RAGRetrievalTraceStage;
1291
+ label: string;
1292
+ count?: number;
1293
+ rows: RAGLabelValueRow[];
1294
+ };
1295
+ export type RAGRetrievalTracePresentation = {
1296
+ stats: RAGLabelValueRow[];
1297
+ details: RAGLabelValueRow[];
1298
+ steps: RAGRetrievalTraceStepPresentation[];
1299
+ };
1300
+ export type RAGEvaluationCaseTracePresentation = {
1301
+ caseId: string;
1302
+ label: string;
1303
+ summary: string;
1304
+ traceChange: RAGEvaluationCaseTraceSnapshot['traceChange'];
1305
+ rows: RAGLabelValueRow[];
1306
+ };
1289
1307
  export type RAGEvaluationLeaderboardEntry = {
1290
1308
  runId: string;
1291
1309
  suiteId: string;
@@ -1135,6 +1135,69 @@ var formatTimestampLabel = (value) => {
1135
1135
  timeStyle: "short"
1136
1136
  });
1137
1137
  };
1138
+ var formatRAGTraceValue = (value) => {
1139
+ if (typeof value === "string")
1140
+ return value;
1141
+ if (typeof value === "number" || typeof value === "boolean") {
1142
+ return String(value);
1143
+ }
1144
+ if (Array.isArray(value)) {
1145
+ return value.join(", ");
1146
+ }
1147
+ if (value && typeof value === "object") {
1148
+ return JSON.stringify(value);
1149
+ }
1150
+ return "n/a";
1151
+ };
1152
+ var buildRAGRetrievalTracePresentation = (trace) => {
1153
+ if (!trace) {
1154
+ return {
1155
+ details: [],
1156
+ stats: [],
1157
+ steps: []
1158
+ };
1159
+ }
1160
+ const stats = [
1161
+ { label: "Mode", value: trace.mode },
1162
+ { label: "Final Results", value: String(trace.resultCounts.final) },
1163
+ {
1164
+ label: "Vector Candidates",
1165
+ value: String(trace.resultCounts.vector)
1166
+ },
1167
+ {
1168
+ label: "Lexical Candidates",
1169
+ value: String(trace.resultCounts.lexical)
1170
+ }
1171
+ ];
1172
+ const details = [
1173
+ { label: "Transformed query", value: trace.transformedQuery },
1174
+ {
1175
+ label: "Variant queries",
1176
+ value: trace.variantQueries.length > 0 ? trace.variantQueries.join(" \xB7 ") : "none"
1177
+ },
1178
+ { label: "Candidate topK", value: String(trace.candidateTopK) },
1179
+ { label: "Lexical topK", value: String(trace.lexicalTopK) }
1180
+ ];
1181
+ const steps = trace.steps.map((step) => ({
1182
+ count: step.count,
1183
+ label: step.label,
1184
+ rows: [
1185
+ { label: "stage", value: step.stage },
1186
+ ...typeof step.count === "number" ? [{ label: "count", value: String(step.count) }] : [],
1187
+ ...typeof step.durationMs === "number" ? [{ label: "durationMs", value: String(step.durationMs) }] : [],
1188
+ ...Object.entries(step.metadata ?? {}).map(([key, value]) => ({
1189
+ label: key,
1190
+ value: formatRAGTraceValue(value)
1191
+ }))
1192
+ ],
1193
+ stage: step.stage
1194
+ }));
1195
+ return {
1196
+ details,
1197
+ stats,
1198
+ steps
1199
+ };
1200
+ };
1138
1201
  var formatMediaTimestamp = (value) => {
1139
1202
  if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
1140
1203
  return;
@@ -2414,6 +2477,64 @@ var buildRAGEvaluationHistoryRows = (history) => {
2414
2477
  }
2415
2478
  return rows;
2416
2479
  };
2480
+ var buildRAGEvaluationCaseTracePresentations = (history) => {
2481
+ if (!history?.caseTraceSnapshots.length) {
2482
+ return [];
2483
+ }
2484
+ return history.caseTraceSnapshots.map((entry) => {
2485
+ const label = entry.label ?? entry.caseId;
2486
+ const currentMode = entry.traceMode ?? "no-trace";
2487
+ const previousMode = entry.previousTraceMode ?? "n/a";
2488
+ const currentVariants = entry.variantQueries.length > 0 ? entry.variantQueries.join(", ") : "none";
2489
+ const previousVariants = entry.previousVariantQueries.length > 0 ? entry.previousVariantQueries.join(", ") : "none";
2490
+ const currentStages = Object.keys(entry.stageCounts).length > 0 ? Object.entries(entry.stageCounts).map(([stage, count]) => `${stage} ${count}`).join(", ") : "none";
2491
+ const previousStages = Object.keys(entry.previousStageCounts).length > 0 ? Object.entries(entry.previousStageCounts).map(([stage, count]) => `${stage} ${count}`).join(", ") : "none";
2492
+ return {
2493
+ caseId: entry.caseId,
2494
+ label,
2495
+ summary: `${entry.traceChange} \xB7 ${previousMode}\u2192${currentMode} \xB7 final ${entry.previousFinalCount ?? 0}\u2192${entry.finalCount}`,
2496
+ traceChange: entry.traceChange,
2497
+ rows: [
2498
+ { label: "Query", value: entry.query },
2499
+ { label: "Trace change", value: entry.traceChange },
2500
+ { label: "Mode", value: `${previousMode}\u2192${currentMode}` },
2501
+ {
2502
+ label: "Transformed query",
2503
+ value: `${entry.previousTransformedQuery?.trim() || "n/a"}\u2192${entry.transformedQuery?.trim() || "n/a"}`
2504
+ },
2505
+ {
2506
+ label: "Final",
2507
+ value: `${entry.previousFinalCount ?? 0}\u2192${entry.finalCount}`
2508
+ },
2509
+ {
2510
+ label: "Vector",
2511
+ value: `${entry.previousVectorCount ?? 0}\u2192${entry.vectorCount}`
2512
+ },
2513
+ {
2514
+ label: "Lexical",
2515
+ value: `${entry.previousLexicalCount ?? 0}\u2192${entry.lexicalCount}`
2516
+ },
2517
+ {
2518
+ label: "Candidate topK",
2519
+ value: `${entry.previousCandidateTopK ?? 0}\u2192${entry.candidateTopK}`
2520
+ },
2521
+ {
2522
+ label: "Lexical topK",
2523
+ value: `${entry.previousLexicalTopK ?? 0}\u2192${entry.lexicalTopK}`
2524
+ },
2525
+ {
2526
+ label: "Variants",
2527
+ value: `${previousVariants}\u2192${currentVariants}`
2528
+ },
2529
+ {
2530
+ label: "Stages",
2531
+ value: `${previousStages}\u2192${currentStages}`
2532
+ },
2533
+ { label: "Status", value: entry.status }
2534
+ ]
2535
+ };
2536
+ });
2537
+ };
2417
2538
  var buildRAGEvaluationRunDiff = ({
2418
2539
  current,
2419
2540
  previous
@@ -3705,5 +3826,5 @@ export {
3705
3826
  AIStreamKey
3706
3827
  };
3707
3828
 
3708
- //# debugId=E235F4588786F00E64756E2164756E21
3829
+ //# debugId=AF3F1B40777DBF8964756E2164756E21
3709
3830
  //# sourceMappingURL=index.js.map