Summarizes token and outcome diagnostics recorded by panel_administer() or
panel_batch_fetch(). The diagnostics are stored in the usage
field of a panel_responses object and summarized by LLMR::llm_usage().
Model and provider remain in the returned frame. A supplied price_table
adds a cost column. The package contains no price table. When the runner
records per-call duration, its sum is returned as duration_s.
Arguments
- responses
A
panel_administer()result.- price_table
Optional price table passed to
LLMR::llm_usage().
Value
A one-row usage tibble, or a typed empty tibble when the runner returned no recorded usage fields.
Examples
panel <- panel_from_margins(list(group = c(A = 1)), n = 2)
instrument <- panel_instrument(
item_choice("pick", "Choose one.", c("A", "B")),
randomize = character(0))
config <- LLMR::llm_config("groq", "example-model")
runner <- function(experiments, ...) {
experiments$response_text <- "A"
experiments$sent_tokens <- 4L
experiments$rec_tokens <- 1L
experiments$total_tokens <- 5L
experiments$success <- TRUE
experiments
}
responses <- panel_administer(panel, instrument, config, .runner = runner)
panel_usage(responses)