Package dev.dokimos.core
Class Experiment.Builder
java.lang.Object
dev.dokimos.core.Experiment.Builder
- Enclosing class:
Experiment
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the experiment.Sets the dataset.description(String description) Sets the description.Adds a single evaluator to the experiment.evaluators(List<Evaluator> evaluators) Adds multiple evaluators to the experiment.Adds a metadata entry to the experiment.Adds multiple metadata entries to the experiment.Sets the experiment name.parallelism(int parallelism) Sets the level of parallelism for running the experiment.Sets the reporter for this experiment.runs(int runs) Sets the number of times to run the experiment.Sets the task.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
name
Sets the experiment name.- Parameters:
name- the experiment name- Returns:
- this builder
-
description
Sets the description.- Parameters:
description- The experiment's description.- Returns:
- builder
-
dataset
Sets the dataset.- Parameters:
dataset- The dataset to use for the experiment.- Returns:
- builder
-
task
Sets the task.- Parameters:
task- The task to generate outputs from examples.- Returns:
- builder
-
evaluator
Adds a single evaluator to the experiment.- Parameters:
evaluator- The evaluator to add.- Returns:
- builder
-
evaluators
Adds multiple evaluators to the experiment.- Parameters:
evaluators- The list of evaluators to add.- Returns:
- builder
-
metadata
Adds a metadata entry to the experiment.- Parameters:
key- The metadata key.value- The metadata value.- Returns:
- builder
-
metadata
Adds multiple metadata entries to the experiment.- Parameters:
metadata- The map of metadata entries to add.- Returns:
- builder
-
reporter
Sets the reporter for this experiment.The reporter is called during experiment execution to report results to an external system. If not set, a no-op reporter is used.
- Parameters:
reporter- the reporter to use- Returns:
- builder
-
parallelism
Sets the level of parallelism for running the experiment.When parallelism is greater than 1, examples within each run are processed concurrently using a fixed thread pool. Default is 1 for sequential execution.
Ensure your task implementation is thread-safe when using parallelism.
- Parameters:
parallelism- the number of examples to process in parallel, must be at least 1- Returns:
- builder
- Throws:
IllegalArgumentException- if parallelism is less than 1
-
runs
Sets the number of times to run the experiment.Running an experiment multiple times helps reduce variance from LLM non-determinism and provides statistical confidence in the results. Results are automatically aggregated across runs.
Runs execute sequentially while parallelism applies within each run.
- Parameters:
runs- the number of experiment runs, must be at least 1- Returns:
- builder
- Throws:
IllegalArgumentException- if runs is less than 1
-
build
Builds the experiment.- Returns:
- a new experiment
- Throws:
IllegalStateException- if dataset or task is not set
-