Skip to main content
Looking for the short path? galtea.evaluations.run() runs a whole evaluation in one call and is what most workflows should use — see Specification-Driven Evaluations. This page teaches the manual loop on purpose, for the cases where you need to control each test case yourself.
This page teaches the manual loop because it is the workflow that gives you per-test-case control: you decide what to send your product, what output to log, and which metrics score it. To evaluate a product version against a predefined Dataset, you can loop through its Test Cases and run an evaluation for each one. This workflow is ideal for regression testing and standardized quality checks.
A session is created implicitly the first time you run an evaluation for a specific version_id and dataset_id combination. You do not need to create it manually.

Workflow

1

Select a Dataset and Version

Identify the dataset_id and version_id you want to evaluate.
2

Iterate Through Test Cases

Fetch all test cases associated with the dataset using galtea.test_cases.list().
3

Generate and Evaluate Output

For each test case, call your product to get its output, create a session with galtea.sessions.create(), then use galtea.traces.create_and_evaluate() to log and evaluate the result.

Example

This example demonstrates how to run an evaluation on all test cases from a specific dataset.
A session is automatically created behind the scenes to link this version_id and dataset_id with the provided trace (the actual_output and the Test Case’s input).

Specification-Based Evaluation

Instead of passing metrics explicitly, you can evaluate against Specifications. Each specification has linked metrics that the API resolves automatically.
If you omit both metrics and specification_ids, the API falls back to all metrics from every specification linked to the product.

Next Steps

Specification-Driven Evaluations

Automate dataset resolution, agent execution, and evaluation with specifications.

Evaluating Conversations

Evaluate multi-turn conversations and production sessions.