config

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultChunkSize is the default character count per text chunk for indexing.
	DefaultChunkSize = 512

	// DefaultChunkOverlap is the default character overlap between adjacent chunks.
	DefaultChunkOverlap = 64

	// DefaultDedupThreshold is the default cosine similarity threshold for deduplication.
	DefaultDedupThreshold = 0.92
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIConfig added in v0.4.0

type APIConfig struct {
	ListenAddr     string  `mapstructure:"listen_addr"`
	AuthToken      string  `mapstructure:"auth_token"`
	CursorSecret   string  `mapstructure:"cursor_secret"`
	RateLimitRPS   float64 `mapstructure:"rate_limit_rps"`
	RateLimitBurst int     `mapstructure:"rate_limit_burst"`
}

APIConfig holds HTTP API server settings.

type CaptureQualityConfig added in v0.4.0

type CaptureQualityConfig struct {
	ContextWindowTurns           int      `mapstructure:"context_window_turns"`
	ReinforcementThreshold       float64  `mapstructure:"reinforcement_threshold"`
	ReinforcementConfidenceBoost float64  `mapstructure:"reinforcement_confidence_boost"`
	MinUserMessageLength         int      `mapstructure:"min_user_message_length"`
	MinAssistantMessageLength    int      `mapstructure:"min_assistant_message_length"`
	BlocklistPatterns            []string `mapstructure:"blocklist_patterns"`
}

CaptureQualityConfig controls capture extraction quality.

type ClaudeConfig

type ClaudeConfig struct {
	APIKey       string `mapstructure:"api_key"`
	Model        string `mapstructure:"model"`
	GatewayURL   string `mapstructure:"gateway_url"`
	GatewayToken string `mapstructure:"gateway_token"`

	GatewayTimeoutSeconds int `mapstructure:"gateway_timeout_seconds"` // 0 = no timeout

	// LLM resilience settings
	MaxConcurrentLLMCalls int `mapstructure:"max_concurrent_llm_calls"` // default: 4
	CBFailureThreshold    int `mapstructure:"cb_failure_threshold"`     // default: 5
	CBRecoverySeconds     int `mapstructure:"cb_recovery_seconds"`      // default: 30
	MaxRetries            int `mapstructure:"max_retries"`              // default: 3
}

ClaudeConfig holds Anthropic Claude API settings.

func (ClaudeConfig) String added in v0.4.0

func (c ClaudeConfig) String() string

String returns a safe representation of ClaudeConfig with the API key masked.

type Config

type Config struct {
	Memgraph         MemgraphConfig         `mapstructure:"memgraph"`
	Ollama           OllamaConfig           `mapstructure:"ollama"`
	Claude           ClaudeConfig           `mapstructure:"claude"`
	Memory           MemoryConfig           `mapstructure:"memory"`
	Logging          LoggingConfig          `mapstructure:"logging"`
	API              APIConfig              `mapstructure:"api"`
	Embedder         EmbedderConfig         `mapstructure:"embedder"`
	Recall           RecallConfig           `mapstructure:"recall"`
	CaptureQuality   CaptureQualityConfig   `mapstructure:"capture_quality"`
	EntityResolution EntityResolutionConfig `mapstructure:"entity_resolution"`
	FactExtraction   FactExtractionConfig   `mapstructure:"fact_extraction"`
	Sentry           SentryConfig           `mapstructure:"sentry"`
	Hooks            HooksConfig            `mapstructure:"hooks"`
}

Config holds all configuration for cortex.

func Load

func Load() (*Config, error)

Load reads configuration from file and environment variables.

func (*Config) Validate added in v0.4.0

func (c *Config) Validate() error

Validate checks that required configuration fields are set and consistent.

type EmbedderConfig added in v0.4.0

type EmbedderConfig struct {
	// Provider selects the embedding backend: "ollama" (default) | "lmstudio".
	Provider string         `mapstructure:"provider"`
	LMStudio LMStudioConfig `mapstructure:"lmstudio"`
}

EmbedderConfig selects which local embedding provider to use.

func (EmbedderConfig) String added in v0.4.0

func (c EmbedderConfig) String() string

String returns a human-readable representation of EmbedderConfig.

type EntityResolutionConfig added in v0.6.0

type EntityResolutionConfig struct {
	SimilarityThreshold float64 `mapstructure:"similarity_threshold"`
	MaxCandidates       int     `mapstructure:"max_candidates"`
}

EntityResolutionConfig holds entity resolution parameters.

type FactExtractionConfig added in v0.6.0

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

FactExtractionConfig holds fact extraction settings.

type HooksConfig added in v0.10.0

type HooksConfig struct {
	// PostTurnConcurrency controls the number of memories processed concurrently
	// in PostTurnHook.Execute. Must be between 1 and 16; defaults to 4.
	PostTurnConcurrency int `mapstructure:"post_turn_concurrency"`
}

HooksConfig holds configuration for the PostTurn hook pipeline.

type LMStudioConfig added in v0.10.0

type LMStudioConfig struct {
	// URL is the base URL of the LM Studio server. Defaults to http://localhost:1234.
	URL string `mapstructure:"url"`
	// Model is the embedding model to request. Required when provider is "lmstudio".
	Model string `mapstructure:"model"`
}

LMStudioConfig holds settings for the LM Studio local embedding provider.

type LoggingConfig

type LoggingConfig struct {
	Level  string `mapstructure:"level"`
	Format string `mapstructure:"format"`
}

LoggingConfig holds structured logging settings.

type MemgraphConfig added in v0.7.1

type MemgraphConfig struct {
	URI      string `mapstructure:"uri"`
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
	Database string `mapstructure:"database"`
}

MemgraphConfig holds Memgraph database connection settings.

type MemoryConfig

type MemoryConfig struct {
	MemoryDir          string  `mapstructure:"memory_dir"`
	ChunkSize          int     `mapstructure:"chunk_size"`
	ChunkOverlap       int     `mapstructure:"chunk_overlap"`
	DedupThreshold     float64 `mapstructure:"dedup_threshold"`
	DedupThresholdHook float64 `mapstructure:"dedup_threshold_hook"` // default 0.95
	DefaultTTLHours    int     `mapstructure:"default_ttl_hours"`
	VectorDimension    uint64  `mapstructure:"vector_dimension"`
}

MemoryConfig holds memory indexing and deduplication settings.

type OllamaConfig

type OllamaConfig struct {
	BaseURL string `mapstructure:"base_url"`
	Model   string `mapstructure:"model"`
}

OllamaConfig holds Ollama embedding service settings.

type RecallConfig added in v0.4.0

type RecallConfig struct {
	RerankScoreSpreadThreshold float64             `mapstructure:"rerank_score_spread_threshold"`
	RerankLatencyBudgetHooksMs int                 `mapstructure:"rerank_latency_budget_hooks_ms"`
	RerankLatencyBudgetCLIMs   int                 `mapstructure:"rerank_latency_budget_cli_ms"`
	GraphBudgetMs              int                 `mapstructure:"graph_budget_ms"`
	GraphBudgetCLIMs           int                 `mapstructure:"graph_budget_cli_ms"`
	Weights                    RecallWeightsConfig `mapstructure:"weights"`
}

RecallConfig holds re-ranking and latency budget settings for recall.

type RecallWeightsConfig added in v0.4.0

type RecallWeightsConfig struct {
	Similarity    float64 `mapstructure:"similarity"`
	Recency       float64 `mapstructure:"recency"`
	Frequency     float64 `mapstructure:"frequency"`
	TypeBoost     float64 `mapstructure:"type_boost"`
	ScopeBoost    float64 `mapstructure:"scope_boost"`
	Confidence    float64 `mapstructure:"confidence"`
	Reinforcement float64 `mapstructure:"reinforcement"`
	TagAffinity   float64 `mapstructure:"tag_affinity"`
}

RecallWeightsConfig holds the scoring weights for the recall ranking formula.

type SentryConfig added in v0.10.0

type SentryConfig struct {
	DSN         string `mapstructure:"dsn"`
	Environment string `mapstructure:"environment"`
}

SentryConfig holds Sentry error tracking settings.

Jump to

Keyboard shortcuts

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