judgeval 0.2.4 → 0.2.6

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.
Files changed (110) hide show
  1. package/dist/cjs/common/logger.js +28 -24
  2. package/dist/cjs/common/logger.js.map +1 -1
  3. package/dist/cjs/common/tracer.js +104 -150
  4. package/dist/cjs/common/tracer.js.map +1 -1
  5. package/dist/cjs/constants.js +2 -2
  6. package/dist/cjs/constants.js.map +1 -1
  7. package/dist/cjs/data/datasets/eval-dataset-client.js +45 -0
  8. package/dist/cjs/data/datasets/eval-dataset-client.js.map +1 -1
  9. package/dist/cjs/e2etests/eval-operations.test.js +3 -3
  10. package/dist/cjs/exporters/otel-exporter.js +352 -0
  11. package/dist/cjs/exporters/otel-exporter.js.map +1 -0
  12. package/dist/cjs/judges/index.js +217 -0
  13. package/dist/cjs/judges/index.js.map +1 -0
  14. package/dist/cjs/run-evaluation.js +13 -13
  15. package/dist/cjs/run-evaluation.js.map +1 -1
  16. package/dist/cjs/scorers/metrics/answer-correctness/answer-correctness.js +610 -0
  17. package/dist/cjs/scorers/metrics/answer-correctness/answer-correctness.js.map +1 -0
  18. package/dist/cjs/scorers/metrics/answer-correctness/index.js +19 -0
  19. package/dist/cjs/scorers/metrics/answer-correctness/index.js.map +1 -0
  20. package/dist/cjs/scorers/metrics/answer-correctness/prompts.js +175 -0
  21. package/dist/cjs/scorers/metrics/answer-correctness/prompts.js.map +1 -0
  22. package/dist/cjs/scorers/metrics/answer-relevancy/answer-relevancy.js +525 -0
  23. package/dist/cjs/scorers/metrics/answer-relevancy/answer-relevancy.js.map +1 -0
  24. package/dist/cjs/scorers/metrics/answer-relevancy/index.js +19 -0
  25. package/dist/cjs/scorers/metrics/answer-relevancy/index.js.map +1 -0
  26. package/dist/cjs/scorers/metrics/answer-relevancy/prompts.js +179 -0
  27. package/dist/cjs/scorers/metrics/answer-relevancy/prompts.js.map +1 -0
  28. package/dist/cjs/scorers/metrics/faithfulness/faithfulness.js +524 -0
  29. package/dist/cjs/scorers/metrics/faithfulness/faithfulness.js.map +1 -0
  30. package/dist/cjs/scorers/metrics/faithfulness/index.js +19 -0
  31. package/dist/cjs/scorers/metrics/faithfulness/index.js.map +1 -0
  32. package/dist/cjs/scorers/metrics/faithfulness/prompts.js +232 -0
  33. package/dist/cjs/scorers/metrics/faithfulness/prompts.js.map +1 -0
  34. package/dist/cjs/scorers/metrics/hallucination/hallucination.js +390 -0
  35. package/dist/cjs/scorers/metrics/hallucination/hallucination.js.map +1 -0
  36. package/dist/cjs/scorers/metrics/hallucination/index.js +11 -0
  37. package/dist/cjs/scorers/metrics/hallucination/index.js.map +1 -0
  38. package/dist/cjs/scorers/metrics/hallucination/prompts.js +106 -0
  39. package/dist/cjs/scorers/metrics/hallucination/prompts.js.map +1 -0
  40. package/dist/cjs/scorers/metrics/instruction-adherence/index.js +19 -0
  41. package/dist/cjs/scorers/metrics/instruction-adherence/index.js.map +1 -0
  42. package/dist/cjs/scorers/metrics/instruction-adherence/instruction-adherence.js +382 -0
  43. package/dist/cjs/scorers/metrics/instruction-adherence/instruction-adherence.js.map +1 -0
  44. package/dist/cjs/scorers/metrics/instruction-adherence/prompts.js +124 -0
  45. package/dist/cjs/scorers/metrics/instruction-adherence/prompts.js.map +1 -0
  46. package/dist/esm/common/logger.js +16 -11
  47. package/dist/esm/common/logger.js.map +1 -1
  48. package/dist/esm/common/tracer.js +103 -149
  49. package/dist/esm/common/tracer.js.map +1 -1
  50. package/dist/esm/constants.js +1 -1
  51. package/dist/esm/constants.js.map +1 -1
  52. package/dist/esm/data/datasets/eval-dataset-client.js +46 -1
  53. package/dist/esm/data/datasets/eval-dataset-client.js.map +1 -1
  54. package/dist/esm/e2etests/eval-operations.test.js +3 -3
  55. package/dist/esm/exporters/otel-exporter.js +348 -0
  56. package/dist/esm/exporters/otel-exporter.js.map +1 -0
  57. package/dist/esm/judges/index.js +185 -0
  58. package/dist/esm/judges/index.js.map +1 -0
  59. package/dist/esm/scorers/metrics/answer-correctness/answer-correctness.js +601 -0
  60. package/dist/esm/scorers/metrics/answer-correctness/answer-correctness.js.map +1 -0
  61. package/dist/esm/scorers/metrics/answer-correctness/index.js +3 -0
  62. package/dist/esm/scorers/metrics/answer-correctness/index.js.map +1 -0
  63. package/dist/esm/scorers/metrics/answer-correctness/prompts.js +171 -0
  64. package/dist/esm/scorers/metrics/answer-correctness/prompts.js.map +1 -0
  65. package/dist/esm/scorers/metrics/answer-relevancy/answer-relevancy.js +521 -0
  66. package/dist/esm/scorers/metrics/answer-relevancy/answer-relevancy.js.map +1 -0
  67. package/dist/esm/scorers/metrics/answer-relevancy/index.js +3 -0
  68. package/dist/esm/scorers/metrics/answer-relevancy/index.js.map +1 -0
  69. package/dist/esm/scorers/metrics/answer-relevancy/prompts.js +175 -0
  70. package/dist/esm/scorers/metrics/answer-relevancy/prompts.js.map +1 -0
  71. package/dist/esm/scorers/metrics/faithfulness/faithfulness.js +520 -0
  72. package/dist/esm/scorers/metrics/faithfulness/faithfulness.js.map +1 -0
  73. package/dist/esm/scorers/metrics/faithfulness/index.js +3 -0
  74. package/dist/esm/scorers/metrics/faithfulness/index.js.map +1 -0
  75. package/dist/esm/scorers/metrics/faithfulness/prompts.js +228 -0
  76. package/dist/esm/scorers/metrics/faithfulness/prompts.js.map +1 -0
  77. package/dist/esm/scorers/metrics/hallucination/hallucination.js +386 -0
  78. package/dist/esm/scorers/metrics/hallucination/hallucination.js.map +1 -0
  79. package/dist/esm/scorers/metrics/hallucination/index.js +3 -0
  80. package/dist/esm/scorers/metrics/hallucination/index.js.map +1 -0
  81. package/dist/esm/scorers/metrics/hallucination/prompts.js +102 -0
  82. package/dist/esm/scorers/metrics/hallucination/prompts.js.map +1 -0
  83. package/dist/esm/scorers/metrics/instruction-adherence/index.js +3 -0
  84. package/dist/esm/scorers/metrics/instruction-adherence/index.js.map +1 -0
  85. package/dist/esm/scorers/metrics/instruction-adherence/instruction-adherence.js +378 -0
  86. package/dist/esm/scorers/metrics/instruction-adherence/instruction-adherence.js.map +1 -0
  87. package/dist/esm/scorers/metrics/instruction-adherence/prompts.js +120 -0
  88. package/dist/esm/scorers/metrics/instruction-adherence/prompts.js.map +1 -0
  89. package/dist/types/common/logger.d.ts +1 -1
  90. package/dist/types/common/tracer.d.ts +29 -6
  91. package/dist/types/constants.d.ts +1 -1
  92. package/dist/types/data/datasets/eval-dataset-client.d.ts +5 -0
  93. package/dist/types/exporters/otel-exporter.d.ts +16 -0
  94. package/dist/types/judges/index.d.ts +50 -0
  95. package/dist/types/scorers/metrics/answer-correctness/answer-correctness.d.ts +99 -0
  96. package/dist/types/scorers/metrics/answer-correctness/index.d.ts +2 -0
  97. package/dist/types/scorers/metrics/answer-correctness/prompts.d.ts +71 -0
  98. package/dist/types/scorers/metrics/answer-relevancy/answer-relevancy.d.ts +78 -0
  99. package/dist/types/scorers/metrics/answer-relevancy/index.d.ts +2 -0
  100. package/dist/types/scorers/metrics/answer-relevancy/prompts.d.ts +71 -0
  101. package/dist/types/scorers/metrics/faithfulness/faithfulness.d.ts +77 -0
  102. package/dist/types/scorers/metrics/faithfulness/index.d.ts +2 -0
  103. package/dist/types/scorers/metrics/faithfulness/prompts.d.ts +94 -0
  104. package/dist/types/scorers/metrics/hallucination/hallucination.d.ts +67 -0
  105. package/dist/types/scorers/metrics/hallucination/index.d.ts +3 -0
  106. package/dist/types/scorers/metrics/hallucination/prompts.d.ts +63 -0
  107. package/dist/types/scorers/metrics/instruction-adherence/index.d.ts +2 -0
  108. package/dist/types/scorers/metrics/instruction-adherence/instruction-adherence.d.ts +67 -0
  109. package/dist/types/scorers/metrics/instruction-adherence/prompts.d.ts +78 -0
  110. package/package.json +32 -14
@@ -6,7 +6,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
6
6
  return (mod && mod.__esModule) ? mod : { "default": mod };
7
7
  };
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.print = exports.printResults = exports.formatEvaluationResults = exports.withExampleContext = exports.clearExampleContext = exports.setExampleContext = exports.error = exports.warn = exports.warning = exports.info = exports.log = exports.debug = void 0;
9
+ exports.debug = debug;
10
+ exports.log = log;
11
+ exports.info = info;
12
+ exports.warning = warning;
13
+ exports.warn = warn;
14
+ exports.error = error;
15
+ exports.setExampleContext = setExampleContext;
16
+ exports.clearExampleContext = clearExampleContext;
17
+ exports.withExampleContext = withExampleContext;
18
+ exports.formatEvaluationResults = formatEvaluationResults;
19
+ exports.printResults = printResults;
20
+ exports.print = print;
10
21
  // Remove fs and path imports if no longer needed
11
22
  // import * as fs from 'fs';
12
23
  // import * as path from 'path';
@@ -18,49 +29,48 @@ let currentTimestamp = null;
18
29
  * Log a debug message
19
30
  */
20
31
  function debug(message, meta) {
21
- logger_instance_js_1.default.debug(message, Object.assign(Object.assign({}, meta), { exampleId: currentExampleId, timestamp: currentTimestamp }));
32
+ // Prioritize meta.exampleId over currentExampleId
33
+ const exampleId = (meta === null || meta === void 0 ? void 0 : meta.exampleId) !== undefined ? meta.exampleId : currentExampleId;
34
+ logger_instance_js_1.default.debug(message, Object.assign(Object.assign({}, meta), { exampleId, timestamp: currentTimestamp }));
22
35
  }
23
- exports.debug = debug;
24
36
  /**
25
37
  * Log an info message (alias for info)
26
38
  */
27
- function log(message, ...args) {
28
- // Simple handling for additional args, could be improved
29
- let meta = { args: [] };
30
- if (args.length > 0) {
31
- meta = { args: args };
32
- }
33
- logger_instance_js_1.default.info(message, Object.assign(Object.assign({}, meta), { exampleId: currentExampleId, timestamp: currentTimestamp }));
39
+ function log(message, meta) {
40
+ // Prioritize meta.exampleId over currentExampleId
41
+ const exampleId = (meta === null || meta === void 0 ? void 0 : meta.exampleId) !== undefined ? meta.exampleId : currentExampleId;
42
+ logger_instance_js_1.default.info(message, Object.assign(Object.assign({}, meta), { exampleId, timestamp: currentTimestamp }));
34
43
  }
35
- exports.log = log;
36
44
  /**
37
45
  * Log an info message
38
46
  */
39
47
  function info(message, meta) {
40
- logger_instance_js_1.default.info(message, Object.assign(Object.assign({}, meta), { exampleId: currentExampleId, timestamp: currentTimestamp }));
48
+ // Prioritize meta.exampleId over currentExampleId
49
+ const exampleId = (meta === null || meta === void 0 ? void 0 : meta.exampleId) !== undefined ? meta.exampleId : currentExampleId;
50
+ logger_instance_js_1.default.info(message, Object.assign(Object.assign({}, meta), { exampleId, timestamp: currentTimestamp }));
41
51
  }
42
- exports.info = info;
43
52
  /**
44
53
  * Log a warning message
45
54
  */
46
55
  function warning(message, meta) {
47
- logger_instance_js_1.default.warn(message, Object.assign(Object.assign({}, meta), { exampleId: currentExampleId, timestamp: currentTimestamp }));
56
+ // Prioritize meta.exampleId over currentExampleId
57
+ const exampleId = (meta === null || meta === void 0 ? void 0 : meta.exampleId) !== undefined ? meta.exampleId : currentExampleId;
58
+ logger_instance_js_1.default.warn(message, Object.assign(Object.assign({}, meta), { exampleId, timestamp: currentTimestamp }));
48
59
  }
49
- exports.warning = warning;
50
60
  /**
51
61
  * Alias for warning
52
62
  */
53
63
  function warn(message, meta) {
54
64
  warning(message, meta);
55
65
  }
56
- exports.warn = warn;
57
66
  /**
58
67
  * Log an error message
59
68
  */
60
69
  function error(message, meta) {
61
- logger_instance_js_1.default.error(message, Object.assign(Object.assign({}, meta), { exampleId: currentExampleId, timestamp: currentTimestamp }));
70
+ // Prioritize meta.exampleId over currentExampleId
71
+ const exampleId = (meta === null || meta === void 0 ? void 0 : meta.exampleId) !== undefined ? meta.exampleId : currentExampleId;
72
+ logger_instance_js_1.default.error(message, Object.assign(Object.assign({}, meta), { exampleId, timestamp: currentTimestamp }));
62
73
  }
63
- exports.error = error;
64
74
  /**
65
75
  * Set the current example context for logging (Keep for potential context integration)
66
76
  */
@@ -68,7 +78,6 @@ function setExampleContext(exampleId, timestamp) {
68
78
  currentExampleId = exampleId;
69
79
  currentTimestamp = timestamp;
70
80
  }
71
- exports.setExampleContext = setExampleContext;
72
81
  /**
73
82
  * Clear the current example context (Keep for potential context integration)
74
83
  */
@@ -76,7 +85,6 @@ function clearExampleContext() {
76
85
  currentExampleId = null;
77
86
  currentTimestamp = null;
78
87
  }
79
- exports.clearExampleContext = clearExampleContext;
80
88
  /**
81
89
  * Create a context for example-specific logging (Keep for potential context integration)
82
90
  */
@@ -89,7 +97,6 @@ function withExampleContext(exampleId, timestamp, fn) {
89
97
  clearExampleContext();
90
98
  }
91
99
  }
92
- exports.withExampleContext = withExampleContext;
93
100
  /**
94
101
  * Format evaluation results for display
95
102
  * This matches the Python SDK's output format with clickable links
@@ -127,7 +134,6 @@ function formatEvaluationResults(results, projectName, evalName) {
127
134
  }
128
135
  return output;
129
136
  }
130
- exports.formatEvaluationResults = formatEvaluationResults;
131
137
  /**
132
138
  * Print evaluation results to the console
133
139
  * This matches the Python SDK's output format exactly
@@ -150,7 +156,6 @@ function printResults(results, projectName, evalName) {
150
156
  // Print raw results in the same format as Python SDK
151
157
  console.log(JSON.stringify(results, null, 2));
152
158
  }
153
- exports.printResults = printResults;
154
159
  /**
155
160
  * Simplified print function for results - matches Python SDK's print(results) behavior
156
161
  * This is the preferred way to print results
@@ -217,5 +222,4 @@ function print(data) {
217
222
  console.log(JSON.stringify(data, null, 2));
218
223
  }
219
224
  }
220
- exports.print = print;
221
225
  //# sourceMappingURL=logger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/common/logger.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;AAEH,iDAAiD;AACjD,4BAA4B;AAC5B,gCAAgC;AAChC,8EAA0C,CAAC,uCAAuC;AAElF,sEAAsE;AACtE,IAAI,gBAAgB,GAAkB,IAAI,CAAC;AAC3C,IAAI,gBAAgB,GAAkB,IAAI,CAAC;AAE3C;;GAEG;AACH,SAAgB,KAAK,CAAC,OAAe,EAAE,IAA0B;IAC/D,4BAAM,CAAC,KAAK,CAAC,OAAO,kCAAO,IAAI,KAAE,SAAS,EAAE,gBAAgB,EAAE,SAAS,EAAE,gBAAgB,IAAG,CAAC;AAC/F,CAAC;AAFD,sB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IACH,CAAC;SAAM,CAAC;QACN,0BAA0B;QAC1B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC;AACH,CAAC"}
@@ -12,7 +12,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.TraceManagerClient = exports.TraceClient = exports.Tracer = exports.wrap = void 0;
15
+ exports.TraceManagerClient = exports.TraceClient = exports.Tracer = void 0;
16
+ exports.wrap = wrap;
16
17
  // Core Node.js imports
17
18
  const uuid_1 = require("uuid");
18
19
  const async_hooks_1 = require("async_hooks");
@@ -166,15 +167,6 @@ class TraceManagerClient {
166
167
  });
167
168
  });
168
169
  }
169
- addTraceToEvalQueue(traceData) {
170
- return __awaiter(this, void 0, void 0, function* () {
171
- // Ensure traceData has the necessary structure for the queue endpoint
172
- return this._fetch(constants_js_1.JUDGMENT_TRACES_ADD_TO_EVAL_QUEUE_API_URL, {
173
- method: 'POST',
174
- body: JSON.stringify(traceData), // Send the full trace data as per Python impl
175
- });
176
- });
177
- }
178
170
  /**
179
171
  * Calculate token costs directly using the API endpoint.
180
172
  * This is more accurate than client-side calculation as it uses the most up-to-date pricing.
@@ -235,8 +227,9 @@ function sanitizeName(name) {
235
227
  class TraceClient {
236
228
  constructor(config) {
237
229
  var _a, _b, _c, _d, _e;
238
- this.traceManager = null; // Can be null if monitoring disabled
230
+ this.traceManager = null; // Made public for wrap access
239
231
  this._spanDepths = {}; // Track depth of active spans
232
+ this.pendingEvaluationRuns = []; // <-- ADDED: Store pending evaluations
240
233
  this.traceId = config.traceId || (0, uuid_1.v4)();
241
234
  this.originalName = config.name || 'default_trace'; // Store original
242
235
  this.name = sanitizeName(this.originalName); // Use sanitized name internally
@@ -410,7 +403,6 @@ class TraceClient {
410
403
  condenseTrace(rawEntries) {
411
404
  var _a, _b, _c, _d, _e;
412
405
  const spansById = {};
413
- const allEvaluationRuns = [];
414
406
  for (const entry of rawEntries) {
415
407
  const spanId = entry.span_id;
416
408
  if (!spanId)
@@ -458,9 +450,6 @@ class TraceClient {
458
450
  case 'output':
459
451
  case 'error':
460
452
  currentSpanData.output = entry.output;
461
- if (entry.type === 'output' && entry.output && typeof entry.output === 'object' && 'eval_name' in entry.output && 'scorers' in entry.output && 'trace_span_id' in entry.output) {
462
- allEvaluationRuns.push(entry.output);
463
- }
464
453
  break;
465
454
  }
466
455
  }
@@ -515,18 +504,20 @@ class TraceClient {
515
504
  buildFlatListDfs(span);
516
505
  }
517
506
  }
518
- return [sortedCondensedList, allEvaluationRuns];
507
+ return sortedCondensedList;
519
508
  }
520
509
  save() {
521
510
  return __awaiter(this, arguments, void 0, function* (emptySave = false) {
522
- var _a, _b, _c, _d, _e;
523
- if (!this.enableMonitoring || !this.traceManager) {
511
+ var _a;
512
+ // If monitoring is disabled or trace hasn't started, don't save
513
+ if (!this.enableMonitoring || this.startTime === -1 || !this.traceManager) {
514
+ logger_instance_js_1.default.info(`[TraceClient ${this.traceId}] Monitoring disabled or trace not started. Not saving.`);
524
515
  return null;
525
516
  }
526
- const traceClientContext = getTraceClientContext();
527
- const totalDuration = this.getDuration();
528
- // Use the tuple returned by condenseTrace
529
- const [condensedEntries, evaluationRuns] = this.condenseTrace(traceClientContext.entries);
517
+ const endTime = Date.now() / 1000; // Current time in seconds
518
+ const duration = endTime - this.startTime;
519
+ const condensedEntries = this.condenseTrace(getTraceClientContext().entries);
520
+ // Calculate token counts and costs
530
521
  const tokenCounts = {
531
522
  prompt_tokens: 0,
532
523
  completion_tokens: 0,
@@ -535,146 +526,77 @@ class TraceClient {
535
526
  completion_tokens_cost_usd: 0.0,
536
527
  total_cost_usd: 0.0
537
528
  };
538
- // First pass: collect all LLM calls with their token counts
539
- const llmCalls = [];
540
- let index = 0;
529
+ // Use a Set to avoid double-counting tokens from nested calls if structure is complex
530
+ // Note: Assuming span_ids are unique across the trace
531
+ const processedSpanIds = new Set();
541
532
  for (const entry of condensedEntries) {
533
+ if (processedSpanIds.has(entry.span_id))
534
+ continue;
535
+ processedSpanIds.add(entry.span_id);
542
536
  if (entry.span_type === 'llm' && ((_a = entry.output) === null || _a === void 0 ? void 0 : _a.usage)) {
543
537
  const usage = entry.output.usage;
544
- const modelName = ((_b = entry.inputs) === null || _b === void 0 ? void 0 : _b.model) || "";
545
- let promptTokens = 0;
546
- let completionTokens = 0;
547
- // Handle different token naming conventions
548
- if (usage.prompt_tokens !== undefined || usage.completion_tokens !== undefined) {
549
- promptTokens = usage.prompt_tokens || 0;
550
- completionTokens = usage.completion_tokens || 0;
538
+ // Sum tokens
539
+ tokenCounts.prompt_tokens += usage.prompt_tokens || usage.input_tokens || 0;
540
+ tokenCounts.completion_tokens += usage.completion_tokens || usage.output_tokens || 0;
541
+ tokenCounts.total_tokens += usage.total_tokens ||
542
+ ((usage.prompt_tokens || usage.input_tokens || 0) +
543
+ (usage.completion_tokens || usage.output_tokens || 0));
544
+ // Sum costs embedded in the usage object (if they exist)
545
+ if (usage.prompt_tokens_cost_usd !== undefined) {
546
+ tokenCounts.prompt_tokens_cost_usd += usage.prompt_tokens_cost_usd;
551
547
  }
552
- else if (usage.input_tokens !== undefined || usage.output_tokens !== undefined) {
553
- promptTokens = usage.input_tokens || 0;
554
- completionTokens = usage.output_tokens || 0;
555
- // Standardize naming
556
- usage.prompt_tokens = promptTokens;
557
- usage.completion_tokens = completionTokens;
558
- delete usage.input_tokens;
559
- delete usage.output_tokens;
560
- }
561
- tokenCounts.prompt_tokens += promptTokens;
562
- tokenCounts.completion_tokens += completionTokens;
563
- tokenCounts.total_tokens += usage.total_tokens || (promptTokens + completionTokens);
564
- // Add to list of calls for cost calculation
565
- if (modelName) {
566
- llmCalls.push({
567
- modelName,
568
- promptTokens,
569
- completionTokens,
570
- entryIndex: index
571
- });
572
- }
573
- }
574
- index++;
575
- }
576
- // Second pass: calculate costs for each LLM call using the API
577
- if (this.traceManager && llmCalls.length > 0) {
578
- // Process each LLM call
579
- for (const call of llmCalls) {
580
- try {
581
- // Get costs from the API
582
- const costs = yield this.traceManager.calculateTokenCosts(call.modelName, call.promptTokens, call.completionTokens);
583
- if (costs) {
584
- // Update the entry with the costs
585
- const entry = condensedEntries[call.entryIndex];
586
- // Ensure output and usage objects exist before assigning costs
587
- if (entry.output && entry.output.usage) {
588
- // --- This part assigns costs to the individual span ---
589
- entry.output.usage.prompt_tokens_cost_usd = costs.prompt_tokens_cost_usd;
590
- entry.output.usage.completion_tokens_cost_usd = costs.completion_tokens_cost_usd;
591
- entry.output.usage.total_cost_usd = costs.total_cost_usd;
592
- logger_instance_js_1.default.debug(`Assigned costs to span ${entry.span_id} (model: ${call.modelName})`, { costs }); // Added debug log
593
- // -----------------------------------------------------
594
- }
595
- else {
596
- logger_instance_js_1.default.warn(`Could not assign costs to span ${entry.span_id} (model: ${call.modelName}): Missing 'output' or 'output.usage' object.`, { output: entry.output }); // Log if structure is missing
597
- }
598
- // Add to the total costs for the trace
599
- tokenCounts.prompt_tokens_cost_usd += (_c = costs.prompt_tokens_cost_usd) !== null && _c !== void 0 ? _c : 0.0;
600
- tokenCounts.completion_tokens_cost_usd += (_d = costs.completion_tokens_cost_usd) !== null && _d !== void 0 ? _d : 0.0;
601
- tokenCounts.total_cost_usd += (_e = costs.total_cost_usd) !== null && _e !== void 0 ? _e : 0.0;
602
- }
603
- else {
604
- // If calculation failed, set costs to null in the entry (matching Python behavior)
605
- const entry = condensedEntries[call.entryIndex];
606
- // Ensure output and usage objects exist before assigning null costs
607
- if (entry.output && entry.output.usage) {
608
- // --- Sets null costs on the individual span ---
609
- entry.output.usage.prompt_tokens_cost_usd = null;
610
- entry.output.usage.completion_tokens_cost_usd = null;
611
- entry.output.usage.total_cost_usd = null;
612
- // ------------------------------------------
613
- }
614
- else {
615
- // Log if we can't even assign null because the structure is missing
616
- logger_instance_js_1.default.warn(`Could not assign null costs to span ${entry.span_id} (model: ${call.modelName}): Missing 'output' or 'output.usage' object.`, { output: entry.output });
617
- }
618
- logger_instance_js_1.default.warn(`Token cost calculation failed for model '${call.modelName}'. Cost information will be null for this span.`); // More specific warning
619
- }
548
+ if (usage.completion_tokens_cost_usd !== undefined) {
549
+ tokenCounts.completion_tokens_cost_usd += usage.completion_tokens_cost_usd;
620
550
  }
621
- catch (e) {
622
- logger_instance_js_1.default.warn(`Error during cost calculation loop for model '${call.modelName}':`, e); // Adjusted logging
623
- // Set costs to null in the entry if an error occurs during the loop iteration
624
- const entry = condensedEntries[call.entryIndex];
625
- // Ensure output and usage objects exist before assigning null costs on error
626
- if (entry.output && entry.output.usage) {
627
- // --- Sets null costs on the individual span on error ---
628
- entry.output.usage.prompt_tokens_cost_usd = null;
629
- entry.output.usage.completion_tokens_cost_usd = null;
630
- entry.output.usage.total_cost_usd = null;
631
- // ----------------------------------------------------
632
- }
633
- else {
634
- // Log if we can't assign null on error because the structure is missing
635
- logger_instance_js_1.default.warn(`Could not assign null costs to span ${entry.span_id} (model: ${call.modelName}) on error: Missing 'output' or 'output.usage' object.`, { output: entry.output });
636
- }
551
+ if (usage.total_cost_usd !== undefined) {
552
+ tokenCounts.total_cost_usd += usage.total_cost_usd;
637
553
  }
638
554
  }
639
555
  }
640
- // Convert rules array to a dictionary (Record<string, Rule>)
641
- const rulesDict = {};
642
- this.rules.forEach(rule => {
643
- var _a;
644
- // Use rule_id if available, otherwise fallback to name
645
- const key = (_a = rule.rule_id) !== null && _a !== void 0 ? _a : rule.name;
646
- rulesDict[key] = rule;
647
- });
556
+ // --- Retrieve and include pending evaluation runs ---
557
+ const evaluationRunsToSave = [...this.pendingEvaluationRuns];
558
+ // ----------------------------------------------------
648
559
  const traceData = {
649
560
  trace_id: this.traceId,
650
- name: this.name,
561
+ name: this.name, // Use the sanitized name
651
562
  project_name: this.projectName,
652
- created_at: new Date(this.startTime * 1000).toISOString(),
653
- duration: totalDuration,
563
+ created_at: new Date(this.startTime * 1000).toISOString(), // Convert start time to ISO string
564
+ duration: duration < 0 ? 0 : duration,
654
565
  token_counts: tokenCounts,
655
- entries: condensedEntries,
656
- evaluation_runs: evaluationRuns,
566
+ entries: condensedEntries, // Send the potentially nested structure from condenseTrace
567
+ evaluation_runs: evaluationRunsToSave, // <-- ADDED: Include collected evaluations
657
568
  overwrite: this.overwrite,
658
569
  parent_trace_id: this.parentTraceId,
659
- parent_name: this.parentName
570
+ parent_name: this.parentName,
660
571
  };
661
- try {
662
- yield this.traceManager.saveTrace(traceData);
663
- logger_instance_js_1.default.info(`Trace ${this.traceId} saved successfully.`);
664
- if (this.enableEvaluations) {
665
- try {
666
- yield this.traceManager.addTraceToEvalQueue(traceData);
667
- logger_instance_js_1.default.info(`Trace ${this.traceId} added to evaluation queue.`);
668
- }
669
- catch (evalError) {
670
- logger_instance_js_1.default.warn(`Failed to add trace ${this.traceId} to evaluation queue.`, { error: evalError instanceof Error ? evalError.message : String(evalError) });
671
- }
672
- }
572
+ // <<< ADD LOGGING HERE >>>
573
+ logger_instance_js_1.default.info(`[TraceClient ${this.traceId}] Payload to be saved:`, JSON.stringify(traceData, null, 2));
574
+ // <<< ADD SPECIFIC LOGGING FOR EVALUATION RUNS (using INFO level) >>>
575
+ logger_instance_js_1.default.info(`[TraceClient ${this.traceId}] Evaluation runs included in payload:`, JSON.stringify(traceData.evaluation_runs, null, 2));
576
+ // <<< END SPECIFIC LOGGING >>>
577
+ if (emptySave) {
578
+ // Skip actual saving if emptySave is true (used for context management in generators)
579
+ logger_instance_js_1.default.info(`[TraceClient ${this.traceId}] emptySave=true, skipping actual save call.`);
673
580
  return { traceId: this.traceId, traceData };
674
581
  }
582
+ try {
583
+ logger_instance_js_1.default.info(`[TraceClient ${this.traceId}] Calling traceManager.saveTrace...`);
584
+ const response = yield this.traceManager.saveTrace(traceData);
585
+ logger_instance_js_1.default.info(`[TraceClient ${this.traceId}] Trace saved successfully. Response:`, response);
586
+ // Reset trace context after successful save
587
+ getTraceClientContext().entries = [];
588
+ getTraceClientContext().entryStack = [];
589
+ this.pendingEvaluationRuns = []; // <-- ADDED: Clear pending evaluations
590
+ this.startTime = -1; // Reset start time
591
+ return { traceId: this.traceId, traceData: traceData }; // Return payload on success
592
+ }
675
593
  catch (error) {
676
- logger_instance_js_1.default.error(`Failed to save trace ${this.traceId}.`, { error: error instanceof Error ? error.message : String(error) });
677
- return null;
594
+ logger_instance_js_1.default.error(`[TraceClient ${this.traceId}] Error saving trace:`, error);
595
+ // Optionally reset context even on error?
596
+ // getTraceClientContext().entries = [];
597
+ // getTraceClientContext().entryStack = [];
598
+ // this.startTime = -1;
599
+ return null; // Indicate save failure
678
600
  }
679
601
  });
680
602
  }
@@ -802,7 +724,7 @@ class TraceClient {
802
724
  const traceClientContext = getTraceClientContext();
803
725
  const currentEntry = traceClientContext.entryStack.at(-1);
804
726
  if (!currentEntry) {
805
- logger_instance_js_1.default.warn(`No current entry to record evaluation to\nStack trace: ${new Error().stack}`);
727
+ logger_instance_js_1.default.warn(`No current entry to associate evaluation with\\nStack trace: ${new Error().stack}`);
806
728
  return;
807
729
  }
808
730
  const currentSpanId = currentEntry.span_id; // Get the span ID
@@ -833,8 +755,13 @@ class TraceClient {
833
755
  rules: loadedRules, // Pass the processed rules
834
756
  trace_span_id: currentSpanId // <<< RENAMED: Assign the current span ID (matching backend)
835
757
  };
836
- // Add evaluation entry to the trace
837
- this.recordOutput(evalRunPayload);
758
+ // --- Log the payload before storing (using INFO level) ---
759
+ logger_instance_js_1.default.info(`[TraceClient ${this.traceId}] Storing EvaluationRunPayload for span ${currentSpanId}:`, JSON.stringify(evalRunPayload, null, 2));
760
+ // --- End log before store ---
761
+ // --- Store the payload instead of sending ---
762
+ this.pendingEvaluationRuns.push(evalRunPayload);
763
+ logger_instance_js_1.default.info(`[TraceClient ${this.traceId}] Evaluation payload stored for span ${currentSpanId}`);
764
+ // --- End store payload ---
838
765
  }
839
766
  catch (error) {
840
767
  logger_instance_js_1.default.error(`Failed during asyncEvaluate execution: ${error instanceof Error ? error.message : String(error)}`);
@@ -1099,11 +1026,13 @@ function wrap(client) {
1099
1026
  const { spanName, originalMethod, methodOwner, methodName } = config;
1100
1027
  const boundOriginalMethod = originalMethod.bind(methodOwner);
1101
1028
  const tracedMethod = (...args) => __awaiter(this, void 0, void 0, function* () {
1029
+ var _a, _b, _c, _d;
1102
1030
  const currentTrace = tracer.getCurrentTrace();
1103
1031
  if (!currentTrace || !currentTrace.enableMonitoring) {
1104
1032
  return boundOriginalMethod(...args);
1105
1033
  }
1106
1034
  let response;
1035
+ let outputData = null; // Initialize outputData
1107
1036
  for (const span of currentTrace.span(spanName, { spanType: 'llm' })) {
1108
1037
  const inputData = _formatInputData(client, args);
1109
1038
  currentTrace.recordInput(inputData);
@@ -1114,9 +1043,35 @@ function wrap(client) {
1114
1043
  currentTrace.recordError(error);
1115
1044
  throw error;
1116
1045
  }
1117
- const outputData = _formatOutputData(client, response);
1118
- currentTrace.recordOutput(outputData);
1046
+ outputData = _formatOutputData(client, response);
1047
+ // --- Calculate and Embed Costs ---
1048
+ const modelName = inputData.model;
1049
+ const usage = outputData === null || outputData === void 0 ? void 0 : outputData.usage;
1050
+ const traceManager = currentTrace.traceManager; // Get trace manager from current trace
1051
+ if (modelName && usage && traceManager &&
1052
+ (usage.prompt_tokens !== undefined || usage.input_tokens !== undefined) &&
1053
+ (usage.completion_tokens !== undefined || usage.output_tokens !== undefined)) {
1054
+ const promptTokens = (_b = (_a = usage.prompt_tokens) !== null && _a !== void 0 ? _a : usage.input_tokens) !== null && _b !== void 0 ? _b : 0;
1055
+ const completionTokens = (_d = (_c = usage.completion_tokens) !== null && _c !== void 0 ? _c : usage.output_tokens) !== null && _d !== void 0 ? _d : 0;
1056
+ try {
1057
+ const costResponse = yield traceManager.calculateTokenCosts(modelName, promptTokens, completionTokens);
1058
+ if (costResponse) {
1059
+ // Merge costs into the usage object
1060
+ outputData.usage = Object.assign(Object.assign({}, usage), { prompt_tokens_cost_usd: costResponse.prompt_tokens_cost_usd, completion_tokens_cost_usd: costResponse.completion_tokens_cost_usd, total_cost_usd: costResponse.total_cost_usd });
1061
+ logger_instance_js_1.default.info(`[wrap] Calculated cost for ${modelName}: $${costResponse.total_cost_usd.toFixed(6)}`);
1062
+ }
1063
+ else {
1064
+ logger_instance_js_1.default.warn(`[wrap] Could not fetch token costs for model ${modelName}. Costs will be missing for this span.`);
1065
+ }
1066
+ }
1067
+ catch (costError) {
1068
+ logger_instance_js_1.default.error(`[wrap] Error fetching token costs for ${modelName}:`, costError);
1069
+ }
1070
+ }
1071
+ // --- End Cost Calculation ---
1072
+ currentTrace.recordOutput(outputData); // Record output potentially enriched with costs
1119
1073
  }
1074
+ // The response is returned outside the loop, after the span context has ended
1120
1075
  return response;
1121
1076
  });
1122
1077
  // Generic patching
@@ -1130,5 +1085,4 @@ function wrap(client) {
1130
1085
  }
1131
1086
  return client;
1132
1087
  }
1133
- exports.wrap = wrap;
1134
1088
  //# sourceMappingURL=tracer.js.map