Derive provider from model ID
The provider is always the prefix before "/" in the model ID, so storing it as a separate field is redundant. Replace the field with a Provider() method. Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
committed by
Sacha Al Himdani
parent
adeef0d5cb
commit
481b56402a
@@ -24,7 +24,6 @@ type (
|
||||
ModelDefinition struct {
|
||||
ID string
|
||||
Name string
|
||||
Provider string
|
||||
ContextLength int
|
||||
MaxOutputTokens int
|
||||
Supports SupportedParameters
|
||||
@@ -89,6 +88,13 @@ func (r *Registry) Lookup(modelID string) (ModelDefinition, bool) {
|
||||
return ModelDefinition{}, false
|
||||
}
|
||||
|
||||
// Provider returns the provider prefix from the model ID (e.g. "anthropic"
|
||||
// from "anthropic/claude-opus-4.6").
|
||||
func (m *ModelDefinition) Provider() string {
|
||||
provider, _, _ := strings.Cut(m.ID, "/")
|
||||
return provider
|
||||
}
|
||||
|
||||
func (r *Registry) index(m *ModelDefinition) {
|
||||
r.byID[m.ID] = m
|
||||
|
||||
|
||||
Reference in New Issue
Block a user