Documentation
¶
Index ¶
Constants ¶
const ( DefaultBaseURL = "http://localhost:11434/v1" DefaultModel = "qwen3" DefaultLLMTimeout = 5 * time.Second DefaultCacheTTL = 30 * 24 * time.Hour // 30 days )
Variables ¶
This section is empty.
Functions ¶
func ExampleTOML ¶
func ExampleTOML() string
ExampleTOML returns a commented config file suitable for writing as a starter config. Not written automatically -- offered to the user on demand.
func ParseDuration ¶ added in v1.39.0
ParseDuration parses a duration string. It extends Go's time.ParseDuration with support for a "d" (day) suffix, and treats bare integers as seconds.
Types ¶
type ByteSize ¶ added in v1.39.0
type ByteSize uint64
ByteSize represents a size in bytes, parseable from unitized strings like "50 MiB" or bare integers (interpreted as bytes).
func ParseByteSize ¶ added in v1.39.0
ParseByteSize parses a size string like "50 MiB", "1.5 GiB", or "1024". A bare integer is interpreted as bytes.
func (*ByteSize) UnmarshalTOML ¶ added in v1.39.0
UnmarshalTOML implements toml.Unmarshaler for ByteSize, accepting both TOML integers (bytes) and strings ("50 MiB").
type Config ¶
type Config struct {
LLM LLM `toml:"llm"`
Documents Documents `toml:"documents"`
// Warnings collects non-fatal messages (e.g. deprecations) during load.
// Not serialized; the caller decides how to display them.
Warnings []string `toml:"-"`
}
Config is the top-level application configuration, loaded from a TOML file.
func Load ¶
Load reads the TOML config file from the default path if it exists, falls back to defaults for any unset fields, and applies environment variable overrides last.
func LoadFromPath ¶
LoadFromPath reads the TOML config file at the given path if it exists, falls back to defaults for any unset fields, and applies environment variable overrides last.
type Documents ¶ added in v1.27.0
type Documents struct {
// MaxFileSize is the largest file that can be imported as a document
// attachment. Accepts unitized strings ("50 MiB") or bare integers
// (bytes). Default: 50 MiB.
MaxFileSize ByteSize `toml:"max_file_size"`
// CacheTTL is the preferred cache lifetime setting. Accepts unitized
// strings ("30d", "720h") or bare integers (seconds). Default: 30d.
CacheTTL *Duration `toml:"cache_ttl,omitempty"`
// CacheTTLDays is deprecated; use CacheTTL instead. Kept for backward
// compatibility. Bare integer interpreted as days.
CacheTTLDays *int `toml:"cache_ttl_days,omitempty"`
}
Documents holds settings for document attachments.
func (Documents) CacheTTLDuration ¶ added in v1.39.0
CacheTTLDuration returns the resolved cache TTL as a time.Duration. CacheTTL takes precedence over CacheTTLDays. Returns 0 to disable.
type Duration ¶ added in v1.39.0
Duration wraps time.Duration with parsing support for day-suffixed strings ("30d") and bare integers (interpreted as seconds).
func (*Duration) UnmarshalTOML ¶ added in v1.39.0
UnmarshalTOML implements toml.Unmarshaler for Duration, accepting TOML integers (seconds) and strings ("30d", "720h").
type LLM ¶
type LLM struct {
// BaseURL is the root of an OpenAI-compatible API.
// The client appends /chat/completions, /models, etc.
// Default: http://localhost:11434/v1 (Ollama)
BaseURL string `toml:"base_url"`
// Model is the model identifier passed in chat requests.
// Default: qwen3
Model string `toml:"model"`
// ExtraContext is custom text appended to all system prompts.
// Useful for domain-specific details: house style, currency, location, etc.
// Optional; defaults to empty.
ExtraContext string `toml:"extra_context"`
// Timeout is the maximum time to wait for quick LLM server operations
// (ping, model listing, auto-detect). Go duration string, e.g. "5s",
// "10s", "500ms". Default: "5s".
Timeout string `toml:"timeout"`
}
LLM holds settings for the local LLM inference backend.
func (LLM) TimeoutDuration ¶ added in v1.32.0
TimeoutDuration returns the parsed LLM timeout, falling back to DefaultLLMTimeout if the value is empty or unparseable.