Skip to contents

complete_trial() copies the scores, token use, cost and timing of an evaluation from eval_program() into a trial record and marks it "completed".

Usage

complete_trial(trial, eval_result, compiled_artifact_ref = NULL, notes = NULL)

Arguments

trial

A trial record from create_trial().

eval_result

The EvalResult returned by eval_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 as best_program.rds.

notes

Optional note that replaces the trial's note.

Value

The updated trial record, with status "completed".

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)
} # }