options

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigFlags

type ConfigFlags struct {
}

ConfigFlags composes the set of values necessary for obtaining a REST client config.

func NewConfigFlags

func NewConfigFlags(usePersistentConfig bool) *ConfigFlags

NewConfigFlags returns ConfigFlags with default values set.

type GRPCOptions

type GRPCOptions struct {
	BindAddress string `json:"bind-address" mapstructure:"bind-address"`
	BindPort    int    `json:"bind-port"    mapstructure:"bind-port"`
	MaxMsgSize  int    `json:"max-msg-size" mapstructure:"max-msg-size"`
}

GRPCOptions are for creating an unauthenticated, unauthorized, insecure port. No one should be using these anymore.

func NewGRPCOptions

func NewGRPCOptions() *GRPCOptions

NewGRPCOptions is for creating an unauthenticated, unauthorized, insecure port. No one should be using these anymore.

func (*GRPCOptions) AddFlags

func (s *GRPCOptions) AddFlags(fs *pflag.FlagSet)

AddFlags adds flags related to features for a specific api server to the specified FlagSet.

func (*GRPCOptions) Validate

func (s *GRPCOptions) Validate() []error

Validate is used to parse and validate the parameters entered by the user at the command line when the program starts.

type ModelCost

type ModelCost struct {
	Input      float64 `json:"input" mapstructure:"input"`
	Output     float64 `json:"output" mapstructure:"output"`
	CacheRead  float64 `json:"cache-read" mapstructure:"cache-read"`
	CacheWrite float64 `json:"cache-write" mapstructure:"cache-write"`
}

type ModelDefinition

type ModelDefinition struct {
	ID            string            `json:"id" mapstructure:"id"`
	Name          string            `json:"name" mapstructure:"name"`
	API           string            `json:"api" mapstructure:"api"`
	Reasoning     bool              `json:"reasoning" mapstructure:"reasoning"`
	Input         []string          `json:"input" mapstructure:"input"`
	Cost          ModelCost         `json:"cost" mapstructure:"cost"`
	ContextWindow int               `json:"context-window" mapstructure:"context-window"`
	MaxTokens     int               `json:"max-tokens" mapstructure:"max-tokens"`
	Headers       map[string]string `json:"headers" mapstructure:"headers"`
}

type ModelOptions

type ModelOptions struct {
	Mode            string                     `json:"mode" mapstructure:"mode"`
	DefaultProvider string                     `json:"default-provider" mapstructure:"default-provider"`
	DefaultModel    string                     `json:"default-model" mapstructure:"default-model"`
	Providers       map[string]*ProviderConfig `json:"providers" mapstructure:"providers"`
}

func NewModelOptions

func NewModelOptions() *ModelOptions

func (*ModelOptions) AddFlags

func (o *ModelOptions) AddFlags(fs *pflag.FlagSet)

func (*ModelOptions) Validate

func (o *ModelOptions) Validate() []error

type PluginEntryConfig

type PluginEntryConfig struct {
	Enabled *bool                  `json:"enabled,omitempty" mapstructure:"enabled"`
	Config  map[string]interface{} `json:"config,omitempty" mapstructure:"config"`
}

PluginEntryConfig holds per-plugin configuration. Aligned with the plugin system configuration file.

type PluginSlotsConfig

type PluginSlotsConfig struct {
	Memory  string `json:"memory" mapstructure:"memory"`
	Channel string `json:"channel" mapstructure:"channel"`
}

PluginSlotsConfig maps slot kind -> desired Plugin ID Aligned with the plugin system configuration file.

type PluginsOptions

type PluginsOptions struct {
	// Enabled controls whether the plugin system is enabled. (default: true)
	Enabled bool `json:"enabled" mapstructure:"enabled"`
	// Allow lists plugins that are explicitly allowed to be loaded.
	Allow []string `json:"allow" mapstructure:"allow"`
	// Deny lists plugins that are explicitly denied to be loaded.
	Deny []string `json:"deny" mapstructure:"deny"`
	// Slots controls which plugin occupies each exclusive slot.
	// For exmaple. {"memory": "memory-core"}.
	// Special value "none" disables all plugins of the kind
	Slots PluginSlotsConfig `json:"slots" mapstructure:"slots"`
	// Entries holds per-plugin configuration.
	// Key is the plugin ID. (e.g. "memory-core", "diagnostics", "llm-task")
	Entries map[string]PluginEntryConfig `json:"entries" mapstructure:"entries"`
}

PluginsOptions holds the top-level configuration for plugin system. Aligned with the plugin system configuration file.

func NewPluginsOptions

func NewPluginsOptions() *PluginsOptions

NewPluginsOptions returns a new instance of PluginsOptions.

func (*PluginsOptions) AddFlags

func (o *PluginsOptions) AddFlags(fs *pflag.FlagSet)

AddFlags adds flags for the plugins options. Only global-level switches are exposed as CLI flags. Per-plugin configuration is done via the plugin's own configuration file.

func (*PluginsOptions) Validate

func (o *PluginsOptions) Validate() []error

Validate checks PluginsOptions fields.

type ProviderConfig

type ProviderConfig struct {
	BaseURL    string            `json:"base-url" mapstructure:"base-url"`
	APIKey     string            `json:"api-key" mapstructure:"api-key"`
	API        string            `json:"api" mapstructure:"api"`
	AuthHeader *bool             `json:"auth-header" mapstructure:"auth-header"`
	Headers    map[string]string `json:"headers" mapstructure:"headers"`
	Models     []ModelDefinition `json:"models" mapstructure:"models"`
}

type RESTClientGetter

type RESTClientGetter interface {
}

RESTClientGetter is an interface that the ConfigFlags describe to provide an easier way to mock for commands and eliminate the direct coupling to a struct type. Users may wish to duplicate this type in their own packages as per the golang type overlapping.

type ServerRunOptions

type ServerRunOptions struct {
	Mode        string   `json:"mode"        mapstructure:"mode"`
	Healthz     bool     `json:"healthz"     mapstructure:"healthz"`
	Middlewares []string `json:"middlewares" mapstructure:"middlewares"`
	BindAddress string   `json:"bind-address" mapstructure:"bind-address"`
	BindPort    int      `json:"bind-port"    mapstructure:"bind-port"`
}

ServerRunOptions contains the options while running a generic api server.

func NewServerRunOptions

func NewServerRunOptions() *ServerRunOptions

NewServerRunOptions creates a new ServerRunOptions object with default parameters.

func (*ServerRunOptions) AddFlags

func (s *ServerRunOptions) AddFlags(fs *pflag.FlagSet)

AddFlags adds flags for a specific APIServer to the specified FlagSet.

func (*ServerRunOptions) ApplyTo

func (s *ServerRunOptions) ApplyTo(c *server.Config) error

ApplyTo applies the run options to the method receiver and returns self.

func (*ServerRunOptions) Validate

func (s *ServerRunOptions) Validate() []error

Validate checks validation of ServerRunOptions.

Jump to

Keyboard shortcuts

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