llms

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: Apache-2.0 Imports: 8 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

View Source
const ExecutableProvider = "anthropic"

ExecutableProvider is the provider whose models rysh can actually run today (the agentic executor speaks the Anthropic Messages API).

Variables

This section is empty.

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
}

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.

Jump to

Keyboard shortcuts

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