Write unit tests for agents with eval()
and evalOnce()
eval()
and TypeScript evalOnce()
functions create individual test cases within an experiment()
. These functions capture the execution of specific test logic, automatically creating OpenTelemetry spans with detailed tracing information, and associating results with the parent experiment.
These functions must be called within the context of an experiment()
and automatically create individual test spans for each evaluation.
init()
. If you have an existing OpenTelemetry setup or need custom configuration, see the manual setup guide.eval()
and evalOnce()
functions provide comprehensive test execution capabilities:
eval()
or @eval()
-decorated functions as the output for each test spanERROR
status when exceptions occurinit()
with a valid API key. The SDK automatically configures OpenTelemetry for you. For custom OpenTelemetry setups, see the manual setup guideexperiment()
functioneval()
and evalOnce()
must be called within an active experiment context. They automatically:
experiment()
functioninit()
- Initialize the Gentrace SDKinteraction()
- Instrument AI functions for tracing within experimentsevalDataset()
/ eval_dataset()
- Run tests against a dataset within an experimentexperiment()
- Create experiment contexts for grouping evaluationstraced()
- Alternative approach for tracing functions