@sanity/ailf 0.1.23 → 0.1.24

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.
@@ -47,7 +47,14 @@ export class RunEvalStep {
47
47
  }
48
48
  : undefined;
49
49
  const tasks = await ctx.taskSource.loadTasks(filter);
50
- const taskIds = tasks.map((t) => t.id);
50
+ // Only check context files for tasks that have canonical docs.
51
+ // Tasks without canonical docs are skipped by FetchDocsStep (they
52
+ // have no docs to fetch), so no context file is written for them.
53
+ // The generated Promptfoo config still includes their "without-docs"
54
+ // variant (testing model knowledge alone), which doesn't need a
55
+ // context file.
56
+ const tasksWithDocs = tasks.filter((t) => t.canonicalDocs.length > 0);
57
+ const taskIds = tasksWithDocs.map((t) => t.id);
51
58
  const contextIssues = checkCanonicalContextsExist(rootDir, taskIds);
52
59
  const contextErrors = contextIssues.filter((i) => i.severity === "error");
53
60
  if (contextErrors.length > 0) {
@@ -198,8 +198,15 @@ export function expandTask(task, rubricConfig, mode = "baseline") {
198
198
  /**
199
199
  * Convert a TaskDefinition (from @sanity/ailf-core) to the local
200
200
  * SingleTaskDefinition format used by expandTask().
201
+ *
202
+ * When a task has no canonical docs, the `docs` var is set to empty string
203
+ * instead of a file path. This prevents Promptfoo from trying to read a
204
+ * context file that was never created by FetchDocsStep (which skips tasks
205
+ * without canonical docs). The gold entry still runs — it just tests model
206
+ * knowledge alone, same as the baseline variant.
201
207
  */
202
208
  function taskDefinitionToSingle(task) {
209
+ const hasDocs = task.canonicalDocs.length > 0;
203
210
  return {
204
211
  assert: task.assertions.map((a) => ({ ...a })),
205
212
  baseline: task.baseline,
@@ -208,7 +215,7 @@ function taskDefinitionToSingle(task) {
208
215
  featureArea: task.featureArea,
209
216
  id: task.id,
210
217
  vars: {
211
- docs: `file://contexts/canonical/${task.id}.md`,
218
+ docs: hasDocs ? `file://contexts/canonical/${task.id}.md` : "",
212
219
  task: task.taskPrompt,
213
220
  ...task.extraVars,
214
221
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/ailf",
3
- "version": "0.1.23",
3
+ "version": "0.1.24",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "restricted"