Documentation
¶
Overview ¶
Package evals holds the pieces of the agent-test-suite ("evals") feature that do not need the database or a live target: the `.lectern/evals/*.yaml` suite format and its parsing/validation, and pure result-aggregation math (leaderboards, run comparison) that the API layer feeds real rows into.
See docs/evals.md for the on-disk YAML format this package reads.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CaseComparison ¶
type CaseComparison struct {
CaseID int64 `json:"case_id"`
PassRateA float64 `json:"pass_rate_a"`
PassRateB float64 `json:"pass_rate_b"`
Delta float64 `json:"delta"` // B - A
Status string `json:"status"`
}
CaseComparison is one row of a two-run diff: how a case's pass rate moved.
func CompareRuns ¶
func CompareRuns(a, b []*store.EvalResult) []CaseComparison
CompareRuns diffs two runs' pass rates case by case (matched by case_id, which is stable across runs of the same suite). A case present in only one run is skipped — there is nothing to diff against.
type VariantStats ¶
type VariantStats struct {
VariantIdx int `json:"variant_idx"`
Total int `json:"total"`
Passed int `json:"passed"`
Failed int `json:"failed"`
Errored int `json:"errored"`
PassRate float64 `json:"pass_rate"`
MeanDurationS float64 `json:"mean_duration_s"`
TotalCostUSD float64 `json:"total_cost_usd"`
MeanInputTokens float64 `json:"mean_input_tokens"`
MeanOutputTokens float64 `json:"mean_output_tokens"`
MeanSimilarityFiles float64 `json:"mean_similarity_files"`
MeanSimilarityLines float64 `json:"mean_similarity_lines"`
MeanSizeRatio float64 `json:"mean_size_ratio"`
ScoredCount int `json:"scored_count"`
JudgeMatchRate float64 `json:"judge_match_rate"`
JudgedCount int `json:"judged_count"`
// CostPerPass (docs/outcomes.md) is TotalCostUSD / Passed — this
// variant's total spend divided by how many cells actually passed, so a
// cheap variant that mostly fails does not look efficient. Omitted (zero
// value) when nothing passed, so the UI can render "—" instead of a
// divide-by-zero artifact.
CostPerPass float64 `json:"cost_per_pass,omitempty"`
}
VariantStats is one row of a run's per-variant leaderboard.
The MeanSimilarity*/MeanSizeRatio/JudgeMatchRate fields are replay-eval columns (docs/replay-evals.md): they average only over cells that actually carry a score (a replay case's cell that reached a terminal status past "error"/"timeout" — see gradeEvalResult), so a suite mixing ordinary and replay cases, or a run still in flight, doesn't get diluted by cells with nothing to average. JudgeMatchRate is likewise a fraction of only the cells a judge actually finished (JudgedCount), not of Total — the judge is optional and runs asynchronously after grading.
func Leaderboard ¶
func Leaderboard(results []*store.EvalResult) []VariantStats
Leaderboard aggregates a run's results per variant, ordered by variant index — the same order the dispatched variants array used, so row N of the leaderboard is row N of whatever variant list the run was created with.
type YAMLCase ¶
type YAMLCase struct {
Name string `yaml:"name"`
Prompt string `yaml:"prompt"`
BaseRef string `yaml:"base_ref"`
CheckCommand string `yaml:"check_command"`
TimeoutS int `yaml:"timeout_s"`
SetupCommand string `yaml:"setup_command"`
}
YAMLCase is one case as written in a suite file. Field names match store.EvalCase's JSON tags so a hand-written case and one round-tripped through the API look the same.
type YAMLSuite ¶
type YAMLSuite struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
Cases []YAMLCase `yaml:"cases"`
}
YAMLSuite is a whole `.lectern/evals/*.yaml` file.
func ParseSuite ¶
ParseSuite parses and validates one suite file's bytes. It never returns a suite with an empty name or a case missing its own name/prompt — the same two fields the UI form requires, so a YAML suite cannot end up looking different from a hand-built one.