mirror of
https://github.com/lukaszraczylo/llm-testbench.git
synced 2026-10-15 01:07:26 +00:00
feat: LLM accuracy testing framework with 17-test catalog
Framework runs a category/subcategory test catalog against multiple LLMs through an OpenAI-compatible endpoint. Deterministic evaluators score each response. Reports render as table, markdown, or JSON.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package eval
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestEquals(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
want string
|
||||
response string
|
||||
wantVal float64
|
||||
}{
|
||||
{"exact match", "patch", "patch", 1},
|
||||
{"case insensitive", "PATCH", "patch", 1},
|
||||
{"trimmed whitespace", "patch", " patch\n", 1},
|
||||
{"mismatch", "patch", "minor", 0},
|
||||
{"substring is not equal", "patch", "patch bump", 0},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got := Equals(tt.want).Evaluate(context.Background(), tt.response)
|
||||
if got.Value != tt.wantVal {
|
||||
t.Errorf("Equals(%q).Evaluate(%q) = %v, want %v", tt.want, tt.response, got.Value, tt.wantVal)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user