Asks Claude Code each question in a session restricted to the package's
MCP server, and checks the tool calls of the model against the answers of
the case. Needs the claude CLI, logged in: each run of a case costs one
request. When ANTHROPIC_API_KEY is set, as in CI, the session runs with
--bare: it leaves out the developer's CLAUDE.md, memory, hooks and
plugins, so that the results do not depend on the machine.
Usage
run_evals(cases, runs = 1, mordew_wd = get_mordew_wd())Arguments
- cases
A list of
eval_case().- runs
Number of times to ask each case: the model does not always answer the same way.
- mordew_wd
Path to the package,
get_mordew_wd()by default.
Value
A data frame with one row per run of a case: question, run,
passed, the tool calls of the model, their number n_calls, and
too_many_calls, TRUE when the model made more calls than the longest
answer of the case.
Examples
if (FALSE) { # \dontrun{
# In the folder of a package made by create_mordew(), with Claude Code:
results <- run_evals(
list(
eval_case(
"Show me my long runs in 2024.",
tool_call(
"get_runs",
year = 2024,
type = "long"
)
)
),
runs = 5
)
assert_pass_rate(
results
)
} # }