oh-my-promptfoo 1.34.0 → 1.34.1

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/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {createRequire as __allagentsCreateRequire} from "node:module";const require=__allagentsCreateRequire(import.meta.url);
3
3
  import { t as canonicalJson } from "./config-dkfko4h5.js";
4
4
  import { n as helperInvoke, t as helperAvailable } from "./helper-CQLUwsX4.js";
5
- import { a as renderConsoleSummary, c as summarizeEvaluation, i as readWorkspaceTiming, l as addSourceLinks, o as renderProgress, r as readProgress, s as renderSummary } from "./eval-progress-HN89k-pW.js";
5
+ import { a as renderConsoleSummary, c as summarizeEvaluation, i as readWorkspaceTiming, l as addSourceLinks, o as renderProgress, r as readProgress, s as renderSummary } from "./eval-progress-DGkxMAa_.js";
6
6
  import { n as secrets } from "./redaction-Be3UM1sZ.js";
7
7
  import { createRequire } from "node:module";
8
8
  import { constants, createWriteStream, realpathSync } from "node:fs";
@@ -7035,6 +7035,17 @@ function assertionStatus(component) {
7035
7035
  if (typeof component.pass !== "boolean") return "unknown";
7036
7036
  return component.pass ? "pass" : "fail";
7037
7037
  }
7038
+ const zeroGraderUsage = {
7039
+ total: 0,
7040
+ prompt: 0,
7041
+ completion: 0,
7042
+ cached: 0,
7043
+ requests: 0,
7044
+ promptCache: {
7045
+ read: 0,
7046
+ write: 0
7047
+ }
7048
+ };
7038
7049
  function graderMeasurements(grade, failed) {
7039
7050
  const value = record(grade);
7040
7051
  if (failed) {
@@ -7059,6 +7070,15 @@ function graderMeasurements(grade, failed) {
7059
7070
  tokens.cached,
7060
7071
  tokens.numRequests
7061
7072
  ].every((value) => value === 0) ? void 0 : component.tokensUsed;
7073
+ const promptCache = readPromptCache(metadata);
7074
+ const explicitZeroUsage = metadata.cachedResponse !== true && tokens.total === 0 && tokens.numRequests === 0 && tokens.cost === 0 && [
7075
+ tokens.prompt,
7076
+ tokens.completion,
7077
+ tokens.cached,
7078
+ record(tokens.completionDetails).cacheCreationInputTokens,
7079
+ promptCache?.read,
7080
+ promptCache?.write
7081
+ ].every((value) => value === void 0 || value === 0);
7062
7082
  return [{
7063
7083
  cost: responseCost({
7064
7084
  metadata,
@@ -7066,27 +7086,15 @@ function graderMeasurements(grade, failed) {
7066
7086
  tokenUsage,
7067
7087
  cached
7068
7088
  }, typeof judge === "string" && judge.startsWith("copilot:") ? judge.slice(8) : metadata.model),
7069
- usage: {
7089
+ usage: explicitZeroUsage ? zeroGraderUsage : {
7070
7090
  ...usage(tokenUsage),
7071
- promptCache: readPromptCache(metadata)
7091
+ promptCache
7072
7092
  }
7073
7093
  }];
7074
7094
  }
7075
7095
  return !children.length && /^(?:not-)?(?:skill-used|equals|contains|icontains|contains-any|contains-all|icontains-any|icontains-all|regex|starts-with|is-json|contains-json|is-valid-json-schema|is-xml|contains-xml|is-sql|contains-sql|is-html|is-valid-function-call|is-valid-openai-function-call|is-valid-openai-tools-call|is-valid-json|javascript-boolean|latency|cost|perplexity|perplexity-score)$/.test(record(component.assertion).type) ? [{
7076
7096
  cost: responseCost({ cost: 0 }, void 0),
7077
- usage: {
7078
- ...usage({
7079
- total: 0,
7080
- prompt: 0,
7081
- completion: 0,
7082
- cached: 0,
7083
- numRequests: 0
7084
- }),
7085
- promptCache: {
7086
- read: 0,
7087
- write: 0
7088
- }
7089
- }
7097
+ usage: zeroGraderUsage
7090
7098
  }] : [{
7091
7099
  cost: unknownCost("not-reported"),
7092
7100
  usage: usage(void 0)
@@ -7484,4 +7492,4 @@ function readProgress(input) {
7484
7492
  }
7485
7493
  export { renderConsoleSummary as a, summarizeEvaluation as c, readWorkspaceTiming as i, addSourceLinks as l, beforeAll as n, renderProgress as o, readProgress as r, renderSummary as s, afterEach as t };
7486
7494
 
7487
- //# sourceMappingURL=eval-progress-HN89k-pW.js.map
7495
+ //# sourceMappingURL=eval-progress-DGkxMAa_.js.map