Documentation
¶
Overview ¶
Package options print a list of global command-line options (applies to all commands).
Index ¶
Constants ¶
const ( // RecommendedHomeDir defines the default directory used to place all iam service configurations. RecommendedHomeDir = ".wecoding" // RecommendedEnvPrefix defines the ENV prefix used by all iam service. RecommendedEnvPrefix = "AI" )
const ( FlagAIConfig = "config" FlagDefaultSystemPrompt = "system-prompt" FlagAiModel = "model" FlagAiToken = "token" FlagAiApiBase = "api-base" FlagAiTemperature = "temperature" FlagAiTopP = "top-p" FlagAiMaxTokens = "max-tokens" FlagOutputFormat = "output-format" FlagLogFlushFrequency = "log-flush-frequency" )
Defines flag for ai cli.
Variables ¶
This section is empty.
Functions ¶
func LoadConfig ¶
LoadConfig reads in config file and ENV variables if set.
Types ¶
type AiConfig ¶
type AiConfig struct { SystemPrompt string `yaml:"system-prompt,omitempty" mapstructure:"system-prompt,omitempty"` Token string `yaml:"token,omitempty" mapstructure:"token,omitempty"` Model string `yaml:"model,omitempty" mapstructure:"model,omitempty"` ApiBase string `yaml:"api-base,omitempty" mapstructure:"api-base,omitempty"` Temperature float64 `yaml:"temperature,omitempty" mapstructure:"temperature,omitempty"` TopP float64 `yaml:"top-p,omitempty" mapstructure:"top-p,omitempty"` MaxTokens int `yaml:"max-tokens,omitempty" mapstructure:"max-tokens,omitempty"` Proxy string `yaml:"proxy,omitempty" mapstructure:"proxy,omitempty"` OutputFormat OutputFormat `yaml:"output-format,omitempty" mapstructure:"output-format,omitempty"` }
type Config ¶
type Config struct { DefaultPromptMode string `yaml:"default-prompt-mode,omitempty" mapstructure:"default-prompt-mode,omitempty"` Ai AiConfig `yaml:"inline" mapstructure:"inline" json:"inline"` System *system.Analysis }
Config is a structure used to configure a AI. Its members are sorted roughly in order of importance for composers.
type ConfigFlags ¶
type ConfigFlags struct { Config *string // contains filtered or unexported fields }
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.
func (*ConfigFlags) AddFlags ¶
func (f *ConfigFlags) AddFlags(flags *pflag.FlagSet)
AddFlags binds client configuration flags to a given flagset.
func (*ConfigFlags) ToRESTConfig ¶
func (f *ConfigFlags) ToRESTConfig() (*rest.Config, error)
ToRESTConfig implements RESTClientGetter. Returns a REST client configuration based on a provided path to a .aiconfig file, loading rules, and config flag overrides. Expects the AddFlags method to have been called.
func (*ConfigFlags) ToRawAIConfigLoader ¶
func (f *ConfigFlags) ToRawAIConfigLoader() clientcmd.ClientConfig
ToRawAIConfigLoader binds config flag values to config overrides Returns an interactive clientConfig if the password flag is enabled, or a non-interactive clientConfig otherwise.
type ModelOptions ¶
type ModelOptions struct { Token *string Model *string ApiBase *string Temperature *float64 TopP *float64 MaxTokens *int Proxy *string OutputFormat *string // contains filtered or unexported fields }
func NewLLMFlags ¶
func NewLLMFlags(usePersistentConfig bool) *ModelOptions
NewLLMFlags returns ModelOptions with default values set.
func (*ModelOptions) AddFlags ¶
func (m *ModelOptions) AddFlags(flags *flag.FlagSet)
AddFlags binds client configuration flags to a given flagset.
func (*ModelOptions) Validate ¶
func (m *ModelOptions) Validate() error
type OutputFormat ¶
type OutputFormat string
const ( RawOutputFormat OutputFormat = "raw" MarkdownOutputFormat OutputFormat = "markdown" )
type RESTClientGetter ¶
type RESTClientGetter interface { // ToRESTConfig returns restconfig ToRESTConfig() (*rest.Config, error) // ToRawAIConfigLoader return aiconfig loader as-is ToRawAIConfigLoader() clientcmd.ClientConfig }
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.