n8n/packages/@n8n/instance-ai/evaluations/data/source.ts
José Braulio González Valido 23d70d1bb9
feat(ai-builder): Source eval test cases from LangTracer (no-changelog) (#33067)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-29 10:17:49 +00:00

26 lines
904 B
TypeScript

// Test-case source selector — `disk` (default) or `langtracer`, both returning the
// same WorkflowTestCaseWithFile[] so the rest of the pipeline is source-agnostic.
import { loadWorkflowTestCasesWithFiles, type WorkflowTestCaseWithFile } from './workflows';
import type { CliArgs } from '../cli/args';
import type { EvalLogger } from '../harness/logger';
import { loadTestCasesFromLangTracer } from '../langtracer/provider';
export async function loadTestCases(
args: CliArgs,
logger: EvalLogger,
): Promise<WorkflowTestCaseWithFile[]> {
if (args.source === 'langtracer') {
if (!args.suite) throw new Error('--source langtracer requires --suite <slug>');
return await loadTestCasesFromLangTracer({
suite: args.suite,
filter: args.filter,
exclude: args.exclude,
tier: args.tier,
logger,
});
}
return loadWorkflowTestCasesWithFiles(args.filter, args.exclude, args.tier);
}