32 lines
1.5 KiB
Go
32 lines
1.5 KiB
Go
package rankingcapability
|
|
|
|
import "testing"
|
|
|
|
func TestScoringRequiresKnownStructuredModelAndAdapter(t *testing.T) {
|
|
for _, tc := range []struct {
|
|
provider, model, endpoint string
|
|
want bool
|
|
}{{"openai", "gpt-4o-mini", "", true}, {"openai", "gpt-4o-mini-2024-07-18", "", true}, {"openai", "unknown-model", "", false}, {"ollama", "llama3", "http://ollama:11434", true}, {"ollama", "unknown-model", "http://ollama:11434", false}, {"ollama", "llama3", "https://ollama.com", false}, {"anthropic", "claude-sonnet-4-6", "", false}, {"gemini", "gemini-2.5-flash", "", false}, {"claudecode", "claude-sonnet-4-6", "", false}, {"other", "gpt-4o-mini", "", false}} {
|
|
c := Lookup(tc.provider, tc.model, tc.endpoint)
|
|
if c.Selectable != tc.want || (!tc.want && c.Reason == "") || (tc.want && c.Mode != "json_schema") {
|
|
t.Fatalf("%+v => %+v", tc, c)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestTicket58ExactOpenAITerraCapability(t *testing.T) {
|
|
for _, tc := range []struct {
|
|
provider, model string
|
|
want bool
|
|
}{
|
|
{"openai", "gpt-6.1-terra", true}, {"openai", "gpt-6.1-terra-latest", false}, {"openai", "unknown-model", false}, {"ollama", "gpt-6.1-terra", false}, {"anthropic", "gpt-6.1-terra", false}, {"other", "gpt-6.1-terra", false},
|
|
} {
|
|
t.Run(tc.provider+"/"+tc.model, func(t *testing.T) {
|
|
got := Lookup(tc.provider, tc.model, "")
|
|
if got.Selectable != tc.want || (tc.want && got.Mode != "json_schema") || (!tc.want && got.Reason != "ranking_structured_output_unsupported") {
|
|
t.Fatalf("capability=%+v want selectable=%v", got, tc.want)
|
|
}
|
|
})
|
|
}
|
|
}
|