Documentation
¶
Overview ¶
Package evals provides an evaluation framework for testing agent quality.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccuracyEval ¶
AccuracyEval uses an LLM judge to score the accuracy of agent output against expected output.
func (*AccuracyEval) Name ¶
func (e *AccuracyEval) Name() string
func (*AccuracyEval) Run ¶
func (e *AccuracyEval) Run(ctx context.Context, actual, expected string) EvalResult
type ContainsEval ¶
type ContainsEval struct {
EvalName string
}
ContainsEval checks if the input contains the expected substring.
func (*ContainsEval) Name ¶
func (e *ContainsEval) Name() string
func (*ContainsEval) Run ¶
func (e *ContainsEval) Run(_ context.Context, input, expected string) EvalResult
type Eval ¶
type Eval interface {
// Name returns a human-readable name for this eval.
Name() string
// Run executes the evaluation and returns a result.
Run(ctx context.Context, input string, expected string) EvalResult
}
Eval defines a single evaluation case.
type EvalResult ¶
type EvalResult struct {
Name string `json:"name"`
Score float64 `json:"score"`
Passed bool `json:"passed"`
Details string `json:"details"`
Latency time.Duration `json:"latency"`
TokensUsed int `json:"tokens_used,omitempty"`
Error string `json:"error,omitempty"`
}
EvalResult captures the outcome of a single evaluation.
type ExactMatchEval ¶
type ExactMatchEval struct {
EvalName string
}
ExactMatchEval checks if the agent output exactly matches the expected output.
func (*ExactMatchEval) Name ¶
func (e *ExactMatchEval) Name() string
func (*ExactMatchEval) Run ¶
func (e *ExactMatchEval) Run(_ context.Context, input, expected string) EvalResult
type PerformanceBaseline ¶
PerformanceBaseline defines expected performance thresholds.
type PerformanceEval ¶
type PerformanceEval struct {
EvalName string
RunFunc func(ctx context.Context) (latency time.Duration, promptTokens int, completionTokens int, err error)
Baseline *PerformanceBaseline
}
PerformanceEval measures execution latency and token usage, comparing against optional baselines.
func (*PerformanceEval) Name ¶
func (e *PerformanceEval) Name() string
func (*PerformanceEval) Run ¶
func (e *PerformanceEval) Run(ctx context.Context, _, _ string) EvalResult
type ReliabilityEval ¶
type ReliabilityEval struct {
EvalName string
ActualCalls []ToolCallExpectation
ExpectedCalls []ToolCallExpectation
}
ReliabilityEval verifies the agent made correct tool calls in the correct order.
func (*ReliabilityEval) Name ¶
func (e *ReliabilityEval) Name() string
func (*ReliabilityEval) Run ¶
func (e *ReliabilityEval) Run(_ context.Context, _, _ string) EvalResult
type SuiteResult ¶
type SuiteResult struct {
SuiteName string `json:"suite_name"`
Results []EvalResult `json:"results"`
TotalEvals int `json:"total_evals"`
Passed int `json:"passed"`
Failed int `json:"failed"`
Errors int `json:"errors"`
AvgScore float64 `json:"avg_score"`
TotalLatency time.Duration `json:"total_latency"`
}
SuiteResult aggregates results from running a suite.
func (*SuiteResult) Summary ¶
func (sr *SuiteResult) Summary() string
Summary returns a human-readable summary of the suite results.
type ToolCallExpectation ¶
ToolCallExpectation defines an expected tool call.