go.bigb.es/claudio
Index
- func CategorizeByProvider(models []OllamaModel, popularNames []string) ([]string, map[string][]OllamaModel)
- func CategorizeModels(models []OllamaModel) ([]string, map[string][]OllamaModel)
- func FetchModelDetails(models []OllamaModel, baseURL, apiKey, provKey string, sc ShowCache)
- func FetchPopularNames() ([]string, error)
- type ModelShowInfo
- type OllamaDetails
- type OllamaModel
- type ShowCache
Constants
const SeparatorCategory = "───"
Functions
func CategorizeByProvider(models []OllamaModel, popularNames []string) ([]string, map[string][]OllamaModel)
CategorizeByProvider groups models by provider for cloud instances. Models are grouped by company name extracted from the model name prefix. popularNames (from FetchPopularNames) determines the "Popular" category; models whose base name (before ":") matches a popular name are included, preserving the popularity order. The returned order is: Popular, separator, then provider groups alphabetically. Within each company, models are sorted by modified_at (newest first).
func CategorizeModels(models []OllamaModel) ([]string, map[string][]OllamaModel)
CategorizeModels groups models by family and returns ordered family names plus the grouped map.
func FetchModelDetails(models []OllamaModel, baseURL, apiKey, provKey string, sc ShowCache)
FetchModelDetails enriches models with context_length and capabilities from /api/show. It uses the cache to avoid re-fetching models whose ModifiedAt hasn't changed.
func FetchPopularNames() ([]string, error)
FetchPopularNames scrapes ollama.com/search?c=cloud for popular model names. Returns base names (e.g. "qwen3.5", "glm-5") in popularity order.
Types
type ModelShowInfo struct { ContextLength int Capabilities []string }
ModelShowInfo holds the fields extracted from /api/show.
func ShowModel(baseURL, apiKey, modelName string) (ModelShowInfo, error)
ShowModel calls /api/show to get detailed info for a single model.
type OllamaDetails struct { Family string `json:"family"` Families []string `json:"families"` ParameterSize string `json:"parameter_size"` QuantizationLvl string `json:"quantization_level"` }
OllamaDetails contains model metadata.
type OllamaModel struct { Name string `json:"name"` Model string `json:"model"` ModifiedAt string `json:"modified_at"` Size int64 `json:"size"` Details OllamaDetails `json:"details"` ContextLength int `json:"context_length,omitempty"` Capabilities []string `json:"capabilities,omitempty"` }
OllamaModel represents a model returned by the Ollama /api/tags endpoint.
func ListModels(baseURL, apiKey string) ([]OllamaModel, error)
ListModels fetches available models from an Ollama instance. baseURL is e.g. "http://localhost:11434" or "https://ollama.com". apiKey may be empty for local instances.
func (m OllamaModel) DisplayName() string
DisplayName returns a human-friendly label for the model.
func (m OllamaModel) Family() string
Family returns the model family for grouping.
func (m OllamaModel) Provider() string
Provider returns the provider/namespace for a model. For namespaced models ("namespace/model:tag") it returns the namespace; otherwise it falls back to the model family.
type ShowCache interface { GetOllamaModelInfo(provider, model string) (modifiedAt string, contextLength int, capabilities string, ok bool) SetOllamaModelInfo(provider, model, modifiedAt string, contextLength int, capabilities string) error }
ShowCache provides get/set for per-model /api/show info.
SeparatorCategory is a special category name rendered as a divider line.