Documentation
¶
Overview ¶
Package llms is the file-backed LLM model registry behind the ##llm command. Each known model is ONE YAML file at
<rysh-dir>/llms/<provider>/<model-name>
e.g. .rysh/llms/anthropic/fable5 or .rysh/llms/openai/gpt55. The ##llm command lists ONLY what these files declare, activates one as the session default, and persists new declarations (##llm model add openai/gpt55). A first use seeds the folder with a starter set for anthropic, openai, grok, and gemini.
Index ¶
- Variables
- func ParseRef(ref string) (providerName, modelName string, err error)
- type ModelSpec
- type Store
- func (s *Store) Add(spec ModelSpec) (string, error)
- func (s *Store) Dir() string
- func (s *Store) Get(providerName, modelName string) (*ModelSpec, error)
- func (s *Store) List() (providers []string, byProvider map[string][]ModelSpec, err error)
- func (s *Store) Path(providerName, modelName string) string
- func (s *Store) SeedIfEmpty() error
- func (s *Store) SetDisabled(providerName, modelName string, disabled bool) (*ModelSpec, error)
Constants ¶
This section is empty.
Variables ¶
var ExecutableProviders = []string{"anthropic", "claude-cli", "gemini", "ollama", "openai"}
ExecutableProviders are the providers rysh can actually RUN a model on — the ones internal/provider builds a real agentic provider for. Everything else in the registry is a declaration for planning, selectable nowhere.
This was a single provider ("anthropic") for as long as the executor spoke only the Anthropic Messages API. It no longer does: design 002 added the OpenAI-compatible dialect (Ollama, and Gemini via its compat surface), and OpenAI proper now speaks the Responses API. Leaving the old value in place meant `##llm openai/gpt-4o` refused a model that `##pane model openai/gpt-4o` would happily run — the pane path never consulted this.
Kept as a local list rather than an import of internal/provider so this package stays a leaf; TestExecutableProvidersMatchProviderSelection pins the two against each other so they cannot drift.
Functions ¶
Types ¶
type ModelSpec ¶
type ModelSpec struct {
Provider string `yaml:"provider"`
Name string `yaml:"name"`
Model string `yaml:"model"` // provider API model id
Description string `yaml:"description,omitempty"`
MaxTokens int `yaml:"max_tokens,omitempty"`
// Effort is an optional default reasoning effort activated with the model
// (low|medium|high|xhigh|max — anthropic providers only).
Effort string `yaml:"effort,omitempty"`
Added string `yaml:"added,omitempty"` // YYYY-MM-DD, set on Add
// Disabled parks a model without deleting it: ##llm use and ##pane model
// refuse it, while ##llm list still shows it (marked) so it can be turned
// back on. Omitempty keeps every pre-existing file valid and enabled.
Disabled bool `yaml:"disabled,omitempty"`
}
ModelSpec is the YAML content of one model file. Name/Provider mirror the file's location (path is authoritative on read; the fields are filled in for callers).
func (ModelSpec) Executable ¶
Executable reports whether rysh's executor can run this model.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store reads and writes the registry under <rysh-dir>/llms.
func (*Store) Add ¶
Add persists a model file (creating the provider folder), returning its path. Overwrites an existing declaration for the same provider/name.
func (*Store) List ¶
List returns the registry content: provider names in sorted order and each provider's models sorted by name. Unparseable files are skipped (listed callers should not brick on one bad YAML file).
func (*Store) Path ¶
Path returns the on-disk location of one model file (whether or not it exists) — surfaced by `##llm info`.
func (*Store) SeedIfEmpty ¶
SeedIfEmpty populates the registry with the starter set when the llms folder does not exist yet (or holds no models). Existing content is never touched — the folder is the single source of truth once it has models.
func (*Store) SetDisabled ¶ added in v0.2.3
SetDisabled flips one model file's disabled flag and rewrites it in place, returning the updated spec. A disabled model stays declared and inspectable; only activation is refused.