@valerypopoff/rivet2-evaluations 2.8.0 → 2.10.0
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/cjs/bundle.cjs
CHANGED
|
@@ -46,6 +46,7 @@ __export(src_exports, {
|
|
|
46
46
|
createEmptyEvaluationProjectData: () => createEmptyEvaluationProjectData,
|
|
47
47
|
createEmptyMetrics: () => createEmptyMetrics,
|
|
48
48
|
createEvaluationBaselineSnapshot: () => createEvaluationBaselineSnapshot,
|
|
49
|
+
createEvaluationEventCollector: () => createEvaluationEventCollector,
|
|
49
50
|
createEvaluationRunPlan: () => createEvaluationRunPlan,
|
|
50
51
|
createEvaluationRunShell: () => createEvaluationRunShell,
|
|
51
52
|
deserializeEvaluationDatasetJson: () => deserializeEvaluationDatasetJson,
|
|
@@ -3464,6 +3465,69 @@ function applyEvaluationLibraryMutation(library, mutation) {
|
|
|
3464
3465
|
migratedLegacyProjectIds: library.migratedLegacyProjectIds
|
|
3465
3466
|
});
|
|
3466
3467
|
}
|
|
3468
|
+
|
|
3469
|
+
// src/executionEventCollector.ts
|
|
3470
|
+
function createEvaluationEventCollector(attemptFormat) {
|
|
3471
|
+
const metrics = {
|
|
3472
|
+
durationMs: 0,
|
|
3473
|
+
modelCallCount: 0,
|
|
3474
|
+
toolCallCount: 0,
|
|
3475
|
+
toolFailureCount: 0
|
|
3476
|
+
};
|
|
3477
|
+
const providerAttempts = [];
|
|
3478
|
+
return {
|
|
3479
|
+
metrics,
|
|
3480
|
+
providerAttempts,
|
|
3481
|
+
llmCallFinished(event) {
|
|
3482
|
+
var _a, _b, _c, _d;
|
|
3483
|
+
metrics.modelCallCount = (metrics.modelCallCount ?? 0) + 1;
|
|
3484
|
+
metrics.inputTokens = (metrics.inputTokens ?? 0) + (((_a = event.normalizedUsage) == null ? void 0 : _a.promptTokens) ?? 0);
|
|
3485
|
+
metrics.outputTokens = (metrics.outputTokens ?? 0) + (((_b = event.normalizedUsage) == null ? void 0 : _b.completionTokens) ?? 0);
|
|
3486
|
+
metrics.cachedInputTokens = (metrics.cachedInputTokens ?? 0) + (((_c = event.normalizedUsage) == null ? void 0 : _c.cachedTokens) ?? 0);
|
|
3487
|
+
metrics.reasoningTokens = (metrics.reasoningTokens ?? 0) + (((_d = event.normalizedUsage) == null ? void 0 : _d.reasoningTokens) ?? 0);
|
|
3488
|
+
if (event.pricing.status === "known") {
|
|
3489
|
+
metrics.costUsd = (metrics.costUsd ?? 0) + (event.pricing.costUsd ?? 0);
|
|
3490
|
+
} else {
|
|
3491
|
+
metrics.hasUnknownCost = true;
|
|
3492
|
+
}
|
|
3493
|
+
providerAttempts.push({
|
|
3494
|
+
kind: "provider-call",
|
|
3495
|
+
provider: event.provider,
|
|
3496
|
+
model: event.model,
|
|
3497
|
+
customProviderApi: event.customProviderApi ?? null,
|
|
3498
|
+
outcome: event.outcome,
|
|
3499
|
+
...attemptFormat === "full" ? { finishReason: event.finishReason ?? null } : {},
|
|
3500
|
+
profileIndex: event.profileIndex ?? null,
|
|
3501
|
+
...attemptFormat === "full" ? { profileName: event.profileName ?? null } : {},
|
|
3502
|
+
attemptIndex: event.attemptIndex,
|
|
3503
|
+
roundIndex: event.roundIndex ?? null,
|
|
3504
|
+
durationMs: event.durationMs ?? null
|
|
3505
|
+
});
|
|
3506
|
+
},
|
|
3507
|
+
llmProfileAttempt(event) {
|
|
3508
|
+
providerAttempts.push({
|
|
3509
|
+
kind: "profile-decision",
|
|
3510
|
+
provider: event.provider,
|
|
3511
|
+
model: event.model,
|
|
3512
|
+
customProviderApi: event.customProviderApi ?? null,
|
|
3513
|
+
stage: event.stage,
|
|
3514
|
+
outcome: event.outcome,
|
|
3515
|
+
profileIndex: event.profileIndex ?? null,
|
|
3516
|
+
...attemptFormat === "full" ? { profileName: event.profileName ?? null } : {},
|
|
3517
|
+
attemptIndex: event.attemptIndex ?? null,
|
|
3518
|
+
roundIndex: event.roundIndex,
|
|
3519
|
+
status: event.status ?? null,
|
|
3520
|
+
healthState: event.healthState ?? null,
|
|
3521
|
+
healthDisposition: event.healthDisposition ?? null,
|
|
3522
|
+
timeoutKind: event.timeoutKind ?? null
|
|
3523
|
+
});
|
|
3524
|
+
},
|
|
3525
|
+
toolCallFinished(event) {
|
|
3526
|
+
metrics.toolCallCount = (metrics.toolCallCount ?? 0) + 1;
|
|
3527
|
+
if (event.outcome !== "success") metrics.toolFailureCount = (metrics.toolFailureCount ?? 0) + 1;
|
|
3528
|
+
}
|
|
3529
|
+
};
|
|
3530
|
+
}
|
|
3467
3531
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3468
3532
|
0 && (module.exports = {
|
|
3469
3533
|
EvaluationGraphExecutionError,
|
|
@@ -3482,6 +3546,7 @@ function applyEvaluationLibraryMutation(library, mutation) {
|
|
|
3482
3546
|
createEmptyEvaluationProjectData,
|
|
3483
3547
|
createEmptyMetrics,
|
|
3484
3548
|
createEvaluationBaselineSnapshot,
|
|
3549
|
+
createEvaluationEventCollector,
|
|
3485
3550
|
createEvaluationRunPlan,
|
|
3486
3551
|
createEvaluationRunShell,
|
|
3487
3552
|
deserializeEvaluationDatasetJson,
|