Help us shape the future of Go! Take the 2026 Go Developer Survey

llms

package
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 8, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
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

func ParseRef

func ParseRef(ref string) (providerName, modelName string, err error)

ParseRef splits "provider/model-name" and validates both segments.

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

func (m ModelSpec) Executable() bool

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 NewStore

func NewStore(ryshDir string) *Store

NewStore roots the registry at <ryshDir>/llms.

func (*Store) Add

func (s *Store) Add(spec ModelSpec) (string, error)

Add persists a model file (creating the provider folder), returning its path. Overwrites an existing declaration for the same provider/name.

func (*Store) Dir

func (s *Store) Dir() string

Dir returns the registry root.

func (*Store) Get

func (s *Store) Get(providerName, modelName string) (*ModelSpec, error)

Get loads one model file.

func (*Store) List

func (s *Store) List() (providers []string, byProvider map[string][]ModelSpec, err error)

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

func (s *Store) Path(providerName, modelName string) string

Path returns the on-disk location of one model file (whether or not it exists) — surfaced by `##llm info`.

func (*Store) SeedIfEmpty

func (s *Store) SeedIfEmpty() error

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

func (s *Store) SetDisabled(providerName, modelName string, disabled bool) (*ModelSpec, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL