MCPcopy
hub / github.com/promptfoo/promptfoo / appendRunEvalOptionsForTestCase

Function appendRunEvalOptionsForTestCase

src/evaluator.ts:2353–2415  ·  view source on GitHub ↗
({
  concurrency,
  conversations,
  evalId,
  nextTestIdx,
  options,
  promptIdCache,
  promptIndexMap,
  providerAbortSignal,
  rateLimitRegistry,
  registers,
  runEvalOptions,
  testCase,
  testSuite,
}: {
  concurrency: number;
  conversations: EvalConversations;
  evalId: string;
  nextTestIdx: number;
  options: InternalEvaluateOptions;
  promptIdCache: Map<Prompt, string>;
  promptIndexMap: Map<string, number>;
  providerAbortSignal?: AbortSignal;
  rateLimitRegistry?: RateLimitRegistryRef;
  registers: EvalRegisters;
  runEvalOptions: RunEvalOptions[];
  testCase: AtomicTestCase;
  testSuite: TestSuite;
})

Source from the content-addressed store, hash-verified

2351}
2352
2353function appendRunEvalOptionsForTestCase({
2354 concurrency,
2355 conversations,
2356 evalId,
2357 nextTestIdx,
2358 options,
2359 promptIdCache,
2360 promptIndexMap,
2361 providerAbortSignal,
2362 rateLimitRegistry,
2363 registers,
2364 runEvalOptions,
2365 testCase,
2366 testSuite,
2367}: {
2368 concurrency: number;
2369 conversations: EvalConversations;
2370 evalId: string;
2371 nextTestIdx: number;
2372 options: InternalEvaluateOptions;
2373 promptIdCache: Map<Prompt, string>;
2374 promptIndexMap: Map<string, number>;
2375 providerAbortSignal?: AbortSignal;
2376 rateLimitRegistry?: RateLimitRegistryRef;
2377 registers: EvalRegisters;
2378 runEvalOptions: RunEvalOptions[];
2379 testCase: AtomicTestCase;
2380 testSuite: TestSuite;
2381}) {
2382 const promptPrefix = testCase.options?.prefix || getDefaultTest(testSuite)?.options?.prefix || '';
2383 const promptSuffix = testCase.options?.suffix || getDefaultTest(testSuite)?.options?.suffix || '';
2384 const varCombinations =
2385 getEnvBool('PROMPTFOO_DISABLE_VAR_EXPANSION') || testCase.options?.disableVarExpansion
2386 ? [testCase.vars]
2387 : generateVarCombinations(testCase.vars || {});
2388
2389 for (let repeatIndex = 0; repeatIndex < (options.repeat || 1); repeatIndex++) {
2390 for (const vars of varCombinations) {
2391 appendRunEvalOptionsForVars({
2392 concurrency,
2393 conversations,
2394 evalId,
2395 options,
2396 promptIdCache,
2397 promptIndexMap,
2398 promptPrefix,
2399 promptSuffix,
2400 providerAbortSignal,
2401 rateLimitRegistry,
2402 registers,
2403 repeatIndex,
2404 runEvalOptions,
2405 testCase,
2406 testIdx: nextTestIdx,
2407 testSuite,
2408 vars,
2409 });
2410 nextTestIdx++;

Callers 1

buildRunEvalOptionsFunction · 0.85

Calls 4

getEnvBoolFunction · 0.90
getDefaultTestFunction · 0.85
generateVarCombinationsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…