Create and submit experiments to Gentrace with experiment()
experiment()
function creates a testing context for grouping related evaluations and tests. It manages the lifecycle of a Gentrace experiment, automatically starting and finishing the experiment while providing context for evaluation functions like eval()
/ evalOnce()
and evalDataset()
/ eval_dataset()
.
experiment()
function is designed to work with evaluation functions. To fully understand how to use experiments effectively, you should also review:eval()
/ evalOnce()
- For running individual test cases
evalDataset()
/ eval_dataset()
- For batch evaluation against datasets
These functions must be called within an experiment context to properly track and group your test results.
experiment()
function:
experiment()
function manages the experiment lifecycle automatically:
Start
Context
Execution
Finish
Error
objects (TypeScript) and exceptions (Python) are automatically captured as span eventsERROR
when unhandled exceptions occurinit()
with a valid API key. The SDK automatically configures OpenTelemetry for you. For custom OpenTelemetry setups, see the manual setup guideinit()
- Initialize the Gentrace SDKinteraction()
- Instrument AI functions for tracing within experimentsevalDataset()
/ eval_dataset()
- Run tests against a dataset within an experimentevalOnce()
/ eval()
- Run individual test cases within an experimenttraced()
- Alternative approach for tracing functions