The evaluation result from evaluate().
Aggregate scores averaged across all samples.
Per-sample detailed results.
Optionalstats?: Record<Per-metric score distribution statistics (min, max, stddev, count).
Keys are metric names (same as keys in scores, minus overall).
Useful for understanding score variance and identifying which questions
score poorly. overall is excluded — compute it from individual metric stats.
Metadata about the evaluation run.
Total number of samples evaluated.
Names of the metrics that were evaluated.
LLM provider used (e.g. 'anthropic', 'openai').
LLM model used (e.g. 'claude-opus-4-6').
ISO 8601 timestamp when evaluation started.
ISO 8601 timestamp when evaluation completed.
Wall-clock duration of the evaluation in milliseconds.
Score below which a sample is marked as failed. Default: 0.5.
JUnit XML string. Safe to write directly to a file.
import { evaluate, toJUnit } from 'rageval'
import { writeFileSync } from 'node:fs'
// In your CI pipeline:
const result = await evaluate({ ... })
writeFileSync('junit-results.xml', toJUnit(result))
// Then configure your CI to pick up junit-results.xml as a test report.
// GitHub Actions example:
// - uses: dorny/test-reporter@v1
// with:
// artifact: junit-results.xml
// name: RAG Quality Report
// reporter: java-junit
Serializes an EvaluationResult to JUnit XML format.
JUnit XML is the universal CI test report format — supported by GitHub Actions, GitLab CI, Jenkins, CircleCI, Azure DevOps, and almost every other CI system. Upload the XML file as a test artifact to visualize evaluation failures as failed tests directly in your CI dashboard.
Each sample becomes a
<testcase>. A sample "fails" when any metric score is below the providedfailureThreshold(default: 0.5). Failures appear as failed tests in your CI dashboard, making quality regressions immediately visible. Passing samples include their scores in<system-out>for traceability.