Documentation
¶
Overview ¶
Package models lists available Grok CLI models from on-disk files only (~/.grok/config.toml and models_cache.json). It does not spawn `grok models`.
Index ¶
Constants ¶
View Source
const ( // DefaultConfigFile is the Grok home config name. DefaultConfigFile = "config.toml" // ModelsCacheFile is the Grok home models cache name. ModelsCacheFile = "models_cache.json" )
Variables ¶
This section is empty.
Functions ¶
func DefaultHome ¶
func DefaultHome() string
DefaultHome returns $GROK_HOME when set, otherwise $HOME/.grok. Empty HOME falls back to a temp-dir based path (same idea as agenttty.GrokHome).
func FormatJSON ¶ added in v0.0.184
FormatJSON returns indented Catalog JSON for CLI --json output.
func FormatText ¶ added in v0.0.184
FormatText returns a human-readable catalog listing. The configured default model is marked with a leading "* ".
Types ¶
type Catalog ¶
type Catalog struct {
// Home is the resolved Grok data directory used for the listing.
Home string `json:"home"`
// Default is [models].default from config.toml (empty when unset/missing).
Default string `json:"default,omitempty"`
// Models is the sorted unique union of config.toml [model."…"] keys and
// models_cache.json model ids. Empty when neither source yields ids.
Models []Model `json:"models"`
// FromConfig is true when config.toml was read successfully.
FromConfig bool `json:"from_config"`
// FromCache is true when models_cache.json was read successfully.
FromCache bool `json:"from_cache"`
}
Catalog is the merged file-backed model list for a Grok home.
type Model ¶ added in v0.0.185
type Model struct {
// ID is the model id passed to grok.
ID string `json:"id"`
// Source is the basename of the file that primarily contributed this id
// (config.toml preferred over models_cache.json when both list it).
Source string `json:"source"`
// DisplayName is config `name` when set, else cache info.name.
DisplayName string `json:"display_name,omitempty"`
}
Model is one selectable Grok model in the unified CLI JSON shape.
Click to show internal directories.
Click to hide internal directories.