Converts dsprrr cost summaries, trace data, or session costs into a
tibble matching the format returned by vitals vitals::Task$get_cost().
This enables consistent cost reporting across dsprrr and vitals workflows.
Arguments
- x
A dsprrr cost object. Can be:
A
dsprrr_cost_summary(fromget_cost())A
dsprrr_session_cost(fromsession_cost())A tibble of traces (from
export_traces())A
dsprrr_evaluationresult (fromevaluate())
- source
Character string identifying the source of costs. Defaults to
"solver"to match vitals convention.- ...
Additional arguments (currently unused).
Value
A tibble with columns matching vitals cost format:
source: Character, either "solver" or "scorer"provider: Character, the API provider namemodel: Character, the model nameinput: Integer, input token countoutput: Integer, output token countprice: Character, formatted cost string (e.g., "$0.01")
Examples
if (FALSE) { # \dontrun{
# From session cost
as_vitals_cost(session_cost())
# From evaluation result
eval_result <- evaluate(mod, test_data, metric = metric_exact_match())
as_vitals_cost(eval_result)
# From module traces
traces <- export_traces(my_module)
as_vitals_cost(traces)
} # }
