oh-my-promptfoo 1.31.2 → 1.32.1-next.188
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 +1 -1
- package/dist/{eval-progress-DLX0BKQc.js → eval-progress-Edb9hQxP.js} +39 -7
- package/dist/{eval-progress-DLX0BKQc.js.map → eval-progress-Edb9hQxP.js.map} +1 -1
- package/dist/eval-progress.js +1 -1
- package/dist/reporting.cjs +38 -6
- package/dist/reporting.cjs.map +1 -1
- package/dist/reporting.d.cts +6 -1
- package/dist/reporting.d.ts +6 -1
- package/dist/reporting.js +38 -6
- package/dist/reporting.js.map +1 -1
- package/package.json +1 -1
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-
|
|
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-Edb9hQxP.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";
|
|
@@ -7031,14 +7031,23 @@ function graderMeasurements(grade, failed) {
|
|
|
7031
7031
|
if (record(metadata.assertionSet).type === "assert-set") return collect(children);
|
|
7032
7032
|
if (component.tokensUsed !== void 0 || metadata.judgeAccounting !== void 0 || metadata.copilot !== void 0) {
|
|
7033
7033
|
const judge = metadata.judge;
|
|
7034
|
+
const tokens = record(component.tokensUsed);
|
|
7035
|
+
const cached = metadata.judgeAccounting === void 0 && metadata.cachedResponse === true;
|
|
7036
|
+
const tokenUsage = !cached && !safeMultiplier(tokens.cost) && [
|
|
7037
|
+
tokens.total,
|
|
7038
|
+
tokens.prompt,
|
|
7039
|
+
tokens.completion,
|
|
7040
|
+
tokens.cached,
|
|
7041
|
+
tokens.numRequests
|
|
7042
|
+
].every((value) => value === 0) ? void 0 : component.tokensUsed;
|
|
7034
7043
|
return [{
|
|
7035
7044
|
cost: responseCost({
|
|
7036
7045
|
metadata,
|
|
7037
|
-
cost:
|
|
7038
|
-
tokenUsage
|
|
7039
|
-
cached
|
|
7046
|
+
cost: tokens.cost,
|
|
7047
|
+
tokenUsage,
|
|
7048
|
+
cached
|
|
7040
7049
|
}, typeof judge === "string" && judge.startsWith("copilot:") ? judge.slice(8) : metadata.model),
|
|
7041
|
-
usage: usage(
|
|
7050
|
+
usage: usage(tokenUsage)
|
|
7042
7051
|
}];
|
|
7043
7052
|
}
|
|
7044
7053
|
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) ? [{
|
|
@@ -7061,6 +7070,21 @@ function graderMeasurements(grade, failed) {
|
|
|
7061
7070
|
usage: sumUsage(measurements.map((item) => item.usage))
|
|
7062
7071
|
};
|
|
7063
7072
|
}
|
|
7073
|
+
function selectNamedScores(names, rawScores, label) {
|
|
7074
|
+
if (!Array.isArray(names)) return;
|
|
7075
|
+
const scores = record(rawScores);
|
|
7076
|
+
const entries = /* @__PURE__ */ new Map();
|
|
7077
|
+
for (const name of names.slice(0, 16)) {
|
|
7078
|
+
if (typeof name !== "string" || !Object.hasOwn(scores, name)) continue;
|
|
7079
|
+
const key = label(name);
|
|
7080
|
+
const value = score(scores[name]);
|
|
7081
|
+
if (key && value !== null && !entries.has(key)) entries.set(key, value);
|
|
7082
|
+
}
|
|
7083
|
+
if (entries.size) return Array.from(entries, ([name, value]) => ({
|
|
7084
|
+
name,
|
|
7085
|
+
value
|
|
7086
|
+
}));
|
|
7087
|
+
}
|
|
7064
7088
|
/** Read only public JSON exports. No config loading, case selection or scoring occurs here. */
|
|
7065
7089
|
function summarizeEvaluation(document, exitCode, options = {}) {
|
|
7066
7090
|
const suiteNumber = options.suiteNumber ?? 1;
|
|
@@ -7110,6 +7134,7 @@ function summarizeEvaluation(document, exitCode, options = {}) {
|
|
|
7110
7134
|
const provider = record(row.provider).id;
|
|
7111
7135
|
const testLabel = label(record(test.metadata).id) ?? label(test.description);
|
|
7112
7136
|
const candidateLabel = label(record(row.provider).label);
|
|
7137
|
+
const namedScores = options.publicLabels ? selectNamedScores(record(test.metadata).reportMetrics, row.namedScores, label) : void 0;
|
|
7113
7138
|
return {
|
|
7114
7139
|
row: index + 1,
|
|
7115
7140
|
test: safeCount(row.testIdx) ? row.testIdx + 1 : index + 1,
|
|
@@ -7124,7 +7149,8 @@ function summarizeEvaluation(document, exitCode, options = {}) {
|
|
|
7124
7149
|
graderUsage: grader.usage,
|
|
7125
7150
|
candidateCost: responseCost(reply, typeof provider === "string" && provider.startsWith("copilot:") ? provider.slice(8) : void 0),
|
|
7126
7151
|
graderCost: grader.cost,
|
|
7127
|
-
assertions: assertionReports(row.gradingResult, test.assert, label)
|
|
7152
|
+
assertions: assertionReports(row.gradingResult, test.assert, label),
|
|
7153
|
+
...namedScores ? { namedScores } : {}
|
|
7128
7154
|
};
|
|
7129
7155
|
});
|
|
7130
7156
|
if (safeCount(stats.errors) && stats.errors > 0 && !counts.error) issues.push("native-errors");
|
|
@@ -7289,6 +7315,12 @@ function renderSummary(report) {
|
|
|
7289
7315
|
`| Grader | ${number(item.graderUsage.total)} | ${number(item.graderUsage.requests)} | ${money(item.graderCost)} |`,
|
|
7290
7316
|
"",
|
|
7291
7317
|
...notes ? [`${notes}.`, ""] : [],
|
|
7318
|
+
...item.namedScores?.length ? [
|
|
7319
|
+
"| Metric | Value |",
|
|
7320
|
+
"| --- | ---: |",
|
|
7321
|
+
...item.namedScores.map(({ name, value }) => `| ${escapeMarkup(name)} | ${value} |`),
|
|
7322
|
+
""
|
|
7323
|
+
] : [],
|
|
7292
7324
|
`| Check | Type | Result | Score |${thresholds ? " Threshold |" : ""}`,
|
|
7293
7325
|
`| --- | --- | --- | ---: |${thresholds ? " ---: |" : ""}`,
|
|
7294
7326
|
...item.assertions.map((check, index) => {
|
|
@@ -7324,7 +7356,7 @@ function renderConsoleSummary(report) {
|
|
|
7324
7356
|
];
|
|
7325
7357
|
for (const item of report.cases) {
|
|
7326
7358
|
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}.`] : []);
|
|
7359
|
+
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
7360
|
const names = /* @__PURE__ */ new Map();
|
|
7329
7361
|
for (const check of item.assertions) if (check.label) names.set(check.label, (names.get(check.label) ?? 0) + 1);
|
|
7330
7362
|
item.assertions.forEach((check, index) => {
|
|
@@ -7412,4 +7444,4 @@ function readProgress(input) {
|
|
|
7412
7444
|
}
|
|
7413
7445
|
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
7446
|
|
|
7415
|
-
//# sourceMappingURL=eval-progress-
|
|
7447
|
+
//# sourceMappingURL=eval-progress-Edb9hQxP.js.map
|