Configure models
Configure scorer models in viteval.config.ts. Choose your task model separately
inside the task function. No worker setup module is required.
Prerequisites
- Complete Getting started and keep a passing evaluation.
- Choose a model provider and have its API credentials available.
- This walkthrough uses OpenAI through the AI SDK.
Steps
Install a model provider
This example uses OpenAI through the AI SDK:
Provide OPENAI_API_KEY in the process environment before running evaluations.
Installing the SDK does not load credentials from an env file automatically.
Register scorer models
Add raw AI SDK providers and default model references to viteval.config.ts:
Use provider:model-id references for defaults. Deterministic scorers need no
model configuration. Registration does not make network requests.
Choose the task model
The default language model is the judge, not the task model. Call the client
you want to evaluate inside the task. Replace src/viteval.eval.ts with:
Override a judge when needed
Pass model to an LLM judge factory to use a different judge for that scorer.
Embedding factories do not support per-scorer model overrides.
Use factual instead of scorers.factual() in the evaluation's scorers array.
Viteval resolves defaults in each worker from the selected project config.
Verification
Confirm the task produces an answer and each scorer returns a numeric score. Model-based scores vary and the example is not guaranteed to pass its threshold. Use saved reports to inspect score metadata.
Troubleshooting
Missing model or authentication errors
Confirm models.providers and models.defaults are configured and OPENAI_API_KEY is
available to the evaluation process. A null score with error metadata indicates
a failed measurement, not a low-quality answer.
Use a different judge for one scorer
Use a factory's model override to change
one judge. Embedding factories do not accept per-scorer model overrides.