cmd

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 37 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cmd has the registry's commands and flags

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentCommands added in v0.6.0

type AgentCommands struct {
	AgentList   AgentListCmd   `cmd:"" name:"agents" help:"List the agents." group:"LLM TOOLS & AGENTS"`
	AgentGet    AgentGetCmd    `cmd:"" name:"agent" help:"Print an agent's definition, as YAML." group:"LLM TOOLS & AGENTS"`
	AgentCreate AgentCreateCmd `cmd:"" name:"agent-create" help:"Create an agent from a YAML file, or standard input." group:"LLM TOOLS & AGENTS"`
	AgentUpdate AgentUpdateCmd `` /* 155-byte string literal not displayed */
	AgentDelete AgentDeleteCmd `cmd:"" name:"agent-delete" help:"Delete an agent, and print its definition, as YAML." group:"LLM TOOLS & AGENTS"`
}

AgentCommands are the commands of agents, whose definitions are YAML, as a file of an agent's definition is

type AgentCreateCmd added in v0.6.0

type AgentCreateCmd struct {
	File string `` /* 146-byte string literal not displayed */
}

AgentCreateCmd creates an agent from its definition, in YAML, which is read from a file, or standard input

func (*AgentCreateCmd) Run added in v0.6.0

func (cmd *AgentCreateCmd) Run(ctx server.Cmd) error

Run creates the agent from its definition, which is read from the file, or standard input, and prints it, as YAML

type AgentDeleteCmd added in v0.6.0

type AgentDeleteCmd struct {
	Name string `arg:"" name:"name" help:"Name of the agent."`
}

AgentDeleteCmd deletes an agent

func (*AgentDeleteCmd) Run added in v0.6.0

func (cmd *AgentDeleteCmd) Run(ctx server.Cmd) error

Run deletes the agent, and prints its definition, as YAML, as it was, so it can be created again

type AgentGetCmd added in v0.6.0

type AgentGetCmd struct {
	Name string `arg:"" name:"name" help:"Name of the agent."`
}

AgentGetCmd prints an agent's definition, as YAML

func (*AgentGetCmd) Run added in v0.6.0

func (cmd *AgentGetCmd) Run(ctx server.Cmd) error

Run prints the agent's definition, as YAML

type AgentListCmd added in v0.6.0

type AgentListCmd struct {
	Offset uint  `name:"offset" help:"Agents to skip." optional:""`
	Limit  *uint `name:"limit" help:"Most agents to list." optional:""`
}

AgentListCmd lists the agents

func (*AgentListCmd) Run added in v0.6.0

func (cmd *AgentListCmd) Run(ctx server.Cmd) error

Run prints a table of the agents, and a summary, or with debugging, the response

type AgentUpdateCmd added in v0.6.0

type AgentUpdateCmd struct {
	Name        string          `arg:"" name:"name" help:"Name of the agent."`
	Title       *string         `name:"title" help:"Title of the agent, for people." optional:""`
	Description *string         `name:"description" help:"What the agent does, for people, and models which call it as a tool." optional:""`
	Input       json.RawMessage `name:"input" help:"JSON schema of the input, which is an object, or null to clear it." optional:""`
	Prompt      *string         `name:"prompt" help:"Go template of the message to the model, executed with the input." optional:""`
	schema.GeneratorMeta
}

AgentUpdateCmd changes the definition of an agent, which are given, and keeps the rest: an empty value, such as --tools=, clears one, --input=null and --schema=null clear the schemas, and an option which is null, such as --opt thinking=null, is removed

func (*AgentUpdateCmd) Run added in v0.6.0

func (cmd *AgentUpdateCmd) Run(ctx server.Cmd) error

Run changes the agent's definition, which is given, and prints it, as YAML

type AskCmd

type AskCmd struct {
	Text   []string                   `arg:"" name:"text" help:"The question to ask, which can be more than one argument."`
	Files  []string                   `` /* 274-byte string literal not displayed */
	Model  string                     `` /* 158-byte string literal not displayed */
	System string                     `name:"system" help:"A system prompt, such as instructions on how to reply." optional:""`
	Tools  []string                   `` /* 226-byte string literal not displayed */
	Opt    map[string]json.RawMessage `name:"opt" help:"Options, by key, such as temperature=0.7, which can be given more than once." optional:""`
	Schema json.RawMessage            `name:"schema" help:"JSON schema of the reply, which is printed as JSON." optional:""`
	Stream bool                       `` /* 160-byte string literal not displayed */
}

func (*AskCmd) Run

func (cmd *AskCmd) Run(ctx server.Cmd) error

Run prints the model's reply to the question, as it's generated, or once it's complete, and the tools it called, or its reply as JSON, with a schema, and keeps the model, by its canonical name, as the default

type ChatCmd added in v0.6.0

type ChatCmd struct {
	Text    []string  `` /* 134-byte string literal not displayed */
	Files   []string  `` /* 274-byte string literal not displayed */
	Session uuid.UUID `name:"session" help:"Session identifier, which is a UUID, or the default session, which this is then." optional:""`
	Stream  bool      `` /* 160-byte string literal not displayed */
}

ChatCmd asks a session's model a question, in the session, which keeps the question, and the reply, or, without a question, runs an interface in the terminal to chat in the session

func (*ChatCmd) Run added in v0.6.0

func (cmd *ChatCmd) Run(ctx server.Cmd) error

Run asks the session's model the question, which runs the tools it calls, and prints its reply, as it's generated, or once it's complete, or as JSON, when the session has a schema, and why it stopped, when it didn't finish, and keeps the session as the default

type ClientCommands

ClientCommands are the commands which call the registry's API

type EmbedCmd

type EmbedCmd struct {
	Text  []string                   `arg:"" name:"text" help:"The text to embed, which can be more than one argument." optional:""`
	Model string                     `` /* 180-byte string literal not displayed */
	File  string                     `` /* 128-byte string literal not displayed */
	Opt   map[string]json.RawMessage `name:"opt" help:"Options, by key, such as dimensions=256, which can be given more than once." optional:""`
}

func (*EmbedCmd) Run

func (cmd *EmbedCmd) Run(ctx server.Cmd) error

Run prints the vector of the text, and the file, as JSON, or the response, with debugging, and keeps the model, by its canonical name, as the default for embeddings

type Flags

type Flags struct{}

Flags are the registry's flags for the server, which has none yet: providers are added with the registry's API, or in code, and kept in a store, when there's one

func (Flags) WithRegistry

func (flags Flags) WithRegistry(ctx server.Cmd, srv *servercmd.RunServer, fn func(*registry.Registry) error, opts ...registry.Opt) error

WithRegistry creates a registry for the server, with the server's tracer, and the server's client options, such as its tracer and timeout, with its name and version as the user agent, for the providers' clients, and then the options, such as its store of providers, such as its credentials provider, registers its HTTP handlers with the server, when there is one, and then calls the function with the registry, returning any error

type InferenceCommands

type InferenceCommands struct {
	Ask        AskCmd        `cmd:"" name:"ask" help:"Ask a model a question, and print its reply, and the tools it calls." group:"LLM INFERENCE"`
	Chat       ChatCmd       `cmd:"" name:"chat" help:"Chat with a session's model, or in the terminal without a question." group:"LLM INFERENCE"`
	Embed      EmbedCmd      `cmd:"" name:"embed" help:"Get a vector for text, an image or audio." group:"LLM INFERENCE"`
	OCR        RecognizeCmd  `` /* 126-byte string literal not displayed */
	Transcribe TranscribeCmd `cmd:"" name:"transcribe" help:"Ask a model for the speech in audio, as text, or its segments." group:"LLM INFERENCE"`
	Translate  TranslateCmd  `cmd:"" name:"translate" help:"Translate the speech in audio into English text." group:"LLM INFERENCE"`
}

InferenceCommands are the commands which ask models to do something with messages

type ModelCommands

type ModelCommands struct {
	ModelList   ModelListCmd   `cmd:"" name:"models" help:"List the models of the providers." group:"LLM MODELS"`
	ModelGet    ModelGetCmd    `cmd:"" name:"model" help:"Get a model by name, and make it the default model." group:"LLM MODELS"`
	ModelLoad   ModelLoadCmd   `cmd:"" name:"model-load" help:"Load a model, downloading it when needed, and make it the default." group:"LLM MODELS"`
	ModelDelete ModelDeleteCmd `cmd:"" name:"model-delete" help:"Delete a model, with a provider which deletes models, such as Ollama." group:"LLM MODELS"`
	ModelUnload ModelUnloadCmd `cmd:"" name:"model-unload" help:"Unload a model from memory, keeping it stored." group:"LLM MODELS"`
}

type ModelDeleteCmd

type ModelDeleteCmd struct {
	Name string `arg:"" name:"name" help:"Model name, or alias, or provider and model name separated by a colon, such as ollama:gemma:latest."`
}

func (*ModelDeleteCmd) Run

func (cmd *ModelDeleteCmd) Run(ctx server.Cmd) error

Run deletes the model, which isn't the default model, when it was

type ModelGetCmd

type ModelGetCmd struct {
	Name string `arg:"" name:"name" help:"Model name, or alias, or provider and model name separated by a colon, such as openai:gpt-4o."`
}

func (*ModelGetCmd) Run

func (cmd *ModelGetCmd) Run(ctx server.Cmd) error

Run gets the model, which is then the default model, by its canonical name

type ModelListCmd

type ModelListCmd struct {
	schema.ModelListRequest
}

func (*ModelListCmd) Run

func (cmd *ModelListCmd) Run(ctx server.Cmd) error

type ModelLoadCmd

type ModelLoadCmd struct {
	Name     string `arg:"" name:"name" help:"Name of the model to load, such as llama3.2:latest."`
	Provider string `name:"provider" help:"Provider to load the model with, which is needed when more than one provider loads models." optional:""`
	Progress bool   `name:"progress" help:"Show the download's progress, when the output is a terminal." default:"true" negatable:""`
}

func (*ModelLoadCmd) Run

func (cmd *ModelLoadCmd) Run(ctx server.Cmd) error

Run loads the model, which is then the default model, by its canonical name

type ModelUnloadCmd

type ModelUnloadCmd struct {
	Name string `arg:"" name:"name" help:"Model name, or alias, or provider and model name separated by a colon, such as ollama:gemma:latest."`
}

func (*ModelUnloadCmd) Run

func (cmd *ModelUnloadCmd) Run(ctx server.Cmd) error

type ProviderCommands

type ProviderCommands struct {
	ProviderList             ProviderListCmd             `cmd:"" name:"providers" help:"List the providers." group:"LLM PROVIDERS"`
	ProviderGet              ProviderGetCmd              `cmd:"" name:"provider" help:"Get a provider by name." group:"LLM PROVIDERS"`
	ProviderUpdate           ProviderUpdateCmd           `cmd:"" name:"provider-update" help:"Update a provider's URL, patterns or API key." group:"LLM PROVIDERS"`
	ProviderDelete           ProviderDeleteCmd           `cmd:"" name:"provider-delete" help:"Delete a provider by name." group:"LLM PROVIDERS"`
	ProviderCreateOllama     ProviderCreateOllamaCmd     `cmd:"" name:"provider-create-ollama" help:"Create an Ollama provider." group:"LLM PROVIDERS"`
	ProviderCreateEliza      ProviderCreateElizaCmd      `cmd:"" name:"provider-create-eliza" help:"Create an Eliza provider, for testing." group:"LLM PROVIDERS"`
	ProviderCreateGoWhisper  ProviderCreateGoWhisperCmd  `` /* 148-byte string literal not displayed */
	ProviderCreateElevenLabs ProviderCreateElevenLabsCmd `` /* 126-byte string literal not displayed */
	ProviderCreateOpenAI     ProviderCreateOpenAICmd     `cmd:"" name:"provider-create-openai" help:"Create an OpenAI, or OpenAI-compatible, provider." group:"LLM PROVIDERS"`
	ProviderCreateDeepSeek   ProviderCreateDeepSeekCmd   `cmd:"" name:"provider-create-deepseek" help:"Create a DeepSeek provider." group:"LLM PROVIDERS"`
	ProviderCreateMistral    ProviderCreateMistralCmd    `cmd:"" name:"provider-create-mistral" help:"Create a Mistral provider." group:"LLM PROVIDERS"`
}

type ProviderCreateDeepSeekCmd

type ProviderCreateDeepSeekCmd struct {
	ProviderModels
	Name             string `name:"name" default:"deepseek" help:"Provider name."`
	APIKeyCredential string `name:"api-key-credential" help:"Name of the credential holding the API key." required:""`
}

ProviderCreateDeepSeekCmd creates a provider for DeepSeek, which has an OpenAI-compatible API, at a fixed URL

func (*ProviderCreateDeepSeekCmd) Run

func (cmd *ProviderCreateDeepSeekCmd) Run(ctx server.Cmd) error

DeepSeek has an OpenAI-compatible API, at a fixed URL

type ProviderCreateElevenLabsCmd

type ProviderCreateElevenLabsCmd struct {
	ProviderModels
	Name             string `name:"name" default:"elevenlabs" help:"Provider name."`
	APIKeyCredential string `name:"api-key-credential" help:"Name of the credential holding the API key." required:""`
}

ProviderCreateElevenLabsCmd creates a provider for ElevenLabs, at a fixed URL, which needs an API key

func (*ProviderCreateElevenLabsCmd) Run

type ProviderCreateElizaCmd

type ProviderCreateElizaCmd struct {
	ProviderModels
	Name string `name:"name" default:"eliza" help:"Provider name."`
}

func (*ProviderCreateElizaCmd) Run

func (cmd *ProviderCreateElizaCmd) Run(ctx server.Cmd) error

Eliza runs in the server, so has no URL or API key

type ProviderCreateGoWhisperCmd

type ProviderCreateGoWhisperCmd struct {
	ProviderModels
	Name string `name:"name" default:"gowhisper" help:"Provider name."`
	URL  string `arg:"" name:"url" help:"URL of the go-whisper server, such as localhost:8081."`
}

ProviderCreateGoWhisperCmd creates a provider for a go-whisper server, which has no API key

func (*ProviderCreateGoWhisperCmd) Run

go-whisper has no API key

type ProviderCreateMistralCmd

type ProviderCreateMistralCmd struct {
	ProviderModels
	Name             string `name:"name" default:"mistral" help:"Provider name."`
	APIKeyCredential string `name:"api-key-credential" help:"Name of the credential holding the API key." required:""`
}

ProviderCreateMistralCmd creates a provider for Mistral, which has an OpenAI-compatible API, at a fixed URL

func (*ProviderCreateMistralCmd) Run

func (cmd *ProviderCreateMistralCmd) Run(ctx server.Cmd) error

Mistral has an OpenAI-compatible API, at a fixed URL

type ProviderCreateOllamaCmd

type ProviderCreateOllamaCmd struct {
	ProviderModels
	Name             string `name:"name" default:"ollama" help:"Provider name."`
	URL              string `arg:"" name:"url" help:"URL of the Ollama server, such as localhost:11434."`
	APIKeyCredential string `` /* 161-byte string literal not displayed */
}

func (*ProviderCreateOllamaCmd) Run

func (cmd *ProviderCreateOllamaCmd) Run(ctx server.Cmd) error

type ProviderCreateOpenAICmd

type ProviderCreateOpenAICmd struct {
	ProviderModels
	Name             string `name:"name" default:"openai" help:"Provider name."`
	URL              string `name:"url" help:"URL of an OpenAI-compatible server, such as vLLM or LM Studio, rather than OpenAI's."`
	APIKeyCredential string `name:"api-key-credential" help:"Name of the credential holding the API key. Required without a URL."`
}

ProviderCreateOpenAICmd creates a provider for OpenAI, which is the default URL, and needs an API key, or a server with an OpenAI-compatible API, which may not

func (*ProviderCreateOpenAICmd) Run

func (cmd *ProviderCreateOpenAICmd) Run(ctx server.Cmd) error

OpenAI's own API, without a URL, needs an API key, but other OpenAI-compatible servers may not

type ProviderDeleteCmd

type ProviderDeleteCmd struct {
	Name string `arg:"" name:"name" help:"Provider name."`
}

func (*ProviderDeleteCmd) Run

func (cmd *ProviderDeleteCmd) Run(ctx server.Cmd) error

type ProviderGetCmd

type ProviderGetCmd struct {
	Name string `arg:"" name:"name" help:"Provider name."`
}

func (*ProviderGetCmd) Run

func (cmd *ProviderGetCmd) Run(ctx server.Cmd) error

type ProviderListCmd

type ProviderListCmd struct {
	schema.ProviderListRequest
}

func (*ProviderListCmd) Run

func (cmd *ProviderListCmd) Run(ctx server.Cmd) error

type ProviderModels

type ProviderModels struct {
	Include []string `` /* 139-byte string literal not displayed */
	Exclude []string `name:"exclude" help:"Regular expressions of the names of the models which are excluded, such as -mini$."`
}

ProviderModels are the patterns of the names of a provider's models

type ProviderUpdateCmd

type ProviderUpdateCmd struct {
	ProviderModels
	Name             string `arg:"" name:"name" help:"Provider name."`
	URL              string `name:"url" help:"URL of the provider, or the type's default when it isn't given."`
	APIKeyCredential string `` /* 129-byte string literal not displayed */
}

ProviderUpdateCmd updates a provider, whose URL and patterns are replaced with those given, so one which isn't given is cleared, or is the type's default, and whose API key is kept, unless one is given

func (*ProviderUpdateCmd) Run

func (cmd *ProviderUpdateCmd) Run(ctx server.Cmd) error

type RecognizeCmd

type RecognizeCmd struct {
	File  string                     `arg:"" name:"file" type:"existingfile" help:"The image or document, such as a PDF, whose text is recognized."`
	Model string                     `` /* 182-byte string literal not displayed */
	Opt   map[string]json.RawMessage `` /* 155-byte string literal not displayed */
}

func (*RecognizeCmd) Run

func (cmd *RecognizeCmd) Run(ctx server.Cmd) error

Run prints the text of the file, in Markdown, with a rule between pages, or the response, as JSON, with debugging, or when the pages have their regions, and keeps the model, by its canonical name, as the default for recognizing text

type SessionCommands added in v0.6.0

type SessionCommands struct {
	SessionList   SessionListCmd   `cmd:"" name:"sessions" help:"List the sessions, most recently modified first." group:"LLM SESSIONS"`
	SessionGet    SessionGetCmd    `cmd:"" name:"session" help:"Get a session, and make it the default." group:"LLM SESSIONS"`
	SessionMsgs   SessionMsgsCmd   `cmd:"" name:"session-messages" help:"List a session's messages, oldest first." group:"LLM SESSIONS"`
	SessionCreate SessionCreateCmd `cmd:"" name:"session-create" help:"Create a session, and make it the default." group:"LLM SESSIONS"`
	SessionUpdate SessionUpdateCmd `` /* 150-byte string literal not displayed */
	SessionForget SessionForgetCmd `` /* 141-byte string literal not displayed */
	SessionDelete SessionDeleteCmd `cmd:"" name:"session-delete" help:"Delete a session." group:"LLM SESSIONS"`
}

type SessionCreateCmd added in v0.6.0

type SessionCreateCmd struct {
	schema.SessionMeta
}

SessionCreateCmd creates a session with the settings which are given, and the default model, when no model is given, which is then the default session

func (*SessionCreateCmd) Run added in v0.6.0

func (cmd *SessionCreateCmd) Run(ctx server.Cmd) error

type SessionDeleteCmd added in v0.6.0

type SessionDeleteCmd struct {
	ID uuid.UUID `arg:"" name:"id" help:"Session identifier, which is a UUID."`
}

func (*SessionDeleteCmd) Run added in v0.6.0

func (cmd *SessionDeleteCmd) Run(ctx server.Cmd) error

type SessionForgetCmd added in v1.0.0

type SessionForgetCmd struct {
	ID uuid.UUID `arg:"" name:"id" optional:"" help:"Session identifier, which is a UUID, or the default session."`
}

SessionDeleteCmd deletes a session, which isn't the default, when it's deleted

func (*SessionForgetCmd) Run added in v1.0.0

func (cmd *SessionForgetCmd) Run(ctx server.Cmd) error

Run forgets the session's messages, and prints it

type SessionGetCmd added in v0.6.0

type SessionGetCmd struct {
	ID uuid.UUID `arg:"" name:"id" optional:"" help:"Session identifier, which is a UUID, or the default session."`
}

SessionGetCmd gets a session, which is the default session when there's no identifier, and is then the default

func (*SessionGetCmd) Run added in v0.6.0

func (cmd *SessionGetCmd) Run(ctx server.Cmd) error

type SessionListCmd added in v0.6.0

type SessionListCmd struct {
	Offset uint  `name:"offset" help:"Sessions to skip." optional:""`
	Limit  *uint `name:"limit" help:"Most sessions to list." optional:""`
}

func (*SessionListCmd) Run added in v0.6.0

func (cmd *SessionListCmd) Run(ctx server.Cmd) error

type SessionMsgsCmd added in v0.6.0

type SessionMsgsCmd struct {
	ID     uuid.UUID `arg:"" name:"id" optional:"" help:"Session identifier, which is a UUID, or the default session."`
	Role   string    `name:"role" help:"List only the messages of this role, such as user, assistant or tool." optional:""`
	Offset uint      `name:"offset" help:"Messages to skip." optional:""`
	Limit  *uint     `name:"limit" help:"Most messages to list." optional:""`
}

SessionMsgsCmd lists the messages of a session, which is the default session when there's no identifier, and is then the default

func (*SessionMsgsCmd) Run added in v0.6.0

func (cmd *SessionMsgsCmd) Run(ctx server.Cmd) error

type SessionUpdateCmd added in v0.6.0

type SessionUpdateCmd struct {
	ID uuid.UUID `arg:"" name:"id" optional:"" help:"Session identifier, which is a UUID, or the default session."`
	schema.SessionMeta
}

SessionUpdateCmd changes the settings of a session, which is the default session when there's no identifier, and is then the default, which are given, and keeps the rest: an empty model, system prompt or tools, such as --tools=, clears them, --schema=null clears the schema, and an option which is null, such as --opt thinking=null, is removed

func (*SessionUpdateCmd) Run added in v0.6.0

func (cmd *SessionUpdateCmd) Run(ctx server.Cmd) error

type TranscribeCmd

type TranscribeCmd struct {
	File   string                     `arg:"" name:"file" type:"existingfile" help:"The audio, whose speech is transcribed."`
	Model  string                     `` /* 175-byte string literal not displayed */
	Opt    map[string]json.RawMessage `` /* 135-byte string literal not displayed */
	Stream bool                       `` /* 131-byte string literal not displayed */
	Format string                     `` /* 240-byte string literal not displayed */
}

func (*TranscribeCmd) Run

func (cmd *TranscribeCmd) Run(ctx server.Cmd) error

Run prints the text of the speech in the file, or its segments, when they're asked for, or the response, with debugging, and keeps the model, by its canonical name, as the default for transcribing speech

type TranslateCmd

type TranslateCmd struct {
	File   string                     `arg:"" name:"file" type:"existingfile" help:"The audio, whose speech, in any language, is translated into English."`
	Model  string                     `` /* 174-byte string literal not displayed */
	Opt    map[string]json.RawMessage `name:"opt" help:"Options, by key, such as segments=true, which can be given more than once." optional:""`
	Stream bool                       `` /* 130-byte string literal not displayed */
	Format string                     `` /* 211-byte string literal not displayed */
}

func (*TranslateCmd) Run

func (cmd *TranslateCmd) Run(ctx server.Cmd) error

Run prints the English text of the speech in the file, as TranscribeCmd does, and keeps the model as the default for translating speech

Directories

Path Synopsis
Package tui is a terminal interface to chat in a session, which is a throwaway, until there's a better one
Package tui is a terminal interface to chat in a session, which is a throwaway, until there's a better one

Jump to

Keyboard shortcuts

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