veryfront 0.1.963 → 0.1.964
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/esm/cli/commands/eval/command-help.js +1 -1
- package/esm/cli/commands/eval/command.d.ts +3 -0
- package/esm/cli/commands/eval/command.d.ts.map +1 -1
- package/esm/cli/commands/eval/command.js +99 -0
- package/esm/deno.js +1 -1
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +1 -1
|
@@ -18,7 +18,7 @@ export const evalHelp = {
|
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
20
|
flag: "--report-dir <path>",
|
|
21
|
-
description: "Write summary.json
|
|
21
|
+
description: "Write summary.json, results.jsonl, and report.md artifacts to a directory",
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
24
|
flag: "--junit <path>",
|
|
@@ -18,6 +18,7 @@ type EvalArtifactPaths = {
|
|
|
18
18
|
directory: string;
|
|
19
19
|
summary: string;
|
|
20
20
|
results: string;
|
|
21
|
+
reportMarkdown: string;
|
|
21
22
|
};
|
|
22
23
|
type EvalModelArtifactPaths = EvalArtifactPaths & {
|
|
23
24
|
junit: string;
|
|
@@ -49,6 +50,8 @@ export declare function createResolvedEvalModelComparisonConfig(projectDir: stri
|
|
|
49
50
|
export declare function createEvalModelComparisonArtifact(reports: EvalReport[], baselineModel: string, policy?: EvalModelComparisonPolicy): EvalModelComparison;
|
|
50
51
|
export declare function createEvalModelComparisonExitCode(reports: EvalReport[]): 0 | 1;
|
|
51
52
|
export declare function createResultsJsonl(report: EvalReport): string;
|
|
53
|
+
/** Render a human-reviewable markdown report for a single eval run. */
|
|
54
|
+
export declare function createEvalMarkdownReport(report: EvalReport, baseline?: EvalReportComparison): string;
|
|
52
55
|
export declare function createJunitXml(report: EvalReport): string;
|
|
53
56
|
export declare function writeEvalArtifacts(report: EvalReport, paths: EvalArtifactPaths, baseline?: EvalReportComparison): Promise<void>;
|
|
54
57
|
export declare function createEvalExitCode(report: EvalReport, baseline?: EvalReportComparison): 0 | 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/eval/command.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAS,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,KAAK,EACV,cAAc,EAGd,mBAAmB,EAEnB,0BAA0B,EAE1B,UAAU,EACV,oBAAoB,EAEpB,YAAY,
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/eval/command.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAS,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,KAAK,EACV,cAAc,EAGd,mBAAmB,EAEnB,0BAA0B,EAE1B,UAAU,EACV,oBAAoB,EAEpB,YAAY,EAEb,MAAM,4BAA4B,CAAC;AAmBpC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,WAAW,WAAY,SAAQ,QAAQ;CAAG;AAEhD,KAAK,cAAc,GAAG;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC;CAC3C,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CA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G,SAAS,sEAMjD;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,aAAa,MA2CrD;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,aAAa,GAAG,YAAY,EAAE,CAY1E;AA+FD,KAAK,yBAAyB,GAAG;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,KAAK,iCAAiC,GAAG;IACvC,MAAM,EAAE,yBAAyB,CAAC;IAClC,MAAM,EAAE,yBAAyB,CAAC;CACnC,CAAC;AAkLF,wBAAsB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA8IrE"}
|
|
@@ -44,6 +44,7 @@ export function createEvalArtifactPaths(reportDir) {
|
|
|
44
44
|
directory: reportDir,
|
|
45
45
|
summary: join(reportDir, "summary.json"),
|
|
46
46
|
results: join(reportDir, "results.jsonl"),
|
|
47
|
+
reportMarkdown: join(reportDir, "report.md"),
|
|
47
48
|
};
|
|
48
49
|
}
|
|
49
50
|
function sanitizeModelIdForPath(model) {
|
|
@@ -55,6 +56,7 @@ export function createEvalModelArtifactPaths(reportDir, model) {
|
|
|
55
56
|
directory,
|
|
56
57
|
summary: join(directory, "summary.json"),
|
|
57
58
|
results: join(directory, "results.jsonl"),
|
|
59
|
+
reportMarkdown: join(directory, "report.md"),
|
|
58
60
|
junit: join(directory, "junit.xml"),
|
|
59
61
|
};
|
|
60
62
|
}
|
|
@@ -284,6 +286,101 @@ export function createResultsJsonl(report) {
|
|
|
284
286
|
return "";
|
|
285
287
|
return `${report.records.map((record) => JSON.stringify(record)).join("\n")}\n`;
|
|
286
288
|
}
|
|
289
|
+
function markdownCell(value) {
|
|
290
|
+
return value.replaceAll("|", "\\|").replaceAll("\n", " ");
|
|
291
|
+
}
|
|
292
|
+
function numberCell(value) {
|
|
293
|
+
return value === undefined ? "-" : String(Math.round(value));
|
|
294
|
+
}
|
|
295
|
+
function decimalCell(value) {
|
|
296
|
+
if (value === undefined)
|
|
297
|
+
return "-";
|
|
298
|
+
if (Number.isInteger(value))
|
|
299
|
+
return String(value);
|
|
300
|
+
return value.toFixed(4).replace(/0+$/, "").replace(/\.$/, "");
|
|
301
|
+
}
|
|
302
|
+
function percentCell(value) {
|
|
303
|
+
return `${Math.round(value * 100)}%`;
|
|
304
|
+
}
|
|
305
|
+
function durationCell(valueMs) {
|
|
306
|
+
return valueMs === undefined ? "-" : `${(valueMs / 1000).toFixed(3)}s`;
|
|
307
|
+
}
|
|
308
|
+
function usdCell(value) {
|
|
309
|
+
if (value === undefined)
|
|
310
|
+
return "-";
|
|
311
|
+
const absolute = Math.abs(value);
|
|
312
|
+
if (absolute >= 0.01)
|
|
313
|
+
return `$${value.toFixed(2)}`;
|
|
314
|
+
return `$${value.toFixed(6).replace(/0+$/, "").replace(/\.$/, "")}`;
|
|
315
|
+
}
|
|
316
|
+
function examplePassed(record) {
|
|
317
|
+
return [...(record.metrics ?? []), ...(record.checks ?? [])].every((result) => result.skipped || result.pass !== false);
|
|
318
|
+
}
|
|
319
|
+
function usageRows(usage) {
|
|
320
|
+
if (!usage)
|
|
321
|
+
return [];
|
|
322
|
+
const rows = [
|
|
323
|
+
["Input tokens", numberCell(usage.inputTokens)],
|
|
324
|
+
["Output tokens", numberCell(usage.outputTokens)],
|
|
325
|
+
["Total tokens", numberCell(usage.totalTokens)],
|
|
326
|
+
["Billable input tokens", numberCell(usage.billableInputTokens)],
|
|
327
|
+
["Billable output tokens", numberCell(usage.billableOutputTokens)],
|
|
328
|
+
["Provider cost USD", usdCell(usage.providerCostUsd ?? usage.costUsd)],
|
|
329
|
+
["Veryfront charge USD", usdCell(usage.veryfrontChargeUsd)],
|
|
330
|
+
["Veryfront billed USD", usdCell(usage.veryfrontBilledUsd)],
|
|
331
|
+
["Cost credits", decimalCell(usage.costCredits)],
|
|
332
|
+
["Cost source", usage.costSource ?? "-"],
|
|
333
|
+
["Usage capture status", usage.usageCaptureStatus ?? "-"],
|
|
334
|
+
];
|
|
335
|
+
return rows.filter(([, value]) => value !== "-");
|
|
336
|
+
}
|
|
337
|
+
/** Render a human-reviewable markdown report for a single eval run. */
|
|
338
|
+
export function createEvalMarkdownReport(report, baseline) {
|
|
339
|
+
const lines = [
|
|
340
|
+
`# Eval report: ${markdownCell(report.definitionId)}`,
|
|
341
|
+
"",
|
|
342
|
+
`Run: \`${markdownCell(report.runId)}\``,
|
|
343
|
+
`Target: \`${markdownCell(report.target)}\``,
|
|
344
|
+
...(report.metadata?.model ? [`Model: \`${markdownCell(report.metadata.model)}\``] : []),
|
|
345
|
+
`Result: \`${report.summary.passed}/${report.summary.records} passed (${percentCell(report.summary.passRate)})\``,
|
|
346
|
+
"",
|
|
347
|
+
"## Metrics",
|
|
348
|
+
"",
|
|
349
|
+
"| Metric | Severity | Passed | Failed | Pass rate |",
|
|
350
|
+
"| --- | --- | ---: | ---: | ---: |",
|
|
351
|
+
];
|
|
352
|
+
for (const metric of report.summary.metrics) {
|
|
353
|
+
lines.push(`| \`${markdownCell(metric.name)}\` | ${metric.severity} | ${metric.passed} | ${metric.failed} | ${percentCell(metric.passRate)} |`);
|
|
354
|
+
}
|
|
355
|
+
const rows = usageRows(report.summary.usage);
|
|
356
|
+
if (rows.length > 0) {
|
|
357
|
+
lines.push("", "## Usage", "", "| Usage | Value |", "| --- | ---: |");
|
|
358
|
+
for (const [label, value] of rows) {
|
|
359
|
+
lines.push(`| ${label} | ${value.startsWith("$") ? `\`${value}\`` : value} |`);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
lines.push("", "## Examples", "", "| Example | Result | Duration | Tokens | Billed USD | Credits |", "| --- | ---: | ---: | ---: | ---: | ---: |");
|
|
363
|
+
for (const record of report.records) {
|
|
364
|
+
lines.push(`| \`${markdownCell(record.id)}\` | ${examplePassed(record) ? "PASS" : "FAIL"} | ${durationCell(record.durationMs)} | ${numberCell(record.usage.totalTokens)} | ${record.usage.veryfrontBilledUsd === undefined
|
|
365
|
+
? "-"
|
|
366
|
+
: `\`${usdCell(record.usage.veryfrontBilledUsd)}\``} | ${decimalCell(record.usage.costCredits)} |`);
|
|
367
|
+
}
|
|
368
|
+
if (baseline) {
|
|
369
|
+
const direction = baseline.passRateDelta >= 0 ? "+" : "";
|
|
370
|
+
lines.push("", "## Baseline", "", `Status: \`${baseline.regressed ? "regressed" : "ok"}\``, `Pass rate delta: \`${direction}${Math.round(baseline.passRateDelta * 100)} pp\``);
|
|
371
|
+
if (baseline.newFailedExamples.length > 0) {
|
|
372
|
+
lines.push(`New failed examples: ${baseline.newFailedExamples.map(markdownCell).join(", ")}`);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
if (report.exports?.length) {
|
|
376
|
+
lines.push("", "## Exports", "");
|
|
377
|
+
for (const result of report.exports) {
|
|
378
|
+
lines.push(`- \`${markdownCell(result.exporterId)}\`: ${result.ok ? "ok" : `failed, ${markdownCell(result.error)}`}`);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
lines.push("");
|
|
382
|
+
return lines.join("\n");
|
|
383
|
+
}
|
|
287
384
|
export function createJunitXml(report) {
|
|
288
385
|
const skipped = report.records.reduce((count, record) => count + skippedResults(record).length, 0);
|
|
289
386
|
const lines = [
|
|
@@ -320,6 +417,7 @@ export async function writeEvalArtifacts(report, paths, baseline) {
|
|
|
320
417
|
await dntShim.Deno.mkdir(paths.directory, { recursive: true });
|
|
321
418
|
await dntShim.Deno.writeTextFile(paths.summary, JSON.stringify(createSummaryArtifact(report, baseline), null, 2));
|
|
322
419
|
await dntShim.Deno.writeTextFile(paths.results, createResultsJsonl(report));
|
|
420
|
+
await dntShim.Deno.writeTextFile(paths.reportMarkdown, createEvalMarkdownReport(report, baseline));
|
|
323
421
|
}
|
|
324
422
|
async function readEvalReport(path) {
|
|
325
423
|
return JSON.parse(await dntShim.Deno.readTextFile(path));
|
|
@@ -731,6 +829,7 @@ export async function evalCommand(options) {
|
|
|
731
829
|
else {
|
|
732
830
|
printReport(report, baseline);
|
|
733
831
|
cliLogger.info(`Report directory: ${artifactPaths.directory}`);
|
|
832
|
+
cliLogger.info(`Report markdown: ${artifactPaths.reportMarkdown}`);
|
|
734
833
|
if (options.report)
|
|
735
834
|
cliLogger.info(`Report: ${options.report}`);
|
|
736
835
|
if (options.junit)
|
package/esm/deno.js
CHANGED