oh-my-promptfoo 1.31.2 → 1.32.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/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-DLX0BKQc.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-Lb11QVab.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";
@@ -7061,6 +7061,21 @@ function graderMeasurements(grade, failed) {
7061
7061
  usage: sumUsage(measurements.map((item) => item.usage))
7062
7062
  };
7063
7063
  }
7064
+ function selectNamedScores(names, rawScores, label) {
7065
+ if (!Array.isArray(names)) return;
7066
+ const scores = record(rawScores);
7067
+ const entries = /* @__PURE__ */ new Map();
7068
+ for (const name of names.slice(0, 16)) {
7069
+ if (typeof name !== "string" || !Object.hasOwn(scores, name)) continue;
7070
+ const key = label(name);
7071
+ const value = score(scores[name]);
7072
+ if (key && value !== null && !entries.has(key)) entries.set(key, value);
7073
+ }
7074
+ if (entries.size) return Array.from(entries, ([name, value]) => ({
7075
+ name,
7076
+ value
7077
+ }));
7078
+ }
7064
7079
  /** Read only public JSON exports. No config loading, case selection or scoring occurs here. */
7065
7080
  function summarizeEvaluation(document, exitCode, options = {}) {
7066
7081
  const suiteNumber = options.suiteNumber ?? 1;
@@ -7110,6 +7125,7 @@ function summarizeEvaluation(document, exitCode, options = {}) {
7110
7125
  const provider = record(row.provider).id;
7111
7126
  const testLabel = label(record(test.metadata).id) ?? label(test.description);
7112
7127
  const candidateLabel = label(record(row.provider).label);
7128
+ const namedScores = options.publicLabels ? selectNamedScores(record(test.metadata).reportMetrics, row.namedScores, label) : void 0;
7113
7129
  return {
7114
7130
  row: index + 1,
7115
7131
  test: safeCount(row.testIdx) ? row.testIdx + 1 : index + 1,
@@ -7124,7 +7140,8 @@ function summarizeEvaluation(document, exitCode, options = {}) {
7124
7140
  graderUsage: grader.usage,
7125
7141
  candidateCost: responseCost(reply, typeof provider === "string" && provider.startsWith("copilot:") ? provider.slice(8) : void 0),
7126
7142
  graderCost: grader.cost,
7127
- assertions: assertionReports(row.gradingResult, test.assert, label)
7143
+ assertions: assertionReports(row.gradingResult, test.assert, label),
7144
+ ...namedScores ? { namedScores } : {}
7128
7145
  };
7129
7146
  });
7130
7147
  if (safeCount(stats.errors) && stats.errors > 0 && !counts.error) issues.push("native-errors");
@@ -7289,6 +7306,12 @@ function renderSummary(report) {
7289
7306
  `| Grader | ${number(item.graderUsage.total)} | ${number(item.graderUsage.requests)} | ${money(item.graderCost)} |`,
7290
7307
  "",
7291
7308
  ...notes ? [`${notes}.`, ""] : [],
7309
+ ...item.namedScores?.length ? [
7310
+ "| Metric | Value |",
7311
+ "| --- | ---: |",
7312
+ ...item.namedScores.map(({ name, value }) => `| ${escapeMarkup(name)} | ${value} |`),
7313
+ ""
7314
+ ] : [],
7292
7315
  `| Check | Type | Result | Score |${thresholds ? " Threshold |" : ""}`,
7293
7316
  `| --- | --- | --- | ---: |${thresholds ? " ---: |" : ""}`,
7294
7317
  ...item.assertions.map((check, index) => {
@@ -7324,7 +7347,7 @@ function renderConsoleSummary(report) {
7324
7347
  ];
7325
7348
  for (const item of report.cases) {
7326
7349
  const notes = measurementNotes(item);
7327
- lines.push(`Test ${item.row}${item.label ? ` · ${consoleLabel(item.label)}` : ""}${item.candidate ? ` (${consoleLabel(item.candidate)})` : ""} · ${item.status.toUpperCase()} · ${time(item.latencyMs)} · score ${score(item.score)}${item.threshold === void 0 ? "" : ` / threshold ${score(item.threshold)}`}`, ` Candidate: ${number(item.candidateUsage.total)} tokens; ${number(item.candidateUsage.requests)} requests; ${money(item.candidateCost)}. Grader: ${number(item.graderUsage.total)} tokens; ${number(item.graderUsage.requests)} requests; ${money(item.graderCost)}.`, ...notes ? [` ${notes}.`] : []);
7350
+ lines.push(`Test ${item.row}${item.label ? ` · ${consoleLabel(item.label)}` : ""}${item.candidate ? ` (${consoleLabel(item.candidate)})` : ""} · ${item.status.toUpperCase()} · ${time(item.latencyMs)} · score ${score(item.score)}${item.threshold === void 0 ? "" : ` / threshold ${score(item.threshold)}`}`, ` Candidate: ${number(item.candidateUsage.total)} tokens; ${number(item.candidateUsage.requests)} requests; ${money(item.candidateCost)}. Grader: ${number(item.graderUsage.total)} tokens; ${number(item.graderUsage.requests)} requests; ${money(item.graderCost)}.`, ...notes ? [` ${notes}.`] : [], ...(item.namedScores ?? []).map(({ name, value }) => ` ${consoleLabel(name)}: ${value}`));
7328
7351
  const names = /* @__PURE__ */ new Map();
7329
7352
  for (const check of item.assertions) if (check.label) names.set(check.label, (names.get(check.label) ?? 0) + 1);
7330
7353
  item.assertions.forEach((check, index) => {
@@ -7412,4 +7435,4 @@ function readProgress(input) {
7412
7435
  }
7413
7436
  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 };
7414
7437
 
7415
- //# sourceMappingURL=eval-progress-DLX0BKQc.js.map
7438
+ //# sourceMappingURL=eval-progress-Lb11QVab.js.map