@sanity/ailf 2.0.1 → 2.0.2
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.
|
@@ -29,7 +29,7 @@ export class RunEvalStep {
|
|
|
29
29
|
const start = Date.now();
|
|
30
30
|
const { rootDir, debug, concurrency, noCache } = ctx.config;
|
|
31
31
|
// Precondition: config file exists
|
|
32
|
-
const configIssues = checkGeneratedConfigsExist(rootDir);
|
|
32
|
+
const configIssues = checkGeneratedConfigsExist(rootDir, this.mode);
|
|
33
33
|
const configErrors = configIssues.filter((i) => i.severity === "error");
|
|
34
34
|
if (configErrors.length > 0) {
|
|
35
35
|
return {
|
|
@@ -23,10 +23,15 @@ export declare function checkContextsExist(rootDir: string, areas: string[]): Va
|
|
|
23
23
|
*/
|
|
24
24
|
export declare function checkEnvironment(rootDir: string): ValidationIssue[];
|
|
25
25
|
/**
|
|
26
|
-
* Check that the
|
|
27
|
-
*
|
|
26
|
+
* Check that the generated promptfoo config for a given mode exists.
|
|
27
|
+
*
|
|
28
|
+
* When `mode` is provided, checks only for that mode's config file
|
|
29
|
+
* (e.g. `promptfooconfig.agent-harness.yaml` for mode `"agent-harness"`).
|
|
30
|
+
*
|
|
31
|
+
* When `mode` is omitted, falls back to the legacy literacy check:
|
|
32
|
+
* baseline `promptfooconfig.yaml` (required) plus optional observed/agentic.
|
|
28
33
|
*/
|
|
29
|
-
export declare function checkGeneratedConfigsExist(rootDir: string): ValidationIssue[];
|
|
34
|
+
export declare function checkGeneratedConfigsExist(rootDir: string, mode?: string): ValidationIssue[];
|
|
30
35
|
/**
|
|
31
36
|
* Check that the eval results JSON file exists, is valid JSON, and contains
|
|
32
37
|
* a `results` array.
|
package/dist/pipeline/checks.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { config as loadEnv } from "dotenv";
|
|
9
9
|
import { existsSync, readFileSync, statSync } from "fs";
|
|
10
10
|
import { join, resolve } from "path";
|
|
11
|
+
import { configFileForMode } from "./eval-constants.js";
|
|
11
12
|
// ---------------------------------------------------------------------------
|
|
12
13
|
// Precondition: contexts exist for each feature area
|
|
13
14
|
// ---------------------------------------------------------------------------
|
|
@@ -109,11 +110,30 @@ export function checkEnvironment(rootDir) {
|
|
|
109
110
|
// Postcondition: score summary is valid
|
|
110
111
|
// ---------------------------------------------------------------------------
|
|
111
112
|
/**
|
|
112
|
-
* Check that the
|
|
113
|
-
*
|
|
113
|
+
* Check that the generated promptfoo config for a given mode exists.
|
|
114
|
+
*
|
|
115
|
+
* When `mode` is provided, checks only for that mode's config file
|
|
116
|
+
* (e.g. `promptfooconfig.agent-harness.yaml` for mode `"agent-harness"`).
|
|
117
|
+
*
|
|
118
|
+
* When `mode` is omitted, falls back to the legacy literacy check:
|
|
119
|
+
* baseline `promptfooconfig.yaml` (required) plus optional observed/agentic.
|
|
114
120
|
*/
|
|
115
|
-
export function checkGeneratedConfigsExist(rootDir) {
|
|
121
|
+
export function checkGeneratedConfigsExist(rootDir, mode) {
|
|
116
122
|
const issues = [];
|
|
123
|
+
if (mode) {
|
|
124
|
+
const configName = configFileForMode(mode);
|
|
125
|
+
const configPath = resolve(rootDir, configName);
|
|
126
|
+
if (!existsSync(configPath)) {
|
|
127
|
+
issues.push({
|
|
128
|
+
message: `Config '${configName}' not found for mode '${mode}'. Run the pipeline to generate it.`,
|
|
129
|
+
path: configPath,
|
|
130
|
+
severity: "error",
|
|
131
|
+
source: "checkGeneratedConfigsExist",
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
return issues;
|
|
135
|
+
}
|
|
136
|
+
// Legacy literacy check: baseline required, observed/agentic optional
|
|
117
137
|
const baselinePath = resolve(rootDir, "promptfooconfig.yaml");
|
|
118
138
|
if (!existsSync(baselinePath)) {
|
|
119
139
|
issues.push({
|