fix(archied): stop flagging embedding and transcription aliases as retired models
This commit is contained in:
1 parent
02d4e162b8
commit
ab43c4e337
2 files changed
+38
No files matched your search
@@ -94,7 +94,13 @@ func modelAliasAlerts(aliases map[string]string, catalog modelcatalog.Snapshot)
|
||||
out = append(out, input(config.DefaultModelAlias, "No default model alias is set",
|
||||
"Set it to a model."))
|
||||
}
|
||||
chat := config.ChatAliases(aliases)
|
||||
for _, alias := range slices.Sorted(maps.Keys(aliases)) {
|
||||
// The catalogue lists tool-calling chat models only, so it cannot say
|
||||
// whether an embedding or transcription model still exists.
|
||||
if !slices.Contains(chat, alias) {
|
||||
continue
|
||||
}
|
||||
providerID, modelID, ok := strings.Cut(aliases[alias], "/")
|
||||
if !ok {
|
||||
continue
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package archied
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/modelcatalog"
|
||||
)
|
||||
|
||||
func TestModelAliasAlerts(t *testing.T) {
|
||||
catalog := modelcatalog.Snapshot{Providers: []modelcatalog.Provider{
|
||||
{ID: "openai", Models: []modelcatalog.Model{{ID: "gpt-5"}}},
|
||||
}}
|
||||
tests := []struct {
|
||||
name string
|
||||
aliases map[string]string
|
||||
want int
|
||||
}{
|
||||
{"offered chat model", map[string]string{"default": "openai/gpt-5"}, 0},
|
||||
{"retired chat model", map[string]string{"default": "openai/gpt-4"}, 1},
|
||||
// The catalogue lists tool-calling chat models only, so an embedding or
|
||||
// transcription model is never in it and must not read as retired.
|
||||
{"embedding model", map[string]string{"default": "openai/gpt-5", "embedding": "openai/text-embedding-3-small"}, 0},
|
||||
{"transcription model", map[string]string{"default": "openai/gpt-5", "transcription": "openai/whisper-1"}, 0},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := len(modelAliasAlerts(tt.aliases, catalog)); got != tt.want {
|
||||
t.Fatalf("alerts = %d, want %d", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user