config

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetLogLevel

func SetLogLevel(cfg *Config)

SetLogLevel sets the log level based on the config file. Defaults to INFO if not set or invalid

Types

type Config

type Config struct {
	LLM         LLM               `mapstructure:"llm"`
	Memory      MemoryConfig      `mapstructure:"memory"`
	Extractors  ExtractorsConfig  `mapstructure:"extractors"`
	MemoryStore MemoryStoreConfig `mapstructure:"memory_store"`
	Server      ServerConfig      `mapstructure:"server"`
	Log         LogConfig         `mapstructure:"log"`
}

Config holds the configuration of the application Use cmd.NewConfig to create a new instance

func LoadConfig

func LoadConfig(configFile string) (*Config, error)

LoadConfig loads the config file and ENV variables into a Config struct

type EmbeddingsConfig

type EmbeddingsConfig struct {
	Enabled    bool   `mapstructure:"enabled"`
	Dimensions int    `mapstructure:"dimensions"`
	Model      string `mapstructure:"model"`
}

type ExtractorsConfig

type ExtractorsConfig struct {
	Summarizer SummarizerConfig `mapstructure:"summarizer"`
	Embeddings EmbeddingsConfig `mapstructure:"embeddings"`
}

type LLM

type LLM struct {
	Model string `mapstructure:"model"`
	// OpenAIAPIKey is loaded from ENV not config file.
	OpenAIAPIKey string `mapstructure:"openai_api_key"`
}

type LogConfig

type LogConfig struct {
	Level string `mapstructure:"level"`
}

type MemoryConfig

type MemoryConfig struct {
	MessageWindow int `mapstructure:"message_window"`
}

type MemoryStoreConfig

type MemoryStoreConfig struct {
	Type     string         `mapstructure:"type"`
	Postgres PostgresConfig `mapstructure:"postgres"`
}

type PostgresConfig

type PostgresConfig struct {
	DSN string `mapstructure:"dsn"`
}

type ServerConfig

type ServerConfig struct {
	Port int `mapstructure:"port"`
}

type SummarizerConfig

type SummarizerConfig struct {
	Enabled bool `mapstructure:"enabled"`
}

Jump to

Keyboard shortcuts

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