Turns one parsed log record (the rec element of a llm_log_read() entry)
back into the config and messages an experiments row needs, so an archived
call can be re-issued live or matched against a config-driven call. The
provider-specific request body is canonicalized to provider-neutral
role/content turns and its generation parameters are recovered onto a
reconstructed llm_config().
Usage
llm_request_from_log(record, on_unsupported = c("error", "warn", "quiet"))Arguments
- record
A parsed log record: a list with at least
provider,model, andrequest(as found inllm_log_read(x)$records[[i]]$rec).- on_unsupported
What to do when the request body uses a shape this reconstructor does not cover (so the rebuilt messages would be empty or lossy) – chiefly the OpenAI Responses API (
input/instructions) and non-text content blocks (images, files)."error"(default) aborts;"warn"warns and returns the best-effort result;"quiet"returns it silently. Failing loudly is the default because a silently empty replay is worse than none.
Value
A list with config (an llm_config()), messages (a named
character vector of role/content turns), and complete (a logical: TRUE
when the body was fully reconstructed, FALSE when content was dropped).
NULL when the record carries no request body.