@cogitator-ai/evals 0.8.0 → 0.10.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/README.md +255 -54
- package/dist/assertions/error-rate.d.ts +8 -0
- package/dist/assertions/error-rate.d.ts.map +1 -0
- package/dist/assertions/error-rate.js +27 -0
- package/dist/assertions/error-rate.js.map +1 -0
- package/dist/assertions/index.d.ts +3 -0
- package/dist/assertions/index.d.ts.map +1 -1
- package/dist/assertions/index.js +1 -0
- package/dist/assertions/index.js.map +1 -1
- package/dist/assertions/regression.d.ts.map +1 -1
- package/dist/assertions/regression.js +3 -1
- package/dist/assertions/regression.js.map +1 -1
- package/dist/assertions/threshold.d.ts.map +1 -1
- package/dist/assertions/threshold.js +4 -1
- package/dist/assertions/threshold.js.map +1 -1
- package/dist/datasets/csv-loader.d.ts +5 -0
- package/dist/datasets/csv-loader.d.ts.map +1 -1
- package/dist/datasets/csv-loader.js +89 -7
- package/dist/datasets/csv-loader.js.map +1 -1
- package/dist/datasets/dataset.d.ts +11 -2
- package/dist/datasets/dataset.d.ts.map +1 -1
- package/dist/datasets/dataset.js +42 -13
- package/dist/datasets/dataset.js.map +1 -1
- package/dist/datasets/issues.d.ts +4 -0
- package/dist/datasets/issues.d.ts.map +1 -0
- package/dist/datasets/issues.js +7 -0
- package/dist/datasets/issues.js.map +1 -0
- package/dist/datasets/jsonl-loader.d.ts.map +1 -1
- package/dist/datasets/jsonl-loader.js +6 -1
- package/dist/datasets/jsonl-loader.js.map +1 -1
- package/dist/eval-builder.d.ts +3 -0
- package/dist/eval-builder.d.ts.map +1 -1
- package/dist/eval-builder.js +7 -0
- package/dist/eval-builder.js.map +1 -1
- package/dist/eval-comparison.d.ts +7 -0
- package/dist/eval-comparison.d.ts.map +1 -1
- package/dist/eval-comparison.js +42 -12
- package/dist/eval-comparison.js.map +1 -1
- package/dist/eval-suite.d.ts +55 -8
- package/dist/eval-suite.d.ts.map +1 -1
- package/dist/eval-suite.js +254 -53
- package/dist/eval-suite.js.map +1 -1
- package/dist/index.d.ts +14 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/matchers.d.ts +68 -0
- package/dist/matchers.d.ts.map +1 -0
- package/dist/matchers.js +112 -0
- package/dist/matchers.js.map +1 -0
- package/dist/metrics/custom.d.ts +19 -7
- package/dist/metrics/custom.d.ts.map +1 -1
- package/dist/metrics/custom.js +5 -0
- package/dist/metrics/custom.js.map +1 -1
- package/dist/metrics/index.d.ts +8 -4
- package/dist/metrics/index.d.ts.map +1 -1
- package/dist/metrics/index.js +4 -2
- package/dist/metrics/index.js.map +1 -1
- package/dist/metrics/llm-judge.d.ts +20 -1
- package/dist/metrics/llm-judge.d.ts.map +1 -1
- package/dist/metrics/llm-judge.js +162 -20
- package/dist/metrics/llm-judge.js.map +1 -1
- package/dist/metrics/matching.d.ts +28 -0
- package/dist/metrics/matching.d.ts.map +1 -0
- package/dist/metrics/matching.js +124 -0
- package/dist/metrics/matching.js.map +1 -0
- package/dist/metrics/retrieval.d.ts +21 -0
- package/dist/metrics/retrieval.d.ts.map +1 -0
- package/dist/metrics/retrieval.js +108 -0
- package/dist/metrics/retrieval.js.map +1 -0
- package/dist/metrics/statistical.d.ts +28 -0
- package/dist/metrics/statistical.d.ts.map +1 -1
- package/dist/metrics/statistical.js +61 -0
- package/dist/metrics/statistical.js.map +1 -1
- package/dist/metrics/tool-calls.d.ts +43 -0
- package/dist/metrics/tool-calls.d.ts.map +1 -0
- package/dist/metrics/tool-calls.js +106 -0
- package/dist/metrics/tool-calls.js.map +1 -0
- package/dist/metrics/types.d.ts +53 -5
- package/dist/metrics/types.d.ts.map +1 -1
- package/dist/metrics/types.js.map +1 -1
- package/dist/reporters/ci.d.ts +4 -0
- package/dist/reporters/ci.d.ts.map +1 -1
- package/dist/reporters/ci.js +5 -1
- package/dist/reporters/ci.js.map +1 -1
- package/dist/reporters/console.d.ts.map +1 -1
- package/dist/reporters/console.js +11 -4
- package/dist/reporters/console.js.map +1 -1
- package/dist/reporters/csv.d.ts.map +1 -1
- package/dist/reporters/csv.js +5 -2
- package/dist/reporters/csv.js.map +1 -1
- package/dist/reporters/format.d.ts +19 -0
- package/dist/reporters/format.d.ts.map +1 -0
- package/dist/reporters/format.js +31 -0
- package/dist/reporters/format.js.map +1 -0
- package/dist/reporters/github.d.ts +11 -0
- package/dist/reporters/github.d.ts.map +1 -0
- package/dist/reporters/github.js +95 -0
- package/dist/reporters/github.js.map +1 -0
- package/dist/reporters/index.d.ts +44 -20
- package/dist/reporters/index.d.ts.map +1 -1
- package/dist/reporters/index.js +14 -3
- package/dist/reporters/index.js.map +1 -1
- package/dist/reporters/junit.d.ts +8 -0
- package/dist/reporters/junit.d.ts.map +1 -0
- package/dist/reporters/junit.js +107 -0
- package/dist/reporters/junit.js.map +1 -0
- package/dist/schema.d.ts +25 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +29 -0
- package/dist/schema.js.map +1 -1
- package/dist/vitest.d.ts +35 -0
- package/dist/vitest.d.ts.map +1 -0
- package/dist/vitest.js +85 -0
- package/dist/vitest.js.map +1 -0
- package/package.json +17 -3
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { appendFileSync } from 'node:fs';
|
|
2
|
+
import { caseFlags, caseLabel, trialsPerCase } from './format.js';
|
|
3
|
+
/** Escapes the message of a workflow command */
|
|
4
|
+
function escapeData(value) {
|
|
5
|
+
return value.replace(/%/g, '%25').replace(/\r/g, '%0D').replace(/\n/g, '%0A');
|
|
6
|
+
}
|
|
7
|
+
/** Escapes a workflow command property, where `:` and `,` are separators */
|
|
8
|
+
function escapeProperty(value) {
|
|
9
|
+
return escapeData(value).replace(/:/g, '%3A').replace(/,/g, '%2C');
|
|
10
|
+
}
|
|
11
|
+
function command(kind, title, message) {
|
|
12
|
+
return `::${kind} title=${escapeProperty(title)}::${escapeData(message)}`;
|
|
13
|
+
}
|
|
14
|
+
/** The workflow commands that annotate the run: failures as errors, metric errors as warnings */
|
|
15
|
+
export function githubAnnotations(result) {
|
|
16
|
+
const lines = [];
|
|
17
|
+
result.results.forEach((r, i) => {
|
|
18
|
+
const label = caseLabel(i, r.case.input);
|
|
19
|
+
if (r.error !== undefined) {
|
|
20
|
+
lines.push(command('error', `Eval case ${label}`, r.error));
|
|
21
|
+
}
|
|
22
|
+
for (const score of r.scores) {
|
|
23
|
+
if (score.error !== undefined) {
|
|
24
|
+
lines.push(command('warning', `Eval metric ${score.name} on case ${label}`, score.error));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
for (const a of result.assertions) {
|
|
29
|
+
if (!a.passed)
|
|
30
|
+
lines.push(command('error', `Eval assertion ${a.name}`, a.message));
|
|
31
|
+
}
|
|
32
|
+
return lines;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A table cell of the step summary: any line break (a lone `\r` too) becomes `<br>` so the row
|
|
36
|
+
* holds, and `<` and `&` are escaped so no tag or comment in an answer hides the rest
|
|
37
|
+
*/
|
|
38
|
+
function cell(value) {
|
|
39
|
+
return value
|
|
40
|
+
.replace(/&/g, '&')
|
|
41
|
+
.replace(/</g, '<')
|
|
42
|
+
.replace(/\\/g, '\\\\')
|
|
43
|
+
.replace(/\|/g, '\\|')
|
|
44
|
+
.replace(/\r\n|\r|\n/g, '<br>');
|
|
45
|
+
}
|
|
46
|
+
function num(n) {
|
|
47
|
+
return Number.isInteger(n) ? String(n) : n.toFixed(4);
|
|
48
|
+
}
|
|
49
|
+
/** The Markdown summary of the run for `$GITHUB_STEP_SUMMARY` */
|
|
50
|
+
export function githubSummary(result) {
|
|
51
|
+
const { stats } = result;
|
|
52
|
+
const passed = result.assertions.filter((a) => a.passed).length;
|
|
53
|
+
const failed = result.assertions.length - passed;
|
|
54
|
+
const flagged = result.results.filter((r) => caseFlags(r).length > 0).length;
|
|
55
|
+
const trials = trialsPerCase(result);
|
|
56
|
+
const totals = [
|
|
57
|
+
`**${stats.total}** cases${trials > 1 ? ` x **${trials}** trials` : ''}`,
|
|
58
|
+
`**${stats.errors ?? 0}** errored`,
|
|
59
|
+
...(stats.metricErrors ? [`**${stats.metricErrors}** metric errors`] : []),
|
|
60
|
+
...(flagged > 0 ? [`**${flagged}** truncated, paused or at the iteration limit`] : []),
|
|
61
|
+
`${stats.duration} ms`,
|
|
62
|
+
`${num(stats.cost)} USD`,
|
|
63
|
+
`assertions: **${passed}** passed, **${failed}** failed`,
|
|
64
|
+
];
|
|
65
|
+
const lines = ['## Eval results', '', totals.join(' | '), ''];
|
|
66
|
+
const metrics = Object.values(result.aggregated);
|
|
67
|
+
if (metrics.length > 0) {
|
|
68
|
+
lines.push('### Metrics', '', '| Metric | Mean | P50 | P95 | Cases |', '| --- | ---: | ---: | ---: | ---: |');
|
|
69
|
+
for (const m of metrics) {
|
|
70
|
+
const count = m.count === undefined ? '-' : String(m.count);
|
|
71
|
+
lines.push(`| ${cell(m.name)} | ${num(m.mean)} | ${num(m.p50)} | ${num(m.p95)} | ${count} |`);
|
|
72
|
+
}
|
|
73
|
+
lines.push('');
|
|
74
|
+
}
|
|
75
|
+
if (result.assertions.length > 0) {
|
|
76
|
+
lines.push('### Assertions', '', '| Result | Assertion | Details |', '| --- | --- | --- |');
|
|
77
|
+
for (const a of result.assertions) {
|
|
78
|
+
lines.push(`| ${a.passed ? 'pass' : '**fail**'} | ${cell(a.name)} | ${cell(a.message)} |`);
|
|
79
|
+
}
|
|
80
|
+
lines.push('');
|
|
81
|
+
}
|
|
82
|
+
return lines.join('\n') + '\n';
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Prints GitHub Actions annotations to stdout, and appends a Markdown summary to the file in
|
|
86
|
+
* `GITHUB_STEP_SUMMARY` when the variable is set
|
|
87
|
+
*/
|
|
88
|
+
export function githubReport(result) {
|
|
89
|
+
for (const line of githubAnnotations(result))
|
|
90
|
+
console.log(line);
|
|
91
|
+
const summaryPath = process.env.GITHUB_STEP_SUMMARY;
|
|
92
|
+
if (summaryPath)
|
|
93
|
+
appendFileSync(summaryPath, githubSummary(result), 'utf-8');
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=github.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github.js","sourceRoot":"","sources":["../../src/reporters/github.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE/D,gDAAgD;AAChD,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAChF,CAAC;AAED,4EAA4E;AAC5E,SAAS,cAAc,CAAC,KAAa;IACnC,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACrE,CAAC;AAED,SAAS,OAAO,CAAC,IAAyB,EAAE,KAAa,EAAE,OAAe;IACxE,OAAO,KAAK,IAAI,UAAU,cAAc,CAAC,KAAK,CAAC,KAAK,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;AAC5E,CAAC;AAED,iGAAiG;AACjG,MAAM,UAAU,iBAAiB,CAAC,MAAuB;IACvD,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QAC9B,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzC,IAAI,CAAC,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAC1B,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AAU,YAAY,CAAC,MAAuB;IAClD,KAAK,MAAM,IAAI,IAAI,iBAAiB,CAAC,MAAM,CAAC;QAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAEhE,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;IACpD,IAAI,WAAW;QAAE,cAAc,CAAC,WAAW,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;AAC/E,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { EvalStats } from '../assertions/index.js';
|
|
2
|
+
import type { EvalToolCall, EvalToolResult, EvalTurnResult, Passage } from '../metrics/types.js';
|
|
2
3
|
export interface AggregatedMetric {
|
|
3
4
|
name: string;
|
|
4
5
|
mean: number;
|
|
@@ -9,6 +10,8 @@ export interface AggregatedMetric {
|
|
|
9
10
|
p50: number;
|
|
10
11
|
p95: number;
|
|
11
12
|
p99: number;
|
|
13
|
+
/** Cases the metric was scored on: errored cases are not scored */
|
|
14
|
+
count?: number;
|
|
12
15
|
/** Extra figures a statistical metric reports, such as the total cost */
|
|
13
16
|
metadata?: Record<string, unknown>;
|
|
14
17
|
}
|
|
@@ -19,44 +22,65 @@ export interface AssertionResult {
|
|
|
19
22
|
actual?: number;
|
|
20
23
|
expected?: number;
|
|
21
24
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
/** A case result as the reporters get it */
|
|
26
|
+
export interface ReportedCase {
|
|
27
|
+
case: {
|
|
28
|
+
input: string;
|
|
29
|
+
expected?: string;
|
|
30
|
+
};
|
|
31
|
+
output: string;
|
|
32
|
+
duration: number;
|
|
33
|
+
/** Why the case has no output: every attempt failed or timed out */
|
|
34
|
+
error?: string;
|
|
35
|
+
/** The agent's answer stopped at its output token limit */
|
|
36
|
+
truncated?: boolean;
|
|
37
|
+
/** Tool calls used up the agent's `maxIterations` before it answered */
|
|
38
|
+
iterationLimitReached?: boolean;
|
|
39
|
+
/** The run paused for tool approvals, so `output` holds no answer */
|
|
40
|
+
paused?: boolean;
|
|
41
|
+
/** The tool calls of the run, over every turn */
|
|
42
|
+
toolCalls?: readonly EvalToolCall[];
|
|
43
|
+
/** What the tool calls returned, over every turn */
|
|
44
|
+
toolResults?: readonly EvalToolResult[];
|
|
45
|
+
/** The passages the run retrieved */
|
|
46
|
+
retrieved?: readonly Passage[];
|
|
47
|
+
/** Each turn of a multi-turn case */
|
|
48
|
+
turns?: readonly EvalTurnResult[];
|
|
49
|
+
scores: Array<{
|
|
50
|
+
name: string;
|
|
51
|
+
score: number;
|
|
52
|
+
details?: string;
|
|
31
53
|
error?: string;
|
|
32
|
-
scores: Array<{
|
|
33
|
-
name: string;
|
|
34
|
-
score: number;
|
|
35
|
-
details?: string;
|
|
36
|
-
error?: string;
|
|
37
|
-
}>;
|
|
38
54
|
}>;
|
|
55
|
+
/** Every run of the case when the suite ran several trials, the first being the case itself */
|
|
56
|
+
trials?: readonly ReportedCase[];
|
|
57
|
+
}
|
|
58
|
+
export interface EvalSuiteResult {
|
|
59
|
+
results: ReportedCase[];
|
|
39
60
|
aggregated: Record<string, AggregatedMetric>;
|
|
40
61
|
assertions: AssertionResult[];
|
|
41
62
|
stats: EvalStats;
|
|
42
63
|
}
|
|
43
|
-
export type ReporterType = 'console' | 'json' | 'csv' | 'ci';
|
|
64
|
+
export type ReporterType = 'console' | 'json' | 'csv' | 'ci' | 'junit' | 'github';
|
|
44
65
|
export type ReporterOptions = {
|
|
45
66
|
/**
|
|
46
67
|
* Base path of file reports. Each file reporter writes it with its own
|
|
47
|
-
* extension, so `./reports/eval` gives `eval.json` and `eval.
|
|
68
|
+
* extension, so `./reports/eval` gives `eval.json`, `eval.csv` and `eval.xml`.
|
|
48
69
|
*/
|
|
49
70
|
path?: string;
|
|
50
71
|
};
|
|
51
72
|
/** The file a reporter writes: the base path with the reporter's extension. */
|
|
52
|
-
export declare function reportPath(base: string | undefined, extension: 'json' | 'csv'): string;
|
|
73
|
+
export declare function reportPath(base: string | undefined, extension: 'json' | 'csv' | 'xml'): string;
|
|
53
74
|
/**
|
|
54
|
-
* Runs the reporters in the order given, except `ci`, which runs last
|
|
55
|
-
*
|
|
75
|
+
* Runs the reporters in the order given, except `ci`, which runs last so its verdict is the
|
|
76
|
+
* final line of the output. `ci` sets `process.exitCode` to 1 when an assertion failed instead
|
|
77
|
+
* of ending the process, so output still flushes and later hooks still run.
|
|
56
78
|
*/
|
|
57
79
|
export declare function report(result: EvalSuiteResult, type: ReporterType | ReporterType[], options?: ReporterOptions): void;
|
|
58
80
|
export { consoleReport } from './console.js';
|
|
59
81
|
export { jsonReport } from './json.js';
|
|
60
82
|
export { csvReport } from './csv.js';
|
|
61
83
|
export { ciReport } from './ci.js';
|
|
84
|
+
export { junitReport } from './junit.js';
|
|
85
|
+
export { githubReport } from './github.js';
|
|
62
86
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/reporters/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/reporters/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE9F,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC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AE,SAAS,YAAY,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC7C,UAAU,EAAE,eAAe,EAAE,CAAC;IAC9B,KAAK,EAAE,SAAS,CAAC;CAClB;AAED,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,OAAO,GAAG,QAAQ,CAAC;AAClF,MAAM,MAAM,eAAe,GAAG;IAC5B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAIF,+EAA+E;AAC/E,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,CAG9F;AAOD;;;;GAIG;AACH,wBAAgB,MAAM,CACpB,MAAM,EAAE,eAAe,EACvB,IAAI,EAAE,YAAY,GAAG,YAAY,EAAE,EACnC,OAAO,CAAC,EAAE,eAAe,GACxB,IAAI,CA0BN;AAED,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/reporters/index.js
CHANGED
|
@@ -4,10 +4,12 @@ import { consoleReport } from './console.js';
|
|
|
4
4
|
import { jsonReport } from './json.js';
|
|
5
5
|
import { csvReport } from './csv.js';
|
|
6
6
|
import { ciReport } from './ci.js';
|
|
7
|
+
import { junitReport } from './junit.js';
|
|
8
|
+
import { githubReport } from './github.js';
|
|
7
9
|
const DEFAULT_BASE = 'eval-report';
|
|
8
10
|
/** The file a reporter writes: the base path with the reporter's extension. */
|
|
9
11
|
export function reportPath(base, extension) {
|
|
10
|
-
const stem = (base ?? DEFAULT_BASE).replace(/\.(json|csv)$/i, '');
|
|
12
|
+
const stem = (base ?? DEFAULT_BASE).replace(/\.(json|csv|xml)$/i, '');
|
|
11
13
|
return `${stem}.${extension}`;
|
|
12
14
|
}
|
|
13
15
|
function prepare(path) {
|
|
@@ -15,8 +17,9 @@ function prepare(path) {
|
|
|
15
17
|
return path;
|
|
16
18
|
}
|
|
17
19
|
/**
|
|
18
|
-
* Runs the reporters in the order given, except `ci`, which runs last
|
|
19
|
-
*
|
|
20
|
+
* Runs the reporters in the order given, except `ci`, which runs last so its verdict is the
|
|
21
|
+
* final line of the output. `ci` sets `process.exitCode` to 1 when an assertion failed instead
|
|
22
|
+
* of ending the process, so output still flushes and later hooks still run.
|
|
20
23
|
*/
|
|
21
24
|
export function report(result, type, options) {
|
|
22
25
|
const types = Array.isArray(type) ? type : [type];
|
|
@@ -32,6 +35,12 @@ export function report(result, type, options) {
|
|
|
32
35
|
case 'csv':
|
|
33
36
|
csvReport(result, { path: prepare(reportPath(options?.path, 'csv')) });
|
|
34
37
|
break;
|
|
38
|
+
case 'junit':
|
|
39
|
+
junitReport(result, { path: prepare(reportPath(options?.path, 'xml')) });
|
|
40
|
+
break;
|
|
41
|
+
case 'github':
|
|
42
|
+
githubReport(result);
|
|
43
|
+
break;
|
|
35
44
|
case 'ci':
|
|
36
45
|
ciReport(result);
|
|
37
46
|
break;
|
|
@@ -42,4 +51,6 @@ export { consoleReport } from './console.js';
|
|
|
42
51
|
export { jsonReport } from './json.js';
|
|
43
52
|
export { csvReport } from './csv.js';
|
|
44
53
|
export { ciReport } from './ci.js';
|
|
54
|
+
export { junitReport } from './junit.js';
|
|
55
|
+
export { githubReport } from './github.js';
|
|
45
56
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/reporters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/reporters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAsExC,MAAM,YAAY,GAAG,aAAa,CAAC;AAEnC,+EAA+E;AAC/E,MAAM,UAAU,UAAU,CAAC,IAAwB,EAAE,SAAiC;IACpF,MAAM,IAAI,GAAG,CAAC,IAAI,IAAI,YAAY,CAAC,CAAC,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC;IACtE,OAAO,GAAG,IAAI,IAAI,SAAS,EAAE,CAAC;AAChC,CAAC;AAED,SAAS,OAAO,CAAC,IAAY;IAC3B,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,OAAO,IAAI,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H,CAAC;AAED,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { EvalSuiteResult } from './index.js';
|
|
2
|
+
/** The JUnit XML document of a suite run: one testcase per case and one per assertion */
|
|
3
|
+
export declare function junitXml(result: EvalSuiteResult): string;
|
|
4
|
+
/** Writes the suite run as JUnit XML, which CI systems show as a test report */
|
|
5
|
+
export declare function junitReport(result: EvalSuiteResult, options: {
|
|
6
|
+
path: string;
|
|
7
|
+
}): void;
|
|
8
|
+
//# sourceMappingURL=junit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"junit.d.ts","sourceRoot":"","sources":["../../src/reporters/junit.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAiG/C,yFAAyF;AACzF,wBAAgB,QAAQ,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAqBxD;AAED,gFAAgF;AAChF,wBAAgB,WAAW,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAEpF"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { writeFileSync } from 'node:fs';
|
|
2
|
+
import { caseFlags, caseLabel } from './format.js';
|
|
3
|
+
const SUITE_NAME = 'eval';
|
|
4
|
+
function isXmlChar(code) {
|
|
5
|
+
return (code === 0x9 ||
|
|
6
|
+
code === 0xa ||
|
|
7
|
+
code === 0xd ||
|
|
8
|
+
(code >= 0x20 && code <= 0xd7ff) ||
|
|
9
|
+
(code >= 0xe000 && code <= 0xfffd) ||
|
|
10
|
+
(code >= 0x10000 && code <= 0x10ffff));
|
|
11
|
+
}
|
|
12
|
+
/** Replaces the characters XML 1.0 does not allow, lone surrogates included, with U+FFFD */
|
|
13
|
+
function xmlSafe(value) {
|
|
14
|
+
let out = '';
|
|
15
|
+
for (const ch of value) {
|
|
16
|
+
const code = ch.codePointAt(0) ?? 0;
|
|
17
|
+
out += isXmlChar(code) ? ch : '�';
|
|
18
|
+
}
|
|
19
|
+
return out;
|
|
20
|
+
}
|
|
21
|
+
/** Escapes text content, `\r` kept as a reference since parsers fold a raw one into `\n` */
|
|
22
|
+
function escapeText(value) {
|
|
23
|
+
return xmlSafe(value)
|
|
24
|
+
.replace(/&/g, '&')
|
|
25
|
+
.replace(/</g, '<')
|
|
26
|
+
.replace(/>/g, '>')
|
|
27
|
+
.replace(/\r/g, ' ');
|
|
28
|
+
}
|
|
29
|
+
/** Escapes an attribute value, keeping tabs and line breaks that a parser would fold to spaces */
|
|
30
|
+
function escapeAttr(value) {
|
|
31
|
+
return escapeText(value)
|
|
32
|
+
.replace(/"/g, '"')
|
|
33
|
+
.replace(/'/g, ''')
|
|
34
|
+
.replace(/\t/g, '	')
|
|
35
|
+
.replace(/\n/g, ' ');
|
|
36
|
+
}
|
|
37
|
+
function attrs(values) {
|
|
38
|
+
return Object.entries(values)
|
|
39
|
+
.map(([key, value]) => ` ${key}="${escapeAttr(String(value))}"`)
|
|
40
|
+
.join('');
|
|
41
|
+
}
|
|
42
|
+
function seconds(ms) {
|
|
43
|
+
return (Math.max(0, ms) / 1000).toFixed(3);
|
|
44
|
+
}
|
|
45
|
+
function firstLine(text) {
|
|
46
|
+
return text.split(/\r?\n/, 1)[0] ?? '';
|
|
47
|
+
}
|
|
48
|
+
function caseOutput(result) {
|
|
49
|
+
const lines = result.scores.map((s) => {
|
|
50
|
+
const details = s.details ? ` (${s.details})` : '';
|
|
51
|
+
const error = s.error !== undefined ? ` [error: ${s.error}]` : '';
|
|
52
|
+
return `${s.name}: ${s.score}${details}${error}`;
|
|
53
|
+
});
|
|
54
|
+
for (const flag of caseFlags(result))
|
|
55
|
+
lines.push(`${flag}: true`);
|
|
56
|
+
return lines.join('\n');
|
|
57
|
+
}
|
|
58
|
+
function caseTestcase(result, index) {
|
|
59
|
+
const head = ` <testcase${attrs({
|
|
60
|
+
name: caseLabel(index, result.case.input),
|
|
61
|
+
classname: `${SUITE_NAME}.cases`,
|
|
62
|
+
time: seconds(result.duration),
|
|
63
|
+
})}`;
|
|
64
|
+
const body = [];
|
|
65
|
+
if (result.error !== undefined) {
|
|
66
|
+
body.push(` <failure${attrs({ message: firstLine(result.error), type: 'CaseError' })}>${escapeText(result.error)}</failure>`);
|
|
67
|
+
}
|
|
68
|
+
const output = caseOutput(result);
|
|
69
|
+
if (output !== '')
|
|
70
|
+
body.push(` <system-out>${escapeText(output)}</system-out>`);
|
|
71
|
+
return body.length === 0 ? `${head}/>` : `${head}>\n${body.join('\n')}\n </testcase>`;
|
|
72
|
+
}
|
|
73
|
+
function assertionTestcase(assertion) {
|
|
74
|
+
const head = ` <testcase${attrs({
|
|
75
|
+
name: assertion.name,
|
|
76
|
+
classname: `${SUITE_NAME}.assertions`,
|
|
77
|
+
time: seconds(0),
|
|
78
|
+
})}`;
|
|
79
|
+
if (assertion.passed)
|
|
80
|
+
return `${head}/>`;
|
|
81
|
+
return `${head}>\n <failure${attrs({ message: firstLine(assertion.message), type: 'AssertionFailure' })}>${escapeText(assertion.message)}</failure>\n </testcase>`;
|
|
82
|
+
}
|
|
83
|
+
/** The JUnit XML document of a suite run: one testcase per case and one per assertion */
|
|
84
|
+
export function junitXml(result) {
|
|
85
|
+
const tests = result.results.length + result.assertions.length;
|
|
86
|
+
const failures = result.results.filter((r) => r.error !== undefined).length +
|
|
87
|
+
result.assertions.filter((a) => !a.passed).length;
|
|
88
|
+
const time = seconds(result.stats.duration);
|
|
89
|
+
const counts = { tests, failures, errors: 0, skipped: 0, time };
|
|
90
|
+
const testcases = [
|
|
91
|
+
...result.results.map((r, i) => caseTestcase(r, i)),
|
|
92
|
+
...result.assertions.map((a) => assertionTestcase(a)),
|
|
93
|
+
];
|
|
94
|
+
return [
|
|
95
|
+
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
96
|
+
`<testsuites${attrs({ name: SUITE_NAME, tests, failures, errors: 0, time })}>`,
|
|
97
|
+
` <testsuite${attrs({ name: SUITE_NAME, ...counts })}${testcases.length === 0 ? '/>' : '>'}`,
|
|
98
|
+
...(testcases.length === 0 ? [] : [...testcases, ' </testsuite>']),
|
|
99
|
+
'</testsuites>',
|
|
100
|
+
'',
|
|
101
|
+
].join('\n');
|
|
102
|
+
}
|
|
103
|
+
/** Writes the suite run as JUnit XML, which CI systems show as a test report */
|
|
104
|
+
export function junitReport(result, options) {
|
|
105
|
+
writeFileSync(options.path, junitXml(result), 'utf-8');
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=junit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"junit.js","sourceRoot":"","sources":["../../src/reporters/junit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAEhD,MAAM,UAAU,GAAG,MAAM,CAAC;AAE1B,SAAS,SAAS,CAAC,IAAY;IAC7B,OAAO,CACL,IAAI,KAAK,GAAG;QACZ,IAAI,KAAK,GAAG;QACZ,IAAI,KAAK,GAAG;QACZ,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,MAAM,CAAC;QAChC,CAAC,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,CAAC;QAClC,CAAC,IAAI,IAAI,OAAO,IAAI,IAAI,IAAI,QAAQ,CAAC,CACtC,CAAC;AACJ,CAAC;AAED,4FAA4F;AAC5F,SAAS,OAAO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C;AACf,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,WAAW,CAAC,MAAuB,EAAE,OAAyB;IAC5E,aAAa,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;AACzD,CAAC"}
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
/** A tool call a case expects: the tool's name and, optionally, arguments to compare */
|
|
3
|
+
export declare const ExpectedToolCallSchema: z.ZodObject<{
|
|
4
|
+
name: z.ZodString;
|
|
5
|
+
arguments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
6
|
+
}, z.core.$strip>;
|
|
2
7
|
export declare const EvalCaseSchema: z.ZodObject<{
|
|
3
8
|
input: z.ZodString;
|
|
4
9
|
expected: z.ZodOptional<z.ZodString>;
|
|
5
10
|
context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
6
11
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
12
|
+
turns: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
13
|
+
expectedToolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
14
|
+
name: z.ZodString;
|
|
15
|
+
arguments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
16
|
+
}, z.core.$strip>>>;
|
|
17
|
+
expectedPassages: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
7
18
|
}, z.core.$strip>;
|
|
8
19
|
export declare const EvalSuiteConfigSchema: z.ZodObject<{
|
|
9
20
|
concurrency: z.ZodDefault<z.ZodNumber>;
|
|
10
21
|
timeout: z.ZodDefault<z.ZodNumber>;
|
|
11
22
|
retries: z.ZodDefault<z.ZodNumber>;
|
|
23
|
+
trials: z.ZodDefault<z.ZodNumber>;
|
|
12
24
|
}, z.core.$strip>;
|
|
13
25
|
/**
|
|
14
26
|
* The part of a Cogitator runtime the judge needs: running an agent. The judge's `usage`, when
|
|
@@ -26,17 +38,30 @@ export interface JudgeCogitator {
|
|
|
26
38
|
};
|
|
27
39
|
}>;
|
|
28
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Where the judge keeps the verdicts it already gave, by a key of its model, settings and the
|
|
43
|
+
* whole prompt: a case judged again with the same answer reuses the verdict and costs nothing.
|
|
44
|
+
* A store of your own (a file, Redis) keeps verdicts across runs
|
|
45
|
+
*/
|
|
46
|
+
export interface JudgeCache {
|
|
47
|
+
get(key: string): string | undefined | Promise<string | undefined>;
|
|
48
|
+
set(key: string, verdict: string): void | Promise<void>;
|
|
49
|
+
}
|
|
29
50
|
export declare const JudgeConfigSchema: z.ZodObject<{
|
|
30
51
|
model: z.ZodString;
|
|
31
52
|
temperature: z.ZodDefault<z.ZodNumber>;
|
|
32
53
|
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
33
54
|
cogitator: z.ZodOptional<z.ZodCustom<JudgeCogitator, JudgeCogitator>>;
|
|
55
|
+
cache: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodCustom<JudgeCache, JudgeCache>]>>;
|
|
56
|
+
concurrency: z.ZodOptional<z.ZodNumber>;
|
|
34
57
|
}, z.core.$strip>;
|
|
35
58
|
export declare const EvalComparisonConfigSchema: z.ZodObject<{
|
|
36
59
|
concurrency: z.ZodDefault<z.ZodNumber>;
|
|
37
60
|
timeout: z.ZodDefault<z.ZodNumber>;
|
|
38
61
|
retries: z.ZodDefault<z.ZodNumber>;
|
|
62
|
+
trials: z.ZodDefault<z.ZodNumber>;
|
|
39
63
|
}, z.core.$strip>;
|
|
64
|
+
export type ExpectedToolCall = z.output<typeof ExpectedToolCallSchema>;
|
|
40
65
|
export type EvalCase = z.output<typeof EvalCaseSchema>;
|
|
41
66
|
export type EvalCaseInput = z.input<typeof EvalCaseSchema>;
|
|
42
67
|
export type EvalSuiteConfig = z.output<typeof EvalSuiteConfigSchema>;
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wFAAwF;AACxF,eAAO,MAAM,sBAAsB;;;iBAGjC,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;iBAWzB,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;iBAKhC,CAAC;AAEH;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,GAAG,CACD,KAAK,EAAE,OAAO,EACd,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,GAC9C,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC,CAAC;CAChF;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACnE,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACzD;AAmBD,eAAO,MAAM,iBAAiB;;;;;;;iBAgB5B,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;iBAKrC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACvE,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,cAAc,CAAC,CAAC;AACvD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAC3D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACrE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACzE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC7D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AACjE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
|
package/dist/schema.js
CHANGED
|
@@ -1,15 +1,33 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
/** A tool call a case expects: the tool's name and, optionally, arguments to compare */
|
|
3
|
+
export const ExpectedToolCallSchema = z.object({
|
|
4
|
+
name: z.string().min(1),
|
|
5
|
+
arguments: z.record(z.string(), z.unknown()).optional(),
|
|
6
|
+
});
|
|
2
7
|
export const EvalCaseSchema = z.object({
|
|
3
8
|
input: z.string(),
|
|
4
9
|
expected: z.string().optional(),
|
|
5
10
|
context: z.record(z.string(), z.unknown()).optional(),
|
|
6
11
|
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
12
|
+
/** Further user turns after `input`, run in order on the same conversation */
|
|
13
|
+
turns: z.array(z.string()).optional(),
|
|
14
|
+
/** The tool calls the agent should make over the whole conversation, in order */
|
|
15
|
+
expectedToolCalls: z.array(ExpectedToolCallSchema).optional(),
|
|
16
|
+
/** Ids or texts of the passages the retrieval should surface */
|
|
17
|
+
expectedPassages: z.array(z.string().min(1)).optional(),
|
|
7
18
|
});
|
|
8
19
|
export const EvalSuiteConfigSchema = z.object({
|
|
9
20
|
concurrency: z.number().int().min(1).default(5),
|
|
10
21
|
timeout: z.number().int().min(1000).default(30000),
|
|
11
22
|
retries: z.number().int().min(0).max(10).default(0),
|
|
23
|
+
trials: z.number().int().min(1).default(1),
|
|
12
24
|
});
|
|
25
|
+
function isJudgeCache(value) {
|
|
26
|
+
return (typeof value === 'object' &&
|
|
27
|
+
value !== null &&
|
|
28
|
+
typeof value.get === 'function' &&
|
|
29
|
+
typeof value.set === 'function');
|
|
30
|
+
}
|
|
13
31
|
function isJudgeCogitator(value) {
|
|
14
32
|
return (typeof value === 'object' &&
|
|
15
33
|
value !== null &&
|
|
@@ -21,10 +39,21 @@ export const JudgeConfigSchema = z.object({
|
|
|
21
39
|
maxTokens: z.number().int().positive().optional(),
|
|
22
40
|
/** Runtime that runs the judge; defaults to the `cogitator` of an agent target */
|
|
23
41
|
cogitator: z.custom(isJudgeCogitator).optional(),
|
|
42
|
+
/**
|
|
43
|
+
* Reuse verdicts: `true` keeps them in memory for the suite, a `JudgeCache` of your own keeps
|
|
44
|
+
* them where it likes. Default: every case is judged afresh
|
|
45
|
+
*/
|
|
46
|
+
cache: z.union([z.boolean(), z.custom(isJudgeCache)]).optional(),
|
|
47
|
+
/**
|
|
48
|
+
* Most judge calls at once across the run, below the suite's own concurrency times its judge
|
|
49
|
+
* metrics. Default: no limit of its own
|
|
50
|
+
*/
|
|
51
|
+
concurrency: z.number().int().positive().optional(),
|
|
24
52
|
});
|
|
25
53
|
export const EvalComparisonConfigSchema = z.object({
|
|
26
54
|
concurrency: z.number().int().min(1).default(5),
|
|
27
55
|
timeout: z.number().int().min(1000).default(30000),
|
|
28
56
|
retries: z.number().int().min(0).max(10).default(0),
|
|
57
|
+
trials: z.number().int().min(1).default(1),
|
|
29
58
|
});
|
|
30
59
|
//# sourceMappingURL=schema.js.map
|
package/dist/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;IACrD,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wFAAwF;AACxF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;CACxD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAA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G,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IACnD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;CAC3C,CAAC,CAAC"}
|
package/dist/vitest.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { EvalRunOptions, EvalSuite, EvalSuiteResult } from './eval-suite.js';
|
|
2
|
+
export interface DescribeEvalOptions {
|
|
3
|
+
/** The suite to run */
|
|
4
|
+
suite: EvalSuite;
|
|
5
|
+
/** Passed to `suite.run()`: `maxCases` also decides which cases get a test */
|
|
6
|
+
run?: EvalRunOptions;
|
|
7
|
+
/**
|
|
8
|
+
* Milliseconds the suite run may take, 10 minutes by default. When it runs out the run is
|
|
9
|
+
* cancelled and every test fails with the timeout.
|
|
10
|
+
*/
|
|
11
|
+
timeout?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface DescribeEvalHandle {
|
|
14
|
+
/**
|
|
15
|
+
* The result of the suite run. Call it inside a test or an `afterAll` hook of the same
|
|
16
|
+
* describe block: it throws while the run has not finished, or with the cause when it failed.
|
|
17
|
+
*/
|
|
18
|
+
result: () => EvalSuiteResult;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Registers a Vitest describe block for an eval suite. The suite runs once in `beforeAll`, each
|
|
22
|
+
* case becomes a test that fails when the case errored, and an `assertions` test fails with
|
|
23
|
+
* every assertion that did not pass.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* import { describeEval } from '@cogitator-ai/evals/vitest';
|
|
28
|
+
*
|
|
29
|
+
* const qa = describeEval('qa agent', { suite, run: { maxCases: 50 } });
|
|
30
|
+
*
|
|
31
|
+
* afterAll(() => qa.result().report('junit', { path: './reports/qa' }));
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function describeEval(name: string, options: DescribeEvalOptions): DescribeEvalHandle;
|
|
35
|
+
//# sourceMappingURL=vitest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vitest.d.ts","sourceRoot":"","sources":["../src/vitest.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAS/E,MAAM,WAAW,mBAAmB;IAClC,uBAAuB;IACvB,KAAK,EAAE,SAAS,CAAC;IACjB,8EAA8E;IAC9E,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,MAAM,EAAE,MAAM,eAAe,CAAC;CAC/B;AAWD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,kBAAkB,CAsE3F"}
|