Documentation
¶
Overview ¶
Package cmd has the registry's commands and flags
Index ¶
- type AgentCommands
- type AgentCreateCmd
- type AgentDeleteCmd
- type AgentGetCmd
- type AgentListCmd
- type AgentUpdateCmd
- type AskCmd
- type ChatCmd
- type ClientCommands
- type EmbedCmd
- type Flags
- type IllustrateCmd
- type InferenceCommands
- type ModelCommands
- type ModelDeleteCmd
- type ModelGetCmd
- type ModelListCmd
- type ModelLoadCmd
- type ModelUnloadCmd
- type ProviderCommands
- type ProviderCreateAnthropicCmd
- type ProviderCreateDeepSeekCmd
- type ProviderCreateElevenLabsCmd
- type ProviderCreateElizaCmd
- type ProviderCreateGeminiCmd
- type ProviderCreateGoWhisperCmd
- type ProviderCreateMistralCmd
- type ProviderCreateOllamaCmd
- type ProviderCreateOpenAICmd
- type ProviderDeleteCmd
- type ProviderGetCmd
- type ProviderListCmd
- type ProviderModels
- type ProviderUpdateCmd
- type RecognizeCmd
- type SessionCommands
- type SessionCompactCmd
- type SessionCreateCmd
- type SessionDeleteCmd
- type SessionFlags
- type SessionForgetCmd
- type SessionGetCmd
- type SessionListCmd
- type SessionMsgsCmd
- type SessionUpdateCmd
- type SpeakCmd
- type TranscribeCmd
- type TranslateCmd
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
type AgentDeleteCmd ¶ added in v0.6.0
type AgentDeleteCmd struct {
Name string `arg:"" name:"name" help:"Name of the agent."`
}
AgentDeleteCmd deletes an agent
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
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
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
type AskCmd ¶
type AskCmd struct {
Text []string `arg:"" name:"text" help:"The question to ask, which can be more than one argument."`
Attach []string `` /* 413-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 */
}
type ChatCmd ¶ added in v0.6.0
type ChatCmd struct {
Text []string `` /* 134-byte string literal not displayed */
Attach []string `` /* 417-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
type ClientCommands ¶
type ClientCommands struct {
ProviderCommands
ModelCommands
SessionCommands
AgentCommands
InferenceCommands
}
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 */
Attach string `` /* 182-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:""`
}
type Flags ¶
type Flags struct {
MaxEvents uint `` /* 156-byte string literal not displayed */
}
Flags are the registry's flags for the server: the most events which run at once. 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 IllustrateCmd ¶ added in v1.4.0
type IllustrateCmd struct {
Prompt []string `` /* 151-byte string literal not displayed */
Model string `` /* 187-byte string literal not displayed */
Attach []string `` /* 178-byte string literal not displayed */
AspectRatio string `name:"aspect-ratio" help:"Aspect ratio of the images, such as 16:9." optional:""`
Size string `name:"size" help:"Size of the images, such as 1K, 2K or 4K." optional:""`
Opt map[string]json.RawMessage `name:"opt" help:"Options, by key, which can be given more than once." optional:""`
Output string `` /* 202-byte string literal not displayed */
}
IllustrateCmd asks a model to make images, from a prompt, or by changing images, and writes them to files
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"`
Speak SpeakCmd `cmd:"" name:"speak" help:"Ask a model to speak text, which is written as audio." group:"LLM INFERENCE"`
Illustrate IllustrateCmd `cmd:"" name:"illustrate" help:"Ask a model to make images, or change them, which are written to files." 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 `` /* 136-byte string literal not displayed */
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."`
}
type ModelGetCmd ¶
type ModelGetCmd struct {
Name string `` /* 153-byte string literal not displayed */
}
type ModelListCmd ¶
type ModelListCmd struct {
schema.ModelListRequest
}
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:""`
}
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."`
}
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"`
ProviderCreateAnthropic ProviderCreateAnthropicCmd `cmd:"" name:"provider-create-anthropic" help:"Create an Anthropic provider, for Claude's models." group:"LLM PROVIDERS"`
ProviderCreateGemini ProviderCreateGeminiCmd `cmd:"" name:"provider-create-gemini" help:"Create a Gemini provider, for Google's Gemini models." group:"LLM PROVIDERS"`
}
type ProviderCreateAnthropicCmd ¶ added in v1.2.2
type ProviderCreateAnthropicCmd struct {
ProviderModels
Name string `name:"name" default:"anthropic" help:"Provider name."`
APIKeyCredential string `name:"api-key-credential" help:"Name of the credential holding the API key, such as ANTHROPIC_API_KEY." required:""`
}
ProviderCreateAnthropicCmd creates a provider for Anthropic's API, at a fixed URL, which needs an API key
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
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
type ProviderCreateElizaCmd ¶
type ProviderCreateElizaCmd struct {
ProviderModels
Name string `name:"name" default:"eliza" help:"Provider name."`
}
type ProviderCreateGeminiCmd ¶ added in v1.4.0
type ProviderCreateGeminiCmd struct {
ProviderModels
Name string `name:"name" default:"gemini" help:"Provider name."`
APIKeyCredential string `name:"api-key-credential" help:"Name of the credential holding the API key, such as GEMINI_API_KEY." required:""`
}
ProviderCreateGeminiCmd creates a provider for Google's Gemini API, at a fixed URL, which needs an 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
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
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 */
}
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
type ProviderDeleteCmd ¶
type ProviderDeleteCmd struct {
Name string `arg:"" name:"name" help:"Provider name."`
}
type ProviderGetCmd ¶
type ProviderGetCmd struct {
Name string `arg:"" name:"name" help:"Provider name."`
}
type ProviderListCmd ¶
type ProviderListCmd struct {
schema.ProviderListRequest
}
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
type RecognizeCmd ¶
type RecognizeCmd struct {
File string `` /* 136-byte string literal not displayed */
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 */
SessionCompact SessionCompactCmd `` /* 172-byte string literal not displayed */
SessionDelete SessionDeleteCmd `cmd:"" name:"session-delete" help:"Delete a session." group:"LLM SESSIONS"`
}
type SessionCompactCmd ¶ added in v1.5.1
type SessionCompactCmd struct {
ID uuid.UUID `arg:"" name:"id" optional:"" help:"Session identifier, which is a UUID, or the default session."`
}
SessionCompactCmd compacts a session, or the default session
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
type SessionDeleteCmd ¶ added in v0.6.0
type SessionFlags ¶ added in v1.4.1
SessionFlags are the sessions' flags for the server: how long a session is kept after it last changed, such as when the person last chatted in it, which is in days, such as 14d, or hours, or zero, to keep sessions until they're deleted
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
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
type SessionListCmd ¶ added in v0.6.0
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
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
type SpeakCmd ¶ added in v1.3.0
type SpeakCmd struct {
Text []string `arg:"" name:"text" optional:"" help:"Text to speak, which can be more than one argument, or is read from standard input."`
Model string `` /* 173-byte string literal not displayed */
Voice string `name:"voice" help:"Voice to speak in, by its name, such as Freya, or alloy." optional:""`
Opt map[string]json.RawMessage `` /* 152-byte string literal not displayed */
Output string `` /* 156-byte string literal not displayed */
}
SpeakCmd asks a model to speak text, and writes the audio to a file, or standard output
type TranscribeCmd ¶
type TranscribeCmd struct {
File string `arg:"" name:"file" help:"The audio, whose speech is transcribed, or a resource, by its URI, resource:///<hash>."`
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 */
}
type TranslateCmd ¶
type TranslateCmd struct {
File string `` /* 142-byte string literal not displayed */
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 */
}