mirror of
https://github.com/lukaszraczylo/llm-testbench.git
synced 2026-10-14 00:57:45 +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,31 @@
|
||||
package tests
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestWebRobotsAICrawlersTest_Eval(t *testing.T) {
|
||||
tc := webRobotsAICrawlersTest()
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
response string
|
||||
want float64
|
||||
}{
|
||||
{"correct: only ClaudeBot", `["ClaudeBot"]`, 1},
|
||||
{"correct fenced", "```json\n[\"ClaudeBot\"]\n```", 1},
|
||||
{"includes decoy Googlebot", `["ClaudeBot","Googlebot"]`, 0.5},
|
||||
{"includes disallowed GPTBot", `["ClaudeBot","GPTBot"]`, 0.5},
|
||||
{"empty answer", `[]`, 0},
|
||||
{"only wrong bots", `["GPTBot","PerplexityBot"]`, 0},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got := tc.Eval.Evaluate(context.Background(), tt.response)
|
||||
if got.Value != tt.want {
|
||||
t.Errorf("Eval.Evaluate(%q) = %v, want %v (detail: %s)", tt.response, got.Value, tt.want, got.Detail)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user