offgrid-ai 0.8.8 → 0.8.10
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/package.json +1 -1
- package/src/benchmark.mjs +8 -5
package/package.json
CHANGED
package/src/benchmark.mjs
CHANGED
|
@@ -530,7 +530,6 @@ export async function runBenchmarkInPi(profile, runDirectory, { signal } = {}) {
|
|
|
530
530
|
const usage = parsed.message.usage;
|
|
531
531
|
runResult.promptTokens += usage.input ?? 0;
|
|
532
532
|
runResult.completionTokens += usage.output ?? 0;
|
|
533
|
-
runResult.totalTokens += usage.totalTokens ?? 0;
|
|
534
533
|
runResult.cacheRead += usage.cacheRead ?? 0;
|
|
535
534
|
runResult.cacheWrite += usage.cacheWrite ?? 0;
|
|
536
535
|
endTurn(usage, timestamp);
|
|
@@ -866,20 +865,24 @@ export async function finalizeBenchmarkRun(runDirectory, runResult, speedMetrics
|
|
|
866
865
|
}
|
|
867
866
|
|
|
868
867
|
const success = existsSync(requiredPath) && (await readFile(requiredPath, "utf8")).trim().length > 0;
|
|
868
|
+
const hasTurns = runResult.agentTurns > 0;
|
|
869
|
+
const failed = runResult.error || !success || !hasTurns;
|
|
869
870
|
|
|
870
|
-
metadata.status =
|
|
871
|
+
metadata.status = failed ? "failed" : "completed";
|
|
871
872
|
metadata.updatedAt = timestamp;
|
|
872
|
-
if (
|
|
873
|
+
if (failed) {
|
|
873
874
|
metadata.failedAt = timestamp;
|
|
874
875
|
} else {
|
|
875
876
|
metadata.completedAt = timestamp;
|
|
876
877
|
}
|
|
877
878
|
|
|
879
|
+
const totalTokens = runResult.promptTokens + runResult.completionTokens;
|
|
880
|
+
|
|
878
881
|
metadata.runner.tokenMetrics = {
|
|
879
|
-
reported:
|
|
882
|
+
reported: hasTurns,
|
|
880
883
|
promptTokens: runResult.promptTokens,
|
|
881
884
|
completionTokens: runResult.completionTokens,
|
|
882
|
-
totalTokens
|
|
885
|
+
totalTokens,
|
|
883
886
|
};
|
|
884
887
|
|
|
885
888
|
metadata.runner.speedMetrics = speedMetrics;
|