options

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package options print a list of global command-line options (applies to all commands).

Index

Constants

View Source
const (
	FlagAIConfig          = "config"
	FlagChatID            = "chat-id"
	FlagLogFlushFrequency = "log-flush-frequency"
)

Defines flag for ai cli.

View Source
const (
	FlagDatastoreType     = "datastore.type"
	FlagDatastoreUrl      = "datastore.url"
	FlagDatastoreUsername = "datastore.username"
	FlagDatastorePassword = "datastore.password"
)
View Source
const (
	FlagDefaultSystemPrompt = "system-prompt"
	FlagAiModel             = "model"
	FlagAiToken             = "token"
	FlagAiApiBase           = "api-base"
	FlagAiTemperature       = "temperature"
	FlagAiTopP              = "top-p"
	FlagAiMaxTokens         = "max-tokens"
	FlagOutputFormat        = "output-format"
)
View Source
const (
	// RecommendedEnvPrefix defines the ENV prefix used by all iam service.
	RecommendedEnvPrefix = "AI"
)

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig(cfg string, defaultName string)

LoadConfig reads in config file and ENV variables if set.

func NewCmdOptions

func NewCmdOptions(out io.Writer) *cobra.Command

NewCmdOptions implements the options command.

Types

type Ai added in v0.1.3

type Ai struct {
	SystemPrompt string       `yaml:"system-prompt,omitempty"`
	Token        string       `yaml:"token,omitempty"`
	Model        string       `yaml:"model,omitempty"`
	ApiBase      string       `yaml:"api-base,omitempty"`
	Temperature  float64      `yaml:"temperature,omitempty"`
	TopP         float64      `yaml:"top-p,omitempty"`
	MaxTokens    int          `yaml:"max-tokens,omitempty"`
	Proxy        string       `yaml:"proxy,omitempty"`
	OutputFormat OutputFormat `yaml:"output-format,omitempty"`
}

type Config

type Config struct {
	DefaultPromptMode string    `yaml:"default-prompt-mode,omitempty"`
	ChatID            string    `yaml:"chat-id,omitempty"`
	Ai                Ai        `yaml:"ai"`
	DataStore         DataStore `yaml:"datastore"`

	System *system.Analysis
}

Config is a structure used to configure a AI. Its members are sorted roughly in order of importance for composers.

func NewConfig

func NewConfig() *Config

NewConfig returns a Config struct with the default values.

func WriteConfig

func WriteConfig(model, apiBase, apiToken string, write bool) (*Config, error)

type ConfigFlags

type ConfigFlags struct {
	Config    *string
	SessionId *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.

type DataStore added in v0.1.3

type DataStore struct {
	Type     string `yaml:"type,omitempty"`
	Url      string `yaml:"url,omitempty"`
	Username string `yaml:"username,omitempty"`
	Password string `yaml:"password,omitempty"`
}

type DataStoreFlags added in v0.1.3

type DataStoreFlags struct {
	Type     *string
	Url      *string
	Username *string
	Password *string
}

func NewDatastoreFlags added in v0.1.3

func NewDatastoreFlags(dsType string) *DataStoreFlags

NewDatastoreFlags returns DataStoreFlags with default values set.

func (*DataStoreFlags) AddFlags added in v0.1.3

func (d *DataStoreFlags) AddFlags(flags *pflag.FlagSet)

AddFlags binds client configuration flags to a given cmd.

func (*DataStoreFlags) Validate added in v0.1.3

func (d *DataStoreFlags) Validate() error

type ModelFlags added in v0.1.3

type ModelFlags struct {
	Token        *string
	Model        *string
	ApiBase      *string
	Temperature  *float64
	TopP         *float64
	MaxTokens    *int
	Proxy        *string
	OutputFormat *string
}

func NewModelFlags added in v0.1.3

func NewModelFlags() *ModelFlags

NewModelFlags returns ModelFlags with default values set.

func (*ModelFlags) AddFlags added in v0.1.3

func (m *ModelFlags) AddFlags(flags *pflag.FlagSet)

AddFlags binds client configuration flags to a given flagset.

func (*ModelFlags) Validate added in v0.1.3

func (m *ModelFlags) Validate() error

type OutputFormat

type OutputFormat string
const (
	RawOutputFormat      OutputFormat = "raw"
	MarkdownOutputFormat OutputFormat = "markdown"
)

Jump to

Keyboard shortcuts

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