diff --git a/pkg/inference/models/api.go b/pkg/inference/models/api.go index c764d483..1dc9c4fa 100644 --- a/pkg/inference/models/api.go +++ b/pkg/inference/models/api.go @@ -82,11 +82,26 @@ func ToOpenAI(m types.Model) (*OpenAIModel, error) { id = tags[0] } + config, err := m.Config() + if err != nil { + return nil, fmt.Errorf("get config: %w", err) + } + + var contextWindow int32 + if cw := config.GetContextSize(); cw != nil { + contextWindow = *cw + } + return &OpenAIModel{ - ID: id, - Object: "model", - Created: created, - OwnedBy: "docker", + ID: id, + Object: "model", + Created: created, + OwnedBy: "docker", + ContextWindow: contextWindow, + Architecture: config.GetArchitecture(), + Parameters: config.GetParameters(), + Quantization: config.GetQuantization(), + Size: config.GetSize(), }, nil } @@ -100,6 +115,13 @@ type OpenAIModel struct { Created int64 `json:"created"` // OwnedBy is the model owner. At the moment, it is always "docker". OwnedBy string `json:"owned_by"` + + // Additional metadata + ContextWindow int32 `json:"context_window,omitempty"` + Architecture string `json:"architecture,omitempty"` + Parameters string `json:"parameters,omitempty"` + Quantization string `json:"quantization,omitempty"` + Size string `json:"size,omitempty"` } // OpenAIModelList represents a list of models using OpenAI conventions.