cmd

package
v0.5.1 Latest Latest
Warning

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

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

type AskCmd struct {
	Text   []string                   `arg:"" name:"text" help:"The question to ask, which can be more than one argument."`
	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 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 EventCommands

type EventCommands struct {
	Events EventsCmd `` /* 134-byte string literal not displayed */
}

EventCommands are the commands which watch the registry's events

type EventsCmd

type EventsCmd struct{}

func (*EventsCmd) Run

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

Run prints each event as a line of JSON, until the command is interrupted

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"`
	Embed      EmbedCmd      `` /* 131-byte string literal not displayed */
	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  `` /* 140-byte string literal not displayed */
}

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." group:"LLM MODELS"`
	ModelLoad   ModelLoadCmd   `` /* 157-byte string literal not displayed */
	ModelDelete ModelDeleteCmd `cmd:"" name:"model-delete" help:"Delete a model, with a provider which deletes models, such as Ollama." group:"LLM MODELS"`
	ModelUnload ModelUnloadCmd `` /* 151-byte string literal not displayed */
}

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

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

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

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           `` /* 153-byte string literal not displayed */
	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 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

Jump to

Keyboard shortcuts

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