Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Notices are startup warnings about settings: deprecated names, which keep
// working through 1.x, and defaults that changed before 1.0.
Notices []string
DatabaseURL string
// EncryptionKeys is the versioned AES-256-GCM keyring spec
// ("1:<base64 32B>,2:..."); vendor keys are unreadable without it.
EncryptionKeys string
GRPCAddr string
GRPCMaxRecvMsgSize int
HTTPAddr string
// HTTPAPIEnabled mounts the OpenAI-compatible API on HTTPAddr; off leaves health only.
HTTPAPIEnabled bool
// MCPGatewayEnabled mounts the MCP gateway (/mcp) on HTTPAddr.
MCPGatewayEnabled bool
// Agents* configure the agents' inbox, the gateway's built-in server "agents".
AgentsEnabled bool
AgentsMaxDepth int
AgentsMaxMessages int
AgentsMaxMessageBytes int
AgentsMaxTasksPerPair int
AgentsToolRPM int
AgentsRetention time.Duration
AgentsCorrectionWindow time.Duration
AgentsMaxPinned int64
AgentsRecording string
AgentsJournalMaxLen int
AgentsJournalMaxEvent int
AgentsJournalRedisURL string
// HTTPAPITimeout bounds one HTTP API call, which waits on an upstream model.
HTTPAPITimeout time.Duration
LogLevel string
ShutdownTimeout time.Duration
DBMaxConns int32
DBMinConns int32
// DBTimeout bounds connecting and each per-request query (key checks), so
// a hung database fails calls fast instead of exhausting the pool.
DBTimeout time.Duration
// AuthStaleIfError keeps recently verified keys working while Postgres is
// unreachable; 0 refuses every call during an outage.
AuthStaleIfError time.Duration
// RoutingReload is how often replicas poll config_state for changes.
RoutingReload time.Duration
// AutoMigrate applies the embedded migrations at startup. On by default;
// a half-migrated schema is a state the queries were not written for.
AutoMigrate bool
// MigrateTimeout bounds the whole run, including the wait for whichever
// replica holds the advisory lock during a rolling deploy.
MigrateTimeout time.Duration
// AutoSeed populates initial models, rules, and dev keys when unconfigured.
AutoSeed bool
SeedClientKey string
SeedClientName string
SeedOpenAIKey string
SeedGeminiKey string
SeedAnthropicKey string
RedisAddr string
RedisPassword string
RedisDB int
RedisKeyPrefix string
// RedisTimeout bounds each Redis read and write (dials get twice as long);
// with redisguard failing fast after it trips, about what a hung Redis costs a request.
RedisTimeout time.Duration
// BootstrapAdminKey solves minting the first api key; unset after use.
BootstrapAdminKey string
UsageCollectorHost string
// UsageCollectorTLS reaches the usage sink over TLS, as a managed
// platform (Cloud Run) serves it; plaintext otherwise.
UsageCollectorTLS bool
// UsageCollectorToken is the collector's bearer token (write scope).
UsageCollectorToken string
UsageProjectID string
BatchMaxItems int
BatchPollInterval time.Duration
ResultsRetention time.Duration
// Local Node Pool configuration
NodeHeartbeatInterval time.Duration
NodeHeartbeatTTL time.Duration
NodeRetentionTTL time.Duration
NodeAllowLocalhost bool
NodeUsageRetention time.Duration // per-node request log for node owners; 0 = off
BudgetGraceMargin float64
// SpendLimitsFailMode is "open" (Redis down lets calls through unmetered)
// or "closed" (calls under a spend limit are refused until it is back).
SpendLimitsFailMode string
// SpendDefaultOutputReserve is the output tokens priced into a spend
// reservation when the call sets no max tokens.
SpendDefaultOutputReserve int
// Upstream vendor Circuit Breaker settings
CircuitBreakerEnabled bool
CircuitBreakerFailThreshold int
CircuitBreakerCooldown time.Duration
// UpstreamRequestTimeout bounds each attempt against an upstream vendor.
// Stalls beyond this duration trip circuit breakers and advance fallback chains.
UpstreamRequestTimeout time.Duration
// VendorCooldownMax caps the pause taken from a vendor Retry-After; 0 disables pauses.
VendorCooldownMax time.Duration
MetricsAddr string
OTELServiceName string
OTELExporterOTLPEndpoint string
CacheEnabled bool
CacheTTL time.Duration
CacheMaxBytes int
// SemanticCache serves near-duplicate prompts from Redis by latent
// similarity; it shares CACHE_TTL and CACHE_MAX_BYTES with the exact cache.
SemanticCacheEnabled bool
SemanticCacheThreshold float64
SemanticCacheMaxEntries int
GuardrailsEnabled bool
GuardrailsPIIAction string
GuardrailsPromptInjectionAction string
// GuardrailsLatent* screen prompts against malicious centroids in
// representation space; the categories file extends the built-in set.
GuardrailsLatentEnabled bool
GuardrailsLatentThreshold float64
GuardrailsLatentAction string
GuardrailsLatentCategoriesFile string
// LatentEncoderURL is an OpenAI-compatible /v1/embeddings endpoint (e.g. a
// JEPA node); empty or unreachable falls back to the local hash encoder.
LatentEncoderURL string
LatentEncoderModel string
LatentEncoderAPIKey string
LatentEncoderTimeout time.Duration
LatentLocalEncoderDims int
LatentEncoderCacheSize int
SentryDSN string
SentryEnvironment string
SentryRelease string
SentryTracing bool
SentryDebug bool
SentryBreadcrumbs bool
}
Config holds the application configuration. Load never fails; main.go fatals on missing required values.
func (*Config) LatentEncoderNeeded ¶
LatentEncoderNeeded reports whether any feature consumes latent embeddings.
func (*Config) RedisConfigured ¶
RedisConfigured reports whether throttling has a backing store; without it all requests are allowed (fail-open by design).
func (*Config) RedisOptions ¶ added in v0.13.1
RedisOptions builds the client options. go-redis defaults (3s reads, 5s dials, 3 retries) let one blackholed Redis add seconds to every request.
func (*Config) SpendFailClosed ¶
SpendFailClosed reports whether spend limits refuse calls while their counters are unreachable.
func (*Config) UsageConfigured ¶
UsageConfigured reports whether usage events are forwarded anywhere.