config

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BackendCopilot     = "copilot"
	BackendOpenAI      = "openai"
	BackendAnythingLLM = "anythingllm"
	BackendOllama      = "ollama"
	BackendMistral     = "mistral"
	BackendAnthropic   = "anthropic"

	ThemeDark   = "dark"
	ThemeLight  = "light"
	ThemeSystem = "system"

	TranslucentNever = "never"
	TranslucentEver  = "ever"
	TranslucentHover = "hover"

	PrinterFormatPlain = "plain"
	PrinterFormatJSON  = "json"
	PrinterTargetOut   = "stdout"
	PrinterTargetErr   = "stderr"
)

Variables

This section is empty.

Functions

func ValidateExpression

func ValidateExpression(e string) error

Types

type AnthropicConfig

type AnthropicConfig struct {
	Token   string
	BaseUrl string
	Model   string
}

func (*AnthropicConfig) AsOptions

func (c *AnthropicConfig) AsOptions() (opts []anthropic.Option)

func (*AnthropicConfig) Validate

func (c *AnthropicConfig) Validate() error

type AnythingLLMConfig

type AnythingLLMConfig struct {
	BaseURL   string
	Token     string
	Workspace string
}

func (*AnythingLLMConfig) Validate

func (c *AnythingLLMConfig) Validate() error

type CallOptionsConfig

type CallOptionsConfig struct {
	SystemPrompt string
	MaxToken     int
	Temperature  float64
	TopK         int
	TopP         float64
	MinLength    int
	MaxLength    int
}

func (*CallOptionsConfig) AsOptions

func (c *CallOptionsConfig) AsOptions() (opts []llms.CallOption)

func (*CallOptionsConfig) Validate

func (c *CallOptionsConfig) Validate() error

type Config

type Config struct {
	UI UIConfig

	Backend     string
	OpenAI      OpenAIConfig
	AnythingLLM AnythingLLMConfig
	Ollama      OllamaConfig
	Mistral     MistralConfig
	Anthropic   AnthropicConfig
	CallOptions CallOptionsConfig

	Printer PrinterConfig

	LogLevel int
}

func Parse

func Parse(arguments []string) *Config

func (Config) Validate

func (c Config) Validate() error

type Expression

type Expression string

func (Expression) Calculate

func (e Expression) Calculate(v Variables) (float64, error)

type MistralConfig

type MistralConfig struct {
	ApiKey   string
	Endpoint string
	Model    string
}

func (*MistralConfig) AsOptions

func (c *MistralConfig) AsOptions() (opts []mistral.Option)

func (*MistralConfig) Validate

func (c *MistralConfig) Validate() error

type NoopLooger

type NoopLooger struct {
}

func (NoopLooger) Debug

func (n NoopLooger) Debug(message string)

func (NoopLooger) Error

func (n NoopLooger) Error(message string)

func (NoopLooger) Fatal

func (n NoopLooger) Fatal(message string)

func (NoopLooger) Info

func (n NoopLooger) Info(message string)

func (NoopLooger) Print

func (n NoopLooger) Print(message string)

func (NoopLooger) Trace

func (n NoopLooger) Trace(message string)

func (NoopLooger) Warning

func (n NoopLooger) Warning(message string)

type OllamaConfig

type OllamaConfig struct {
	ServerURL string
	Model     string
}

func (*OllamaConfig) AsOptions

func (c *OllamaConfig) AsOptions() (opts []ollama.Option)

func (*OllamaConfig) Validate

func (c *OllamaConfig) Validate() error

type OpenAIConfig

type OpenAIConfig struct {
	APIKey     string
	APIType    string
	APIVersion string

	Model        string
	BaseUrl      string
	Organization string
}

func (*OpenAIConfig) AsOptions

func (c *OpenAIConfig) AsOptions() (opts []openai.Option)

func (*OpenAIConfig) Validate

func (c *OpenAIConfig) Validate() error

type PrinterConfig

type PrinterConfig struct {
	Format  string
	Targets []io.WriteCloser
	// contains filtered or unexported fields
}

type Shortcut

type Shortcut struct {
	Code  string
	Alt   bool
	Ctrl  bool
	Meta  bool
	Shift bool
}

type UIConfig

type UIConfig struct {
	Window       WindowConfig
	Prompt       string
	QuitShortcut Shortcut
	Theme        string
	CodeStyle    string
	Language     string
}

type VariableScreen

type VariableScreen struct {
	Dimension VariableScreenDimension `json:"Dimension"`
}

type VariableScreenDimension

type VariableScreenDimension struct {
	Width  int `json:"Width"`
	Height int `json:"Height"`
}

type Variables

type Variables struct {
	PrimaryScreen    VariableScreen   `json:"PrimaryScreen"`
	CurrentScreen    VariableScreen   `json:"CurrentScreen"`
	Screens          []VariableScreen `json:"Screens"`
	SecondaryScreens []VariableScreen `json:"SecondaryScreens"`
}

func FromScreens

func FromScreens(screens []runtime.Screen) Variables

func (Variables) ToFlatMap

func (v Variables) ToFlatMap() (map[string]interface{}, error)

type WindowBackgroundColor

type WindowBackgroundColor struct {
	R uint
	G uint
	B uint
	A uint
}

type WindowConfig

type WindowConfig struct {
	Title            string
	InitialWidth     string
	MaxHeight        string
	InitialPositionX string
	InitialPositionY string
	InitialZoom      float64
	BackgroundColor  WindowBackgroundColor
	StartState       int
	Frameless        bool
	Resizeable       bool
	Translucent      string
}

Jump to

Keyboard shortcuts

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