complete_trial() copies the scores, token use, cost and timing of an
evaluation from eval_program() into a trial record and marks it
"completed".
Arguments
- trial
A trial record from
create_trial().- eval_result
The
EvalResultreturned byeval_program().- compiled_artifact_ref
Optional compiled program. When this trial is the best one in a TrialLog with a
log_dir, the log saves the program asbest_program.rds.- notes
Optional note that replaces the trial's note.
See also
Other optimizer building blocks:
TrialLog,
create_trial(),
eval_program(),
load_trial_log(),
optimizer_control(),
read_trials_jsonl(),
sample_dataset(),
split_dataset(),
write_trials_jsonl()
Examples
program <- module_fn("x -> answer", function(x) list(answer = toupper(x)))
data <- data.frame(x = c("a", "b"), answer = c("A", "B"))
result <- eval_program(program, data, metric_exact_match(field = "answer"))
trial <- create_trial("my-search", params = list(variant = "baseline"))
complete_trial(trial, result)
#>
#> ── Trial: trial_20261126_010952_ncnyz0
#> ✔ Status: completed
#> Optimizer: my-search
#> Params: variant
#> Score: 1
#> Started: 2026-11-26 01:09:52