File size: 660 Bytes
a0ebf39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { resolveModel } from '@/lib/server/resolve-model';

/**
 * Resolve a model for an eval runner. Reads `process.env[envVar]`, falls back
 * to `fallback` if provided, and throws a clear error if neither is set.
 *
 * Never introduces a hardcoded default model string — evals must be explicit
 * about what they measure.
 */
export async function resolveEvalModel(envVar: string, fallback?: string) {
  const modelString = process.env[envVar] || fallback;
  if (!modelString) {
    throw new Error(
      `Eval model not configured: set ${envVar} in the environment (or pass an explicit fallback).`,
    );
  }
  return resolveModel({ modelString });
}