config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package config provides centralized configuration management for llm-compiler. It handles environment variables, default values, and configuration validation.

Index

Constants

View Source
const (
	DefaultOpenAIModel     = "gpt-4"
	DefaultOpenAIBaseURL   = "https://api.openai.com/v1"
	DefaultLlamaThreads    = 4
	DefaultWorkerTimeout   = 300
	DefaultMaxRetries      = 3
	DefaultFmtOutputFile   = "fmt_output.txt"
	DefaultLlamaOutputFile = "llama_output.txt"
)

Default values

Variables

This section is empty.

Functions

func Reset

func Reset()

Reset clears the global configuration, forcing reload on next Get() This is primarily useful for testing

Types

type Config

type Config struct {
	// OpenAI settings
	OpenAIAPIKey  string
	OpenAIBaseURL string
	OpenAIModel   string

	// Llama settings
	LlamaModelPath string
	LlamaThreads   int

	// Runtime settings
	UseSubprocess bool
	WorkerTimeout int // seconds
	MaxRetries    int

	// Output settings
	FmtOutputFile   string
	LlamaOutputFile string
	Verbose         bool
	DebugMode       bool
}

Config holds all configuration settings for llm-compiler

func Get

func Get() *Config

Get returns the global configuration, loading from environment if not already loaded

func NewConfig

func NewConfig() *Config

NewConfig creates a new configuration with custom values This is useful for testing or programmatic configuration

func (*Config) Validate

func (c *Config) Validate() error

Validate checks if the configuration is valid for the intended use

func (*Config) WithDebug

func (c *Config) WithDebug(debug, verbose bool) *Config

WithDebug enables debug and verbose modes

func (*Config) WithLlama

func (c *Config) WithLlama(modelPath string, threads int) *Config

WithLlama configures Llama settings

func (*Config) WithOpenAI

func (c *Config) WithOpenAI(apiKey, baseURL, model string) *Config

WithOpenAI configures OpenAI settings

func (*Config) WithOutput

func (c *Config) WithOutput(fmtOutput, llamaOutput string) *Config

WithOutput configures output file paths

func (*Config) WithSubprocess

func (c *Config) WithSubprocess(enabled bool) *Config

WithSubprocess enables subprocess mode

Jump to

Keyboard shortcuts

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