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
if (FALSE) { # \dontrun{
program <- module(signature("question -> answer"))
data <- data.frame(question = "2 + 2?", answer = "4")
result <- eval_program(
program,
data,
metric_exact_match(field = "answer"),
.llm = ellmer::chat_openai(model = "gpt-6-luna")
)
trial <- create_trial("my-search", params = list(variant = "baseline"))
complete_trial(trial, result, compiled_artifact_ref = program)
} # }