config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckProfile

func CheckProfile(profile Profile)

Check profile

func ProfileAssistantPrompt

func ProfileAssistantPrompt(profile Profile) string

func ProfileInformation

func ProfileInformation(profile Profile) string

Types

type AzureConfig

type AzureConfig struct {
	APIEndpoint     string `survey:"api_endpoint" mapstructure:"api_endpoint" json:"api_endpoint"`
	APIKey          string `survey:"api_key" mapstructure:"api_key" json:"api_key"`
	DeploymentId    string `survey:"deployment_id" mapstructure:"deployment_id" json:"deployment_id"`
	AssistantPrompt string `survey:"assistant_prompt" mapstructure:"assistant_prompt" json:"assistant_prompt"`
}

Azure config

type Config

type Config struct {
	Profiles []Profile `mapstructure:"profiles" json:"profiles"`
}

Config

func NewConfig

func NewConfig(configPath, configFilePath string) (*Config, error)

Create new config instance

func ReloadConfig

func ReloadConfig() (*Config, error)

Reload config

func (*Config) CreateProfile

func (config *Config) CreateProfile(profile Profile) error

Create new profile

func (*Config) DeleteProfile

func (config *Config) DeleteProfile(names []string) error

Delete profile by id

func (*Config) SwitchProfile

func (config *Config) SwitchProfile(profile Profile) error

Switch profile

type OpenAIConfig

type OpenAIConfig struct {
	APIKey          string      `survey:"api_key" mapstructure:"api_key" json:"api_key"`
	Model           OpenAIModel `survey:"model" mapstructure:"model" json:"model"`
	AssistantPrompt string      `survey:"assistant_prompt" mapstructure:"assistant_prompt" json:"assistant_prompt"`
}

OpenAI config

type OpenAIModel

type OpenAIModel = string
const (
	// Embeddings
	TextEmbeddingAda_002 OpenAIModel = "text-embedding-ada-002"

	// GPT-3.5
	GPT_3_5_Turbo          OpenAIModel = "gpt-3.5-turbo"
	GPT_3_5_Turbo_16k      OpenAIModel = "gpt-3.5-turbo-16k"
	GPT_3_5_Turbo_0613     OpenAIModel = "gpt-3.5-turbo-0613"
	GPT_3_5_Turbo_16k_0613 OpenAIModel = "gpt-3.5-turbo-16k-0613"
	TextDavinci_003        OpenAIModel = "text-davinci-003"
	TextDavinci_002        OpenAIModel = "text-davinci-002"
	CodeDavinci_002        OpenAIModel = "code-davinci-002"

	// GPT-4
	GPT_4          OpenAIModel = "gpt-4"
	GPT_4_0613     OpenAIModel = "gpt-4-0613"
	GPT_4_32k      OpenAIModel = "gpt-4-32k"
	GPT_4_32k_0613 OpenAIModel = "gpt-4-32k-0613"
)

type Profile

type Profile struct {
	Provider Provider      `mapstructure:"provider" json:"provider"`
	Name     string        `survey:"name" mapstructure:"name" json:"name"`
	Azure    *AzureConfig  `mapstructure:"azure,omitempty" json:"azure"`
	OpenAI   *OpenAIConfig `mapstructure:"open_ai,omitempty" json:"open_ai"`
}

Profile

type Provider

type Provider string

Model Provider

const (
	Azure  Provider = "Azure"
	OpenAI Provider = "OpenAI"
)

Jump to

Keyboard shortcuts

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