veryfront 0.1.1059 → 0.1.1062
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/_dnt.polyfills.d.ts +11 -11
- package/esm/_dnt.polyfills.d.ts.map +1 -1
- package/esm/_dnt.polyfills.js +14 -14
- package/esm/cli/commands/eval/command.d.ts +14 -1
- package/esm/cli/commands/eval/command.d.ts.map +1 -1
- package/esm/cli/commands/eval/command.js +264 -92
- package/esm/deno.js +2 -1
- package/esm/extensions/ext-eval-report-mlflow/src/index.d.ts +35 -0
- package/esm/extensions/ext-eval-report-mlflow/src/index.d.ts.map +1 -0
- package/esm/extensions/ext-eval-report-mlflow/src/index.js +812 -0
- package/esm/src/eval/factory.d.ts +4 -2
- package/esm/src/eval/factory.d.ts.map +1 -1
- package/esm/src/eval/factory.js +12 -4
- package/esm/src/eval/index.d.ts +3 -3
- package/esm/src/eval/index.d.ts.map +1 -1
- package/esm/src/eval/index.js +2 -2
- package/esm/src/eval/runner.d.ts.map +1 -1
- package/esm/src/eval/runner.js +74 -9
- package/esm/src/eval/studio.d.ts +7 -5
- package/esm/src/eval/studio.d.ts.map +1 -1
- package/esm/src/eval/studio.js +9 -3
- package/esm/src/eval/types.d.ts +44 -3
- package/esm/src/eval/types.d.ts.map +1 -1
- package/esm/src/extensions/builtin-extensions.d.ts +5 -1
- package/esm/src/extensions/builtin-extensions.d.ts.map +1 -1
- package/esm/src/extensions/builtin-extensions.js +41 -2
- package/esm/src/extensions/eval/eval-report-exporter.d.ts.map +1 -1
- package/esm/src/extensions/eval/eval-report-exporter.js +5 -0
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +5 -5
package/esm/_dnt.polyfills.d.ts
CHANGED
|
@@ -109,6 +109,17 @@ interface ImportMetaPonyfill extends ImportMetaPonyfillCommonjs, ImportMetaPonyf
|
|
|
109
109
|
export declare let import_meta_ponyfill_commonjs: ImportMetaPonyfillCommonjs;
|
|
110
110
|
export declare let import_meta_ponyfill_esmodule: ImportMetaPonyfillEsmodule;
|
|
111
111
|
export declare let import_meta_ponyfill: ImportMetaPonyfill;
|
|
112
|
+
declare global {
|
|
113
|
+
interface Object {
|
|
114
|
+
/**
|
|
115
|
+
* Determines whether an object has a property with the specified name.
|
|
116
|
+
* @param o An object.
|
|
117
|
+
* @param v A property name.
|
|
118
|
+
*/
|
|
119
|
+
hasOwn(o: object, v: PropertyKey): boolean;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
export {};
|
|
112
123
|
declare global {
|
|
113
124
|
interface Array<T> {
|
|
114
125
|
/**
|
|
@@ -158,17 +169,6 @@ declare global {
|
|
|
158
169
|
}
|
|
159
170
|
}
|
|
160
171
|
export {};
|
|
161
|
-
declare global {
|
|
162
|
-
interface Object {
|
|
163
|
-
/**
|
|
164
|
-
* Determines whether an object has a property with the specified name.
|
|
165
|
-
* @param o An object.
|
|
166
|
-
* @param v A property name.
|
|
167
|
-
*/
|
|
168
|
-
hasOwn(o: object, v: PropertyKey): boolean;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
export {};
|
|
172
172
|
declare global {
|
|
173
173
|
interface PromiseConstructor {
|
|
174
174
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_dnt.polyfills.d.ts","sourceRoot":"","sources":["../src/_dnt.polyfills.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK;QACb,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB;CACF;AAED,OAAO,EAAE,CAAC;AAEV,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,gBAAgB;QACxB,SAAS,CAAC,CAAC,EACP,mBAAmB,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CA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AAO,CAAC,CAAC,CAAC,CAAC;YAAC,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;YAAC,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,IAAI,CAAA;SAAE,CAAC;KAC3H;CACF"}
|
package/esm/_dnt.polyfills.js
CHANGED
|
@@ -222,6 +222,20 @@ export let import_meta_ponyfill = ((...args) => {
|
|
|
222
222
|
//@ts-ignore
|
|
223
223
|
return import_meta_ponyfill(...args);
|
|
224
224
|
});
|
|
225
|
+
// https://github.com/tc39/proposal-accessible-object-hasownproperty/blob/main/polyfill.js
|
|
226
|
+
if (!Object.hasOwn) {
|
|
227
|
+
Object.defineProperty(Object, "hasOwn", {
|
|
228
|
+
value: function (object, property) {
|
|
229
|
+
if (object == null) {
|
|
230
|
+
throw new TypeError("Cannot convert undefined or null to object");
|
|
231
|
+
}
|
|
232
|
+
return Object.prototype.hasOwnProperty.call(Object(object), property);
|
|
233
|
+
},
|
|
234
|
+
configurable: true,
|
|
235
|
+
enumerable: false,
|
|
236
|
+
writable: true,
|
|
237
|
+
});
|
|
238
|
+
}
|
|
225
239
|
function findLastIndex(self, callbackfn, that) {
|
|
226
240
|
const boundFunc = that === undefined ? callbackfn : callbackfn.bind(that);
|
|
227
241
|
let index = self.length - 1;
|
|
@@ -258,20 +272,6 @@ if (!Uint8Array.prototype.findLast) {
|
|
|
258
272
|
return findLast(this, callbackfn, that);
|
|
259
273
|
};
|
|
260
274
|
}
|
|
261
|
-
// https://github.com/tc39/proposal-accessible-object-hasownproperty/blob/main/polyfill.js
|
|
262
|
-
if (!Object.hasOwn) {
|
|
263
|
-
Object.defineProperty(Object, "hasOwn", {
|
|
264
|
-
value: function (object, property) {
|
|
265
|
-
if (object == null) {
|
|
266
|
-
throw new TypeError("Cannot convert undefined or null to object");
|
|
267
|
-
}
|
|
268
|
-
return Object.prototype.hasOwnProperty.call(Object(object), property);
|
|
269
|
-
},
|
|
270
|
-
configurable: true,
|
|
271
|
-
enumerable: false,
|
|
272
|
-
writable: true,
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
275
|
// https://github.com/tc39/proposal-promise-with-resolvers/blob/3a78801e073e99217dbeb2c43ba7212f3bdc8b83/polyfills.js#L1C1-L9C2
|
|
276
276
|
if (Promise.withResolvers === undefined) {
|
|
277
277
|
Promise.withResolvers = () => {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { AgentResponse } from "../../../src/agent/index.js";
|
|
2
2
|
import type { VeryfrontConfig } from "../../../src/config/index.js";
|
|
3
|
-
import
|
|
3
|
+
import { type Tool, type ToolExecutionContext } from "../../../src/tool/index.js";
|
|
4
|
+
import type { DiscoveredEval, EvalModelComparison, EvalModelComparisonOptions, EvalReport, EvalReportComparison, EvalReportExportConfig, EvalToolAdapterContext, EvalToolCall } from "../../../src/eval/index.js";
|
|
5
|
+
import { type EvalReportExporterRegistry, type EvalReportExportRedaction } from "../../../src/extensions/eval/index.js";
|
|
4
6
|
import type { EvalArgs } from "./handler.js";
|
|
5
7
|
export interface EvalOptions extends EvalArgs {
|
|
6
8
|
}
|
|
@@ -74,12 +76,21 @@ export declare function createEvalMarkdownReport(report: EvalReport, baseline?:
|
|
|
74
76
|
export declare function createJunitXml(report: EvalReport): string;
|
|
75
77
|
export declare function writeEvalArtifacts(report: EvalReport, paths: EvalArtifactPaths, baseline?: EvalReportComparison): Promise<void>;
|
|
76
78
|
export declare function createEvalExitCode(report: EvalReport, baseline?: EvalReportComparison): 0 | 1;
|
|
79
|
+
export declare function resolveToolTargetId(target: string): string;
|
|
77
80
|
type EvalRuntimeAuthConfig = Pick<VeryfrontConfig, "projectSlug" | "fs"> & {
|
|
78
81
|
projectSlug?: string;
|
|
79
82
|
};
|
|
80
83
|
export declare function hydrateEvalRuntimeAuth(projectDir: string, config: EvalRuntimeAuthConfig | null | undefined): Promise<import("../../shared/runtime-auth.js").RuntimeAuthContext>;
|
|
81
84
|
export declare function normalizeUsage(response: AgentResponse): {};
|
|
82
85
|
export declare function normalizeToolCalls(response: AgentResponse): EvalToolCall[];
|
|
86
|
+
export declare function createToolAdapter(tool: Tool, baseContext?: ToolExecutionContext): (context: EvalToolAdapterContext) => Promise<{
|
|
87
|
+
error?: string | undefined;
|
|
88
|
+
output: any;
|
|
89
|
+
toolCallId: string;
|
|
90
|
+
durationMs: number;
|
|
91
|
+
completed: boolean;
|
|
92
|
+
}>;
|
|
93
|
+
export declare function createEvalCliExportConfig(evalItem: DiscoveredEval, options: EvalOptions, projectDir: string, artifactPaths: EvalArtifactPaths, registry: EvalReportExporterRegistry, config?: EvalRuntimeAuthConfig | null): EvalReportExportConfig | undefined;
|
|
83
94
|
type EvalModelComparisonConfig = {
|
|
84
95
|
baselineModel: string;
|
|
85
96
|
candidateModels: string[];
|
|
@@ -90,6 +101,8 @@ type ResolvedEvalModelComparisonConfig = {
|
|
|
90
101
|
config: EvalModelComparisonConfig;
|
|
91
102
|
policy: EvalModelComparisonPolicy;
|
|
92
103
|
};
|
|
104
|
+
export declare function resolveEvalExporterIds(options: Pick<EvalOptions, "exporters">): string[];
|
|
105
|
+
export declare function resolveEvalExportRedactionFromEnv(): EvalReportExportRedaction;
|
|
93
106
|
export declare function evalCommand(options: EvalOptions): Promise<void>;
|
|
94
107
|
export {};
|
|
95
108
|
//# sourceMappingURL=command.d.ts.map
|
|
@@ -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,sBAAsB,EACtB,YAAY,EAEb,MAAM,4BAA4B,CAAC;
|
|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,EAAE,MAAM,EAClB,aAAa,EAAE,iBAAiB,EAChC,QAAQ,EAAE,0BAA0B,EACpC,MAAM,CAAC,EAAE,qBAAqB,GAAG,IAAI,GACpC,sBAAsB,GAAG,SAAS,CAkBpC;AAED,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;AAuBF,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,GAAG,MAAM,EAAE,CAOxF;AA2BD,wBAAgB,iCAAiC,IAAI,yBAAyB,CAuB7E;AA8OD,wBAAsB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAgMrE"}
|
|
@@ -3,14 +3,28 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as dntShim from "../../../_dnt.shims.js";
|
|
5
5
|
import { dirname, isAbsolute, join, relative, resolve } from "../../../deps/jsr.io/@std/path/1.1.4/mod.js";
|
|
6
|
+
import { isErroredToolExecutionResult } from "../../../src/tool/index.js";
|
|
6
7
|
import { createProjectDiscoveryConfig, discoverAll } from "../../../src/discovery/index.js";
|
|
8
|
+
import { orchestrateExtensions } from "../../../src/extensions/index.js";
|
|
9
|
+
import { createEvalReportExporterRegistry, EvalReportExporterRegistryName, } from "../../../src/extensions/eval/index.js";
|
|
10
|
+
import { createLLMProviderRegistry, LLMProviderRegistryName } from "../../../src/extensions/llm/index.js";
|
|
7
11
|
import { compareEvalModelReports, compareEvalReports, createEvalModelComparisonMarkdown, createEvalRunId, discoverEvals, EVAL_REPORT_SCHEMA_VERSION, exportEvalReport, resolveEvalRunProvenance, runEval, } from "../../../src/eval/index.js";
|
|
8
12
|
import { getCurrentVeryfrontCloudContext, getVeryfrontCloudBootstrap, runWithVeryfrontCloudContextAsync, } from "../../../src/provider/index.js";
|
|
9
13
|
import { applyRuntimeAuthContext } from "../../shared/runtime-auth.js";
|
|
10
14
|
import { cliLogger, exitProcess, VERSION } from "../../utils/index.js";
|
|
11
15
|
import { createErrorEnvelope, createSuccessEnvelope, isJsonMode, outputJson, } from "../../shared/json-output.js";
|
|
12
16
|
import { withProjectSourceContext } from "../../shared/project-source-context.js";
|
|
17
|
+
import { createEvalCliBuiltinExtensions } from "../../../src/extensions/builtin-extensions.js";
|
|
13
18
|
const GATEWAY_BILLING_GROUP_USAGE_NOT_READY_CODE = "gateway_billing_group_usage_not_ready";
|
|
19
|
+
const ENV_EVAL_EXPORTERS = "VERYFRONT_EVAL_EXPORTERS";
|
|
20
|
+
const ENV_EVAL_EXPORT = "VERYFRONT_EVAL_EXPORT";
|
|
21
|
+
const ENV_EVAL_EXPORT_INCLUDE_INPUTS = "VERYFRONT_EVAL_EXPORT_INCLUDE_INPUTS";
|
|
22
|
+
const ENV_EVAL_EXPORT_INCLUDE_OUTPUTS = "VERYFRONT_EVAL_EXPORT_INCLUDE_OUTPUTS";
|
|
23
|
+
const ENV_EVAL_EXPORT_INCLUDE_REFERENCES = "VERYFRONT_EVAL_EXPORT_INCLUDE_REFERENCES";
|
|
24
|
+
const ENV_EVAL_EXPORT_INCLUDE_TRACES = "VERYFRONT_EVAL_EXPORT_INCLUDE_TRACES";
|
|
25
|
+
const ENV_EVAL_EXPORT_INCLUDE_METRIC_EVIDENCE = "VERYFRONT_EVAL_EXPORT_INCLUDE_METRIC_EVIDENCE";
|
|
26
|
+
const ENV_EVAL_EXPORT_INCLUDE_METRIC_EXPLANATIONS = "VERYFRONT_EVAL_EXPORT_INCLUDE_METRIC_EXPLANATIONS";
|
|
27
|
+
const ENV_EVAL_EXPORT_METADATA_ALLOWLIST = "VERYFRONT_EVAL_EXPORT_METADATA_ALLOWLIST";
|
|
14
28
|
// Gateway usage capture is eventually consistent after model streams close.
|
|
15
29
|
const DEFAULT_GATEWAY_BILLING_FINALIZE_RETRY_DELAYS_MS = [
|
|
16
30
|
500,
|
|
@@ -624,6 +638,9 @@ export function createEvalExitCode(report, baseline) {
|
|
|
624
638
|
function resolveAgentTargetId(target) {
|
|
625
639
|
return target.startsWith("agent:") ? target.slice("agent:".length) : target;
|
|
626
640
|
}
|
|
641
|
+
export function resolveToolTargetId(target) {
|
|
642
|
+
return target.startsWith("tool:") ? target.slice("tool:".length) : target;
|
|
643
|
+
}
|
|
627
644
|
function resolveEvalRuntimeProjectSlug(config) {
|
|
628
645
|
return config?.projectSlug ?? config?.fs?.veryfront?.projectSlug;
|
|
629
646
|
}
|
|
@@ -633,6 +650,14 @@ export async function hydrateEvalRuntimeAuth(projectDir, config) {
|
|
|
633
650
|
projectSlug: resolveEvalRuntimeProjectSlug(config),
|
|
634
651
|
});
|
|
635
652
|
}
|
|
653
|
+
function createEvalToolExecutionContext(config) {
|
|
654
|
+
const projectSlug = resolveEvalRuntimeProjectSlug(config);
|
|
655
|
+
const authToken = dntShim.Deno.env.get("VERYFRONT_API_TOKEN");
|
|
656
|
+
return {
|
|
657
|
+
...(projectSlug ? { projectSlug } : {}),
|
|
658
|
+
...(authToken ? { authToken } : {}),
|
|
659
|
+
};
|
|
660
|
+
}
|
|
636
661
|
export function normalizeUsage(response) {
|
|
637
662
|
return response.usage
|
|
638
663
|
? {
|
|
@@ -705,6 +730,19 @@ export function normalizeToolCalls(response) {
|
|
|
705
730
|
: {}),
|
|
706
731
|
}));
|
|
707
732
|
}
|
|
733
|
+
function getToolExecutionErrorMessage(output) {
|
|
734
|
+
if (!isErroredToolExecutionResult(output))
|
|
735
|
+
return undefined;
|
|
736
|
+
if (isRecord(output) && typeof output.error === "string")
|
|
737
|
+
return output.error;
|
|
738
|
+
if (isRecord(output) && isRecord(output.output) && typeof output.output.error === "string") {
|
|
739
|
+
return output.output.error;
|
|
740
|
+
}
|
|
741
|
+
return "Tool execution returned an error result.";
|
|
742
|
+
}
|
|
743
|
+
function createEvalToolCallId(toolId, context) {
|
|
744
|
+
return `eval-${toolId}-${context.example.id}-${context.repetition}-${dntShim.crypto.randomUUID()}`;
|
|
745
|
+
}
|
|
708
746
|
function createAgentAdapter(agent, options) {
|
|
709
747
|
return async ({ example }) => {
|
|
710
748
|
const started = Date.now();
|
|
@@ -726,6 +764,25 @@ function createAgentAdapter(agent, options) {
|
|
|
726
764
|
};
|
|
727
765
|
};
|
|
728
766
|
}
|
|
767
|
+
export function createToolAdapter(tool, baseContext = {}) {
|
|
768
|
+
return async (context) => {
|
|
769
|
+
const started = Date.now();
|
|
770
|
+
const toolCallId = createEvalToolCallId(tool.id, context);
|
|
771
|
+
const output = await tool.execute(context.input, {
|
|
772
|
+
...baseContext,
|
|
773
|
+
runId: context.runId,
|
|
774
|
+
toolCallId,
|
|
775
|
+
});
|
|
776
|
+
const error = getToolExecutionErrorMessage(output);
|
|
777
|
+
return {
|
|
778
|
+
output,
|
|
779
|
+
toolCallId,
|
|
780
|
+
durationMs: Date.now() - started,
|
|
781
|
+
completed: !error,
|
|
782
|
+
...(error ? { error } : {}),
|
|
783
|
+
};
|
|
784
|
+
};
|
|
785
|
+
}
|
|
729
786
|
function listEvals(evals, projectDir) {
|
|
730
787
|
return evals.map((item) => ({
|
|
731
788
|
id: item.id,
|
|
@@ -760,24 +817,102 @@ function printReport(report, baseline) {
|
|
|
760
817
|
}
|
|
761
818
|
}
|
|
762
819
|
}
|
|
763
|
-
function createEvalCliExportConfig(evalItem, options, projectDir, artifactPaths) {
|
|
764
|
-
|
|
820
|
+
export function createEvalCliExportConfig(evalItem, options, projectDir, artifactPaths, registry, config) {
|
|
821
|
+
const exporterIds = resolveEvalExporterIds(options);
|
|
822
|
+
if (exporterIds.length === 0)
|
|
765
823
|
return undefined;
|
|
824
|
+
const projectReference = resolveEvalRuntimeProjectSlug(config);
|
|
766
825
|
return {
|
|
767
|
-
|
|
826
|
+
registry,
|
|
827
|
+
exporterIds,
|
|
768
828
|
context: {
|
|
769
829
|
evalId: evalItem.definition.id,
|
|
830
|
+
...(projectReference ? { projectReference } : {}),
|
|
770
831
|
sourcePath: displaySourcePath(evalItem.filePath, projectDir),
|
|
771
832
|
reportPath: options.report ?? artifactPaths.summary,
|
|
772
833
|
tags: evalItem.definition.tags,
|
|
773
834
|
metadata: evalItem.definition.metadata,
|
|
774
|
-
redaction:
|
|
835
|
+
redaction: resolveEvalExportRedactionFromEnv(),
|
|
775
836
|
},
|
|
776
837
|
};
|
|
777
838
|
}
|
|
778
839
|
function uniqueValues(values) {
|
|
779
840
|
return Array.from(new Set(values.map((value) => value.trim()).filter(Boolean)));
|
|
780
841
|
}
|
|
842
|
+
function readEvalCliEnv(name) {
|
|
843
|
+
try {
|
|
844
|
+
const value = dntShim.Deno.env.get(name);
|
|
845
|
+
return value && value.trim().length > 0 ? value : undefined;
|
|
846
|
+
}
|
|
847
|
+
catch {
|
|
848
|
+
return undefined;
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
function parseEvalExporterList(value) {
|
|
852
|
+
if (!value)
|
|
853
|
+
return [];
|
|
854
|
+
return value
|
|
855
|
+
.split(/[,\s]+/)
|
|
856
|
+
.map((entry) => entry.trim())
|
|
857
|
+
.filter((entry) => entry.length > 0);
|
|
858
|
+
}
|
|
859
|
+
export function resolveEvalExporterIds(options) {
|
|
860
|
+
if (options.exporters.length > 0)
|
|
861
|
+
return uniqueValues(options.exporters);
|
|
862
|
+
const envExporters = parseEvalExporterList(readEvalCliEnv(ENV_EVAL_EXPORTERS));
|
|
863
|
+
if (envExporters.length > 0)
|
|
864
|
+
return uniqueValues(envExporters);
|
|
865
|
+
return uniqueValues(parseEvalExporterList(readEvalCliEnv(ENV_EVAL_EXPORT)));
|
|
866
|
+
}
|
|
867
|
+
function parseEvalExportBooleanEnv(name) {
|
|
868
|
+
const value = readEvalCliEnv(name)?.toLowerCase();
|
|
869
|
+
if (value === undefined)
|
|
870
|
+
return undefined;
|
|
871
|
+
if (["1", "true", "yes", "on"].includes(value))
|
|
872
|
+
return true;
|
|
873
|
+
if (["0", "false", "no", "off"].includes(value))
|
|
874
|
+
return false;
|
|
875
|
+
return false;
|
|
876
|
+
}
|
|
877
|
+
function assignEvalExportBooleanEnv(redaction, key, envName) {
|
|
878
|
+
const value = parseEvalExportBooleanEnv(envName);
|
|
879
|
+
if (value !== undefined)
|
|
880
|
+
redaction[key] = value;
|
|
881
|
+
}
|
|
882
|
+
export function resolveEvalExportRedactionFromEnv() {
|
|
883
|
+
const redaction = {};
|
|
884
|
+
assignEvalExportBooleanEnv(redaction, "includeInputs", ENV_EVAL_EXPORT_INCLUDE_INPUTS);
|
|
885
|
+
assignEvalExportBooleanEnv(redaction, "includeOutputs", ENV_EVAL_EXPORT_INCLUDE_OUTPUTS);
|
|
886
|
+
assignEvalExportBooleanEnv(redaction, "includeReferences", ENV_EVAL_EXPORT_INCLUDE_REFERENCES);
|
|
887
|
+
assignEvalExportBooleanEnv(redaction, "includeTraces", ENV_EVAL_EXPORT_INCLUDE_TRACES);
|
|
888
|
+
assignEvalExportBooleanEnv(redaction, "includeMetricEvidence", ENV_EVAL_EXPORT_INCLUDE_METRIC_EVIDENCE);
|
|
889
|
+
assignEvalExportBooleanEnv(redaction, "includeMetricExplanations", ENV_EVAL_EXPORT_INCLUDE_METRIC_EXPLANATIONS);
|
|
890
|
+
const metadataAllowlist = parseEvalExporterList(readEvalCliEnv(ENV_EVAL_EXPORT_METADATA_ALLOWLIST));
|
|
891
|
+
if (metadataAllowlist.length > 0)
|
|
892
|
+
redaction.metadataAllowlist = uniqueValues(metadataAllowlist);
|
|
893
|
+
return redaction;
|
|
894
|
+
}
|
|
895
|
+
function createEvalCliPrimeContracts() {
|
|
896
|
+
const exporterRegistry = createEvalReportExporterRegistry();
|
|
897
|
+
return {
|
|
898
|
+
exporterRegistry,
|
|
899
|
+
contracts: {
|
|
900
|
+
[LLMProviderRegistryName]: createLLMProviderRegistry(),
|
|
901
|
+
[EvalReportExporterRegistryName]: exporterRegistry,
|
|
902
|
+
},
|
|
903
|
+
};
|
|
904
|
+
}
|
|
905
|
+
async function setupEvalCliExtensions(projectDir, config, exporterIds) {
|
|
906
|
+
const primeContracts = createEvalCliPrimeContracts();
|
|
907
|
+
const loader = await orchestrateExtensions({
|
|
908
|
+
projectDir,
|
|
909
|
+
config,
|
|
910
|
+
logger: cliLogger.component("eval-extensions"),
|
|
911
|
+
primeContracts: primeContracts.contracts,
|
|
912
|
+
builtinExtensions: createEvalCliBuiltinExtensions(exporterIds),
|
|
913
|
+
});
|
|
914
|
+
return { loader, exporterRegistry: primeContracts.exporterRegistry };
|
|
915
|
+
}
|
|
781
916
|
function resolveEvalModelComparisonConfig(options) {
|
|
782
917
|
const candidateModels = uniqueValues(options.candidateModels);
|
|
783
918
|
const baselineModel = options.baselineModel?.trim();
|
|
@@ -828,7 +963,7 @@ async function runEvalModelComparison(input) {
|
|
|
828
963
|
const modelPaths = paths.models[model];
|
|
829
964
|
const modelOptions = { ...input.options, model, report: undefined };
|
|
830
965
|
const modelRunId = `${runId}_${sanitizeModelIdForPath(model)}`;
|
|
831
|
-
const exportConfig = createEvalCliExportConfig(input.evalItem, modelOptions, input.projectDir, modelPaths);
|
|
966
|
+
const exportConfig = createEvalCliExportConfig(input.evalItem, modelOptions, input.projectDir, modelPaths, input.exporterRegistry, input.projectReference ? { projectSlug: input.projectReference } : undefined);
|
|
832
967
|
const finalizedReport = await runEvalWithGatewayBillingGroup(modelRunId, () => runEval(input.evalItem.definition, {
|
|
833
968
|
baseDir: input.options.datasetBase ?? input.projectDir,
|
|
834
969
|
runId: modelRunId,
|
|
@@ -873,7 +1008,7 @@ async function runEvalModelComparison(input) {
|
|
|
873
1008
|
if (input.options.report)
|
|
874
1009
|
cliLogger.info(`Report: ${input.options.report}`);
|
|
875
1010
|
}
|
|
876
|
-
|
|
1011
|
+
return createEvalModelComparisonExitCode(reports);
|
|
877
1012
|
}
|
|
878
1013
|
async function outputEvalNotFound(id, evals) {
|
|
879
1014
|
if (isJsonMode()) {
|
|
@@ -895,7 +1030,7 @@ async function outputEvalNotFound(id, evals) {
|
|
|
895
1030
|
cliLogger.info("No evals found. Create an eval file in evals/.");
|
|
896
1031
|
}
|
|
897
1032
|
}
|
|
898
|
-
|
|
1033
|
+
return 1;
|
|
899
1034
|
}
|
|
900
1035
|
async function outputAgentNotFound(agentId) {
|
|
901
1036
|
if (isJsonMode()) {
|
|
@@ -908,7 +1043,20 @@ async function outputAgentNotFound(agentId) {
|
|
|
908
1043
|
else {
|
|
909
1044
|
cliLogger.error(`Agent "${agentId}" not found for eval target.`);
|
|
910
1045
|
}
|
|
911
|
-
|
|
1046
|
+
return 1;
|
|
1047
|
+
}
|
|
1048
|
+
async function outputToolNotFound(toolId) {
|
|
1049
|
+
if (isJsonMode()) {
|
|
1050
|
+
await outputJson(createErrorEnvelope("eval", {
|
|
1051
|
+
code: "NOT_FOUND",
|
|
1052
|
+
slug: "eval-tool-not-found",
|
|
1053
|
+
message: `Tool "${toolId}" not found`,
|
|
1054
|
+
}));
|
|
1055
|
+
}
|
|
1056
|
+
else {
|
|
1057
|
+
cliLogger.error(`Tool "${toolId}" not found for eval target.`);
|
|
1058
|
+
}
|
|
1059
|
+
return 1;
|
|
912
1060
|
}
|
|
913
1061
|
async function outputEvalUsageError(message) {
|
|
914
1062
|
if (isJsonMode()) {
|
|
@@ -921,11 +1069,11 @@ async function outputEvalUsageError(message) {
|
|
|
921
1069
|
else {
|
|
922
1070
|
cliLogger.error(message);
|
|
923
1071
|
}
|
|
924
|
-
|
|
1072
|
+
return 2;
|
|
925
1073
|
}
|
|
926
1074
|
export async function evalCommand(options) {
|
|
927
1075
|
const projectDir = dntShim.Deno.cwd();
|
|
928
|
-
await withProjectSourceContext(projectDir, async ({ adapter, config }) => {
|
|
1076
|
+
const exitCode = await withProjectSourceContext(projectDir, async ({ adapter, config }) => {
|
|
929
1077
|
await hydrateEvalRuntimeAuth(projectDir, config);
|
|
930
1078
|
const evalDiscovery = await discoverEvals({ projectDir, adapter, config });
|
|
931
1079
|
if (options.debug) {
|
|
@@ -937,17 +1085,17 @@ export async function evalCommand(options) {
|
|
|
937
1085
|
const evals = listEvals(evalDiscovery.evals, projectDir);
|
|
938
1086
|
if (isJsonMode()) {
|
|
939
1087
|
await outputJson(createSuccessEnvelope("eval", { evals, errors: evalDiscovery.errors }));
|
|
940
|
-
return;
|
|
1088
|
+
return undefined;
|
|
941
1089
|
}
|
|
942
1090
|
if (evals.length === 0) {
|
|
943
1091
|
cliLogger.info("No evals found.");
|
|
944
|
-
return;
|
|
1092
|
+
return undefined;
|
|
945
1093
|
}
|
|
946
1094
|
cliLogger.info("Evals:");
|
|
947
1095
|
for (const item of evals) {
|
|
948
1096
|
cliLogger.info(` - ${item.id} (${item.target})`);
|
|
949
1097
|
}
|
|
950
|
-
return;
|
|
1098
|
+
return undefined;
|
|
951
1099
|
}
|
|
952
1100
|
if (!options.id) {
|
|
953
1101
|
if (isJsonMode()) {
|
|
@@ -960,101 +1108,125 @@ export async function evalCommand(options) {
|
|
|
960
1108
|
else {
|
|
961
1109
|
cliLogger.error("Eval id is required. Usage: veryfront eval <eval-id>");
|
|
962
1110
|
}
|
|
963
|
-
|
|
964
|
-
return;
|
|
1111
|
+
return 2;
|
|
965
1112
|
}
|
|
966
1113
|
const evalId = normalizeEvalCliId(options.id);
|
|
967
1114
|
const evalItem = findEvalForCliId(evalDiscovery.evals, options.id);
|
|
968
1115
|
if (!evalItem) {
|
|
969
|
-
await outputEvalNotFound(evalId, evalDiscovery.evals);
|
|
970
|
-
return;
|
|
1116
|
+
return await outputEvalNotFound(evalId, evalDiscovery.evals);
|
|
971
1117
|
}
|
|
972
1118
|
let modelComparisonConfig;
|
|
973
1119
|
try {
|
|
974
1120
|
modelComparisonConfig = await createResolvedEvalModelComparisonConfig(projectDir, options);
|
|
975
1121
|
}
|
|
976
1122
|
catch (error) {
|
|
977
|
-
await outputEvalUsageError(error instanceof Error ? error.message : String(error));
|
|
978
|
-
return;
|
|
1123
|
+
return await outputEvalUsageError(error instanceof Error ? error.message : String(error));
|
|
979
1124
|
}
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
const agentId = resolveAgentTargetId(evalItem.definition.target);
|
|
988
|
-
const agent = projectDiscovery.agents.get(agentId);
|
|
989
|
-
if (!agent) {
|
|
990
|
-
await outputAgentNotFound(agentId);
|
|
991
|
-
return;
|
|
1125
|
+
if (evalItem.definition.targetKind !== "agent") {
|
|
1126
|
+
if (modelComparisonConfig) {
|
|
1127
|
+
return await outputEvalUsageError("Model comparison flags are only supported for agent evals.");
|
|
1128
|
+
}
|
|
1129
|
+
if (options.model || options.maxOutputTokens) {
|
|
1130
|
+
return await outputEvalUsageError("--model and --max-output-tokens are only supported for agent evals.");
|
|
1131
|
+
}
|
|
992
1132
|
}
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
options,
|
|
1133
|
+
const selectedExporterIds = resolveEvalExporterIds(options);
|
|
1134
|
+
const extensionSetup = await setupEvalCliExtensions(projectDir, config, selectedExporterIds);
|
|
1135
|
+
try {
|
|
1136
|
+
const discoveryConfig = createProjectDiscoveryConfig({
|
|
998
1137
|
projectDir,
|
|
999
|
-
config
|
|
1000
|
-
|
|
1138
|
+
config,
|
|
1139
|
+
fsAdapter: adapter.fs,
|
|
1140
|
+
verbose: options.debug,
|
|
1001
1141
|
});
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1142
|
+
const projectDiscovery = await discoverAll(discoveryConfig);
|
|
1143
|
+
const agentId = evalItem.definition.targetKind === "agent"
|
|
1144
|
+
? resolveAgentTargetId(evalItem.definition.target)
|
|
1145
|
+
: undefined;
|
|
1146
|
+
const toolId = evalItem.definition.targetKind === "tool"
|
|
1147
|
+
? resolveToolTargetId(evalItem.definition.target)
|
|
1148
|
+
: undefined;
|
|
1149
|
+
const agent = agentId ? projectDiscovery.agents.get(agentId) : undefined;
|
|
1150
|
+
const tool = toolId ? projectDiscovery.tools.get(toolId) : undefined;
|
|
1151
|
+
if (agentId && !agent) {
|
|
1152
|
+
return await outputAgentNotFound(agentId);
|
|
1153
|
+
}
|
|
1154
|
+
if (toolId && !tool) {
|
|
1155
|
+
return await outputToolNotFound(toolId);
|
|
1156
|
+
}
|
|
1157
|
+
if (modelComparisonConfig) {
|
|
1158
|
+
return await runEvalModelComparison({
|
|
1159
|
+
evalItem,
|
|
1160
|
+
agent: agent,
|
|
1161
|
+
options,
|
|
1162
|
+
projectDir,
|
|
1163
|
+
config: modelComparisonConfig.config,
|
|
1164
|
+
policy: modelComparisonConfig.policy,
|
|
1165
|
+
exporterRegistry: extensionSetup.exporterRegistry,
|
|
1166
|
+
projectReference: resolveEvalRuntimeProjectSlug(config),
|
|
1167
|
+
});
|
|
1168
|
+
}
|
|
1169
|
+
const runId = createEvalRunId();
|
|
1170
|
+
const artifactPaths = createEvalArtifactPaths(options.reportDir ?? createDefaultEvalReportDir(runId, evalItem.id));
|
|
1171
|
+
const provenance = await resolveEvalRunProvenance({
|
|
1172
|
+
projectDir,
|
|
1173
|
+
frameworkVersion: VERSION,
|
|
1174
|
+
});
|
|
1175
|
+
const billingGroupId = options.model
|
|
1176
|
+
? `${runId}_${sanitizeModelIdForPath(options.model)}`
|
|
1177
|
+
: runId;
|
|
1178
|
+
const exportConfig = createEvalCliExportConfig(evalItem, options, projectDir, artifactPaths, extensionSetup.exporterRegistry, config);
|
|
1179
|
+
const finalizedReport = await runEvalWithGatewayBillingGroup(billingGroupId, () => runEval(evalItem.definition, {
|
|
1180
|
+
baseDir: options.datasetBase ?? projectDir,
|
|
1181
|
+
runId,
|
|
1182
|
+
adapters: evalItem.definition.targetKind === "tool"
|
|
1183
|
+
? { tool: createToolAdapter(tool, createEvalToolExecutionContext(config)) }
|
|
1184
|
+
: { agent: createAgentAdapter(agent, options) },
|
|
1185
|
+
metadata: {
|
|
1186
|
+
provenance,
|
|
1187
|
+
...(options.model ? { model: options.model } : {}),
|
|
1188
|
+
},
|
|
1045
1189
|
}));
|
|
1190
|
+
const report = await exportEvalReportForCli(finalizedReport, exportConfig);
|
|
1191
|
+
const baseline = options.baseline
|
|
1192
|
+
? compareEvalReports(report, await readEvalReport(options.baseline), createEvalBaselineComparisonPolicy(options))
|
|
1193
|
+
: undefined;
|
|
1194
|
+
await writeEvalArtifacts(report, artifactPaths, baseline);
|
|
1195
|
+
if (options.report) {
|
|
1196
|
+
await writeTextFileEnsuringDir(options.report, JSON.stringify(report, null, 2));
|
|
1197
|
+
}
|
|
1198
|
+
if (options.junit) {
|
|
1199
|
+
await writeTextFileEnsuringDir(options.junit, createJunitXml(report));
|
|
1200
|
+
}
|
|
1201
|
+
if (options.writeBaseline) {
|
|
1202
|
+
await writeTextFileEnsuringDir(options.writeBaseline, JSON.stringify(report, null, 2));
|
|
1203
|
+
}
|
|
1204
|
+
if (isJsonMode()) {
|
|
1205
|
+
await outputJson(createSuccessEnvelope("eval", {
|
|
1206
|
+
report,
|
|
1207
|
+
summary: summarizeReportForCli(report),
|
|
1208
|
+
baseline,
|
|
1209
|
+
artifacts: artifactPaths,
|
|
1210
|
+
}));
|
|
1211
|
+
}
|
|
1212
|
+
else {
|
|
1213
|
+
printReport(report, baseline);
|
|
1214
|
+
cliLogger.info(`Report directory: ${artifactPaths.directory}`);
|
|
1215
|
+
cliLogger.info(`Report markdown: ${artifactPaths.reportMarkdown}`);
|
|
1216
|
+
if (options.report)
|
|
1217
|
+
cliLogger.info(`Report: ${options.report}`);
|
|
1218
|
+
if (options.junit)
|
|
1219
|
+
cliLogger.info(`JUnit: ${options.junit}`);
|
|
1220
|
+
if (options.writeBaseline)
|
|
1221
|
+
cliLogger.info(`Baseline written: ${options.writeBaseline}`);
|
|
1222
|
+
}
|
|
1223
|
+
return createEvalExitCode(report, baseline);
|
|
1046
1224
|
}
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
cliLogger.info(`Report directory: ${artifactPaths.directory}`);
|
|
1050
|
-
cliLogger.info(`Report markdown: ${artifactPaths.reportMarkdown}`);
|
|
1051
|
-
if (options.report)
|
|
1052
|
-
cliLogger.info(`Report: ${options.report}`);
|
|
1053
|
-
if (options.junit)
|
|
1054
|
-
cliLogger.info(`JUnit: ${options.junit}`);
|
|
1055
|
-
if (options.writeBaseline)
|
|
1056
|
-
cliLogger.info(`Baseline written: ${options.writeBaseline}`);
|
|
1225
|
+
finally {
|
|
1226
|
+
await extensionSetup.loader.teardownAll();
|
|
1057
1227
|
}
|
|
1058
|
-
exitProcess(createEvalExitCode(report, baseline));
|
|
1059
1228
|
});
|
|
1229
|
+
if (typeof exitCode === "number") {
|
|
1230
|
+
exitProcess(exitCode);
|
|
1231
|
+
}
|
|
1060
1232
|
}
|