Skip to main content

Crate graphrt_eval

Crate graphrt_eval 

Source
Expand description

§graphrt-eval

Evaluate graphrt workflows against test cases, in CI or from cargo test.

  • EvalSuite: an eval file (*.eval.yaml, Promptfoo-shaped tests / assert / defaultTest) plus an optional JSONL dataset.
  • Runner: runs every case against a Target (usually an EngineTarget around one compiled graph), concurrently, and scores it.
  • assertion: deterministic output checks, latency and token budgets, agent trajectory checks and retrieval metrics, behind the Assertion trait so other crates can add types.
  • judge: LLM judges written as graphrt workflows (type: judge), compiled once through a judge::JudgeLoader and versioned by fingerprint.
  • stats: unbiased pass@k / pass^k over trials, and judge agreement (TPR, TNR, Cohen’s kappa) for calibration suites.
  • online: evaluators that score a sample of production runs in graphrt serve (no expected answers: judges, regexes, schemas, budgets, trajectories), with deterministic per-run sampling and filters.
  • EvalReport: the summary, the gate verdict, the baseline comparison, and JSON / JUnit output.

The harness is not part of the engine: it only consumes the run’s event stream, so runs evaluated here behave exactly like production runs.

use graphrt_eval::{EngineTarget, EvalSuite, Runner, RunnerOptions};

let suite = EvalSuite::load(std::path::Path::new("evals/hello.eval.yaml"))?;
let report = Runner::new(RunnerOptions::default())
    .run(&suite, &EngineTarget::new(engine), |result| eprintln!("{}", graphrt_eval::report::format_result_line(result)))
    .await?;
assert!(report.gate_passed(), "{}", graphrt_eval::report::format_summary(&report));

Re-exports§

pub use assertion::Assertion;
pub use assertion::AssertionContext;
pub use assertion::AssertionRegistry;
pub use assertion::AssertionResult;
pub use assertion::Outcome;
pub use capture::RetrievalHit;
pub use capture::RunCapture;
pub use capture::RunStatus;
pub use capture::ToolCallRecord;
pub use config::AssertionSpec;
pub use config::Calibration;
pub use config::EvalSuite;
pub use config::Gate;
pub use config::TestCase;
pub use config::Tolerance;
pub use error::EvalError;
pub use judge::JudgeLoader;
pub use judge::Verdict;
pub use report::EvalReport;
pub use report::Summary;
pub use report::TestResult;
pub use report::TestStatus;
pub use runner::EngineTarget;
pub use runner::Runner;
pub use runner::RunnerOptions;
pub use runner::Target;

Modules§

assertion
Assertions: the Assertion trait, the registry of assertion types and the built-in deterministic types.
baseline
Comparing a report with a baseline (an earlier --output file).
calibration
Judge calibration: an eval whose workflow is a judge and whose expected values are human labels. Every result is one (judge verdict, label) pair; the report adds the confusion matrix, raw agreement, TPR, TNR and Cohen’s kappa (raw agreement alone flatters a judge on imbalanced labels).
capture
What one run of the system under test produced, and the views assertions read from it: the output, the tool-call trajectory and retrieval hits.
config
The eval file format (*.eval.yaml) and JSONL datasets.
error
Errors raised while loading or running an evaluation.
judge
LLM judges written as ordinary graphrt workflows.
online
Online evaluation: score a sample of production runs after they finish.
path
Dotted JSON paths (output.items[0].name) and {{ var }} substitution in assertion values. No JavaScript: a path is identifiers, . and [index].
report
Results: per-test results, the suite summary and gate, and the JSON, JUnit XML and terminal renderings.
runner
Running a suite: the Target under test, concurrency, trials, filters, scoring, trial statistics, calibration and the gate.
schema
JSON Schema of eval files, published as schema/eval-v1.schema.json.
stats
Statistics over repeated trials and judge calibration.