config

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func CfgFilePath

func CfgFilePath() string

Types

type CliParams

type CliParams struct {
	Question       boa.Required[[]string] `descr:"Question to ask" positional:"true"` // not used, but needed to produce help text
	Verbose        boa.Required[bool]     `descr:"Verbose output" default:"false" name:"verbose"`
	Session        boa.Optional[string]   `descr:"Session id (deprecated)" positional:"false" env:"CURRENT_AI_SESSION" name:"session"`
	Provider       boa.Optional[string]   `descr:"AI provider to use" name:"provider" env:"AI_PROVIDER"`
	Model          boa.Optional[string]   `descr:"Model to use" name:"model"`
	Temperature    boa.Optional[float64]  `descr:"Temperature to use" name:"temperature"`
	ProviderApiKey boa.Optional[string]   `descr:"API key for provider" env:"PROVIDER_API_KEY"`
}

type CliSubcParams

type CliSubcParams struct {
	Session boa.Optional[string] `descr:"Session id" positional:"true" env:"CURRENT_AI_SESSION" name:"session"`
	Verbose boa.Required[bool]   `descr:"Verbose output" short:"v" default:"false" name:"verbose"`
}

func (CliSubcParams) ToCliParams

func (c CliSubcParams) ToCliParams() CliParams

type Config

type Config struct {
	StoredConfig
	Verbose bool
}

func LoadCfgFile

func LoadCfgFile() (string, Config)

func ValidateCfg

func ValidateCfg(
	configFilePath string,
	cfg Config,
	p CliParams,
) Config

func (Config) ToYaml

func (c Config) ToYaml() string

func (Config) WithoutSecrets

func (c Config) WithoutSecrets() Config

type StoredConfig

type StoredConfig struct {
	Provider string                 `yaml:"provider"`
	OpenAI   openai_provider.Config `yaml:"openai"`
}

Jump to

Keyboard shortcuts

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