Skip to main content
The test cases SDK provides programmatic access to Gentrace test cases. While commonly used with evalDataset() for batch evaluations, test cases can also be accessed and managed independently.

Basic usage

Overview

The SDK is built by Stainless and provides type-safe access to Gentrace entities. The testCases object exposes methods to list, create, update, and delete test cases.

Test case structure

Each test case contains:
id
string
Unique identifier
name
string
Human-readable name for the test case
inputs
object
required
Dictionary/object containing the input data for your AI function
expectedOutputs
object
Optional expected outputs for validation
datasetId
string
required
UUID of the dataset this test case belongs to
createdAt
string
required
Creation timestamp
updatedAt
string
required
Last update timestamp

Resource methods

Create a test case

Retrieve a test case

Delete a test case

List with filters

Common usage with evalDataset()

Test cases are frequently used with evalDataset() for running batch evaluations:
The interaction parameter should be a function wrapped with interaction() for proper OpenTelemetry tracing within experiments.

See also

  • evalDataset() - Common usage pattern for batch evaluations
  • Datasets - Managing datasets that contain test cases