Skip to content

Runner

Runner module for executing batch evaluation workflows.

This module provides runner classes that orchestrate the execution of evaluation workflows, handling batch processing, async operations, and result collection. Runners coordinate between datasets, evaluators, and experiment trackers to perform comprehensive evaluations.

Components: - BaseRunner: Abstract base class for all runners - Runner: Main runner implementation for batch evaluation execution

BaseRunner(data, evaluators, experiment_tracker=None, batch_size=10, **kwargs)

Bases: ABC

Abstract class for runner.

This class defines the interface for all runner. Input data must already contain model outputs (e.g. actual_output).

Attributes:

Name Type Description
data str | BaseDataset

The data to evaluate.

evaluators list[BaseEvaluator]

The evaluators to use.

experiment_tracker BaseExperimentTracker | None

The experiment tracker.

batch_size int

The batch size to use for evaluation.

Initialize the runner.

Parameters:

Name Type Description Default
data str | BaseDataset

The data to evaluate. Must contain model outputs.

required
evaluators list[BaseEvaluator]

The evaluators to use.

required
experiment_tracker BaseExperimentTracker | None

The experiment tracker.

None
batch_size int

The batch size to use for evaluation.

10
**kwargs Any

Additional configuration parameters.

{}

evaluate() abstractmethod async

Run the evaluator on the dataset.

The dataset is evaluated in batches of the given batch size.

Returns:

Name Type Description
ExperimentResult ExperimentResult

Structured result containing evaluation results and experiment URLs/paths.

Runner(data, evaluators, experiment_tracker=None, batch_size=10, run_aggregators=None, **kwargs)

Bases: BaseRunner

Runner class for evaluating datasets.

Input data must already contain model outputs (e.g. actual_output). The runner does not perform live model inference.

Attributes:

Name Type Description
data str | BaseDataset

The data to evaluate.

evaluators list[BaseEvaluator]

The evaluators to use.

experiment_tracker ExperimentTrackerAdapter | type[BaseExperimentTracker] | None

The experiment tracker for logging evaluation results. Can be: - None: Uses CSVExperimentTracker (default) - A tracker class: Will be instantiated with provided kwargs - A tracker instance: Will be used directly

**kwargs ExperimentTrackerAdapter | type[BaseExperimentTracker] | None

Additional configuration parameters.

Initialize the Runner.

Parameters:

Name Type Description Default
data str | BaseDataset

The data to evaluate. Must contain model outputs.

required
evaluators list[BaseEvaluator]

The evaluators to use.

required
experiment_tracker BaseExperimentTracker | type[BaseExperimentTracker] | None

The experiment tracker for logging evaluation results. Can be: - None: Uses CSVExperimentTracker (default) - A tracker class: Will be instantiated with provided kwargs - A tracker instance: Will be used directly Defaults to None.

None
batch_size int

The batch size to use for evaluation (runner-level chunking for memory management).

10
run_aggregators list[RunAggregatorCallable] | None

Custom run aggregators to compute batch-level statistics. Each callable receives (evaluation_results, data) and returns a dict of summary metrics. Defaults to None.

None
**kwargs Any

Additional configuration parameters.

{}

Raises:

Type Description
TypeError

If allow_batch_evaluation or skip_on_missing_fields is passed.

evaluate() async

Run the evaluators on the dataset.

The dataset is evaluated using the following flow: 1. Convert dataset to standard format 2. Evaluate each batch 3. Log each batch to the tracker

Returns:

Name Type Description
ExperimentResult ExperimentResult

Structured result containing evaluation results and experiment URLs/paths.

Raises:

Type Description
EvalInputError

If the dataset is empty, a test case has the wrong type, or required fields are missing. Raised before any metric runs.

EvalConfigurationError

If a threshold is invalid, a judge is not configured, or the tracker cannot log the test case type. Raised before any metric runs.

BaseError

A normalized error for a failure outside evaluator fault isolation, such as dataset preparation, judge configuration or tracker logging. A row failure that only that row has does not raise: it becomes a failure result keyed by the evaluator's name.

get_run_results(**kwargs)

Get the results of a run.

Parameters:

Name Type Description Default
**kwargs Any

Additional configuration parameters.

{}

Returns:

Type Description
list[dict[str, Any]]

list[dict[str, Any]]: The results of the run.