@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.
@@ -804,6 +804,69 @@ var formatTimestampLabel = (value) => {
804
804
  timeStyle: "short"
805
805
  });
806
806
  };
807
+ var formatRAGTraceValue = (value) => {
808
+ if (typeof value === "string")
809
+ return value;
810
+ if (typeof value === "number" || typeof value === "boolean") {
811
+ return String(value);
812
+ }
813
+ if (Array.isArray(value)) {
814
+ return value.join(", ");
815
+ }
816
+ if (value && typeof value === "object") {
817
+ return JSON.stringify(value);
818
+ }
819
+ return "n/a";
820
+ };
821
+ var buildRAGRetrievalTracePresentation = (trace) => {
822
+ if (!trace) {
823
+ return {
824
+ details: [],
825
+ stats: [],
826
+ steps: []
827
+ };
828
+ }
829
+ const stats = [
830
+ { label: "Mode", value: trace.mode },
831
+ { label: "Final Results", value: String(trace.resultCounts.final) },
832
+ {
833
+ label: "Vector Candidates",
834
+ value: String(trace.resultCounts.vector)
835
+ },
836
+ {
837
+ label: "Lexical Candidates",
838
+ value: String(trace.resultCounts.lexical)
839
+ }
840
+ ];
841
+ const details = [
842
+ { label: "Transformed query", value: trace.transformedQuery },
843
+ {
844
+ label: "Variant queries",
845
+ value: trace.variantQueries.length > 0 ? trace.variantQueries.join(" \xB7 ") : "none"
846
+ },
847
+ { label: "Candidate topK", value: String(trace.candidateTopK) },
848
+ { label: "Lexical topK", value: String(trace.lexicalTopK) }
849
+ ];
850
+ const steps = trace.steps.map((step) => ({
851
+ count: step.count,
852
+ label: step.label,
853
+ rows: [
854
+ { label: "stage", value: step.stage },
855
+ ...typeof step.count === "number" ? [{ label: "count", value: String(step.count) }] : [],
856
+ ...typeof step.durationMs === "number" ? [{ label: "durationMs", value: String(step.durationMs) }] : [],
857
+ ...Object.entries(step.metadata ?? {}).map(([key, value]) => ({
858
+ label: key,
859
+ value: formatRAGTraceValue(value)
860
+ }))
861
+ ],
862
+ stage: step.stage
863
+ }));
864
+ return {
865
+ details,
866
+ stats,
867
+ steps
868
+ };
869
+ };
807
870
  var formatMediaTimestamp = (value) => {
808
871
  if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
809
872
  return;
@@ -2390,6 +2453,64 @@ var buildRAGEvaluationHistoryRows = (history) => {
2390
2453
  }
2391
2454
  return rows;
2392
2455
  };
2456
+ var buildRAGEvaluationCaseTracePresentations = (history) => {
2457
+ if (!history?.caseTraceSnapshots.length) {
2458
+ return [];
2459
+ }
2460
+ return history.caseTraceSnapshots.map((entry) => {
2461
+ const label = entry.label ?? entry.caseId;
2462
+ const currentMode = entry.traceMode ?? "no-trace";
2463
+ const previousMode = entry.previousTraceMode ?? "n/a";
2464
+ const currentVariants = entry.variantQueries.length > 0 ? entry.variantQueries.join(", ") : "none";
2465
+ const previousVariants = entry.previousVariantQueries.length > 0 ? entry.previousVariantQueries.join(", ") : "none";
2466
+ const currentStages = Object.keys(entry.stageCounts).length > 0 ? Object.entries(entry.stageCounts).map(([stage, count]) => `${stage} ${count}`).join(", ") : "none";
2467
+ const previousStages = Object.keys(entry.previousStageCounts).length > 0 ? Object.entries(entry.previousStageCounts).map(([stage, count]) => `${stage} ${count}`).join(", ") : "none";
2468
+ return {
2469
+ caseId: entry.caseId,
2470
+ label,
2471
+ summary: `${entry.traceChange} \xB7 ${previousMode}\u2192${currentMode} \xB7 final ${entry.previousFinalCount ?? 0}\u2192${entry.finalCount}`,
2472
+ traceChange: entry.traceChange,
2473
+ rows: [
2474
+ { label: "Query", value: entry.query },
2475
+ { label: "Trace change", value: entry.traceChange },
2476
+ { label: "Mode", value: `${previousMode}\u2192${currentMode}` },
2477
+ {
2478
+ label: "Transformed query",
2479
+ value: `${entry.previousTransformedQuery?.trim() || "n/a"}\u2192${entry.transformedQuery?.trim() || "n/a"}`
2480
+ },
2481
+ {
2482
+ label: "Final",
2483
+ value: `${entry.previousFinalCount ?? 0}\u2192${entry.finalCount}`
2484
+ },
2485
+ {
2486
+ label: "Vector",
2487
+ value: `${entry.previousVectorCount ?? 0}\u2192${entry.vectorCount}`
2488
+ },
2489
+ {
2490
+ label: "Lexical",
2491
+ value: `${entry.previousLexicalCount ?? 0}\u2192${entry.lexicalCount}`
2492
+ },
2493
+ {
2494
+ label: "Candidate topK",
2495
+ value: `${entry.previousCandidateTopK ?? 0}\u2192${entry.candidateTopK}`
2496
+ },
2497
+ {
2498
+ label: "Lexical topK",
2499
+ value: `${entry.previousLexicalTopK ?? 0}\u2192${entry.lexicalTopK}`
2500
+ },
2501
+ {
2502
+ label: "Variants",
2503
+ value: `${previousVariants}\u2192${currentVariants}`
2504
+ },
2505
+ {
2506
+ label: "Stages",
2507
+ value: `${previousStages}\u2192${currentStages}`
2508
+ },
2509
+ { label: "Status", value: entry.status }
2510
+ ]
2511
+ };
2512
+ });
2513
+ };
2393
2514
  var buildRAGEvaluationRunDiff = ({
2394
2515
  current,
2395
2516
  previous
@@ -3042,5 +3163,5 @@ export {
3042
3163
  buildRAGAnswerWorkflowState
3043
3164
  };
3044
3165
 
3045
- //# debugId=EF37DD99ACE1DD0D64756E2164756E21
3166
+ //# debugId=13377B2A877EA26C64756E2164756E21
3046
3167
  //# sourceMappingURL=index.js.map