OfflineTestsFactory
Create test configs and execute offline test runs. Access via `client.offlineTests`. A *test config* pairs a dataset with a set of platform judges; a *test run* evaluates one dataset version and stores per-example results.
const config = await client.offlineTests.createConfig("nightly", "golden-set", [
"helpfulness",
"faithfulness",
]);
const result = await client.offlineTests.run("nightly");
console.log(result?.uiResultsUrl);
createConfig()
Create a test config binding a dataset to a set of judges.
async function createConfig(name: string, dataset: string, judges: JudgeRef[], description?: string | undefined): Promise<TestConfig | null>
Parameters
namestring
Name for the test config.
stringdatasetstring
Dataset name or dataset id.
stringjudgesJudgeRef[]
Judges to attach (judge names, or { judgeId } / { name }).
JudgeRef[]description?string | undefined
Optional human-readable description.
string | undefinedReturns
Promise<TestConfig | null>
getConfig()
Fetch a test config by id (UUID) or name.
async function getConfig(testConfig: string): Promise<TestConfig | null>
Parameters
testConfigstring
stringReturns
Promise<TestConfig | null>
listConfigs()
List test configs in the project, optionally filtered to one dataset.
async function listConfigs(datasetId?: string | undefined): Promise<TestConfig[] | null>
Parameters
datasetId?string | undefined
string | undefinedReturns
Promise<TestConfig[] | null>
deleteConfig()
Delete a test config by id. Returns false if the project is unresolved.
async function deleteConfig(testConfigId: string): Promise<boolean>
Parameters
testConfigIdstring
stringReturns
Promise<boolean>
run()
Run an offline test for a test config.
Without agentFunction, the judges score each example’s existing trace.
With agentFunction, the agent runs once per example first and the judges
score the resulting agent trace.
async function run(testConfig: string | TestConfig, options: OfflineRunOptions = {}): Promise<OfflineTestResult | null>
Parameters
testConfigstring | TestConfig
Test config name, id, or TestConfig object.
string | TestConfigoptions?OfflineRunOptions
Run options (agent function, judge versions, dataset version, pass condition, assert, timeout).
OfflineRunOptions{}Returns
Promise<OfflineTestResult | null>