config

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package config provides configuration loading and defaults for the laplaced bot.

Index

Constants

View Source
const (
	// Retrieval thresholds
	DefaultMinSafetyThreshold     = 0.1  // Relaxed for recall - minimum cosine similarity for vector search
	DefaultConsolidationThreshold = 0.75 // Strict for dedup - minimum similarity for topic merge

	// Session formatting limits (for reranker context)
	DefaultMaxSessionMessages = 10  // Recent messages to show reranker
	DefaultMaxCharsPerMessage = 500 // Truncate long messages for reranker

	// Topic retrieval limits
	DefaultRetrievedTopicsCount = 10 // Max topics to retrieve without reranker

	// Consolidation
	DefaultMaxMergedSizeChars = 50000 // 50K chars max for merged topics
	DefaultMergeGapThreshold  = 100   // Max message gap for merge candidate

	// Background loop intervals
	DefaultFactExtractionInterval = 1 * time.Minute  // Check for topics needing fact extraction
	DefaultConsolidationInterval  = 10 * time.Minute // Check for topics needing consolidation
	DefaultChunkProcessingTimeout = 10 * time.Minute // Timeout for processing a single chunk
	DefaultBackfillInterval       = 1 * time.Minute  // Background processing check interval

	// Chunking
	DefaultMaxChunkSize = 400 // Max messages per chunk before forced split

	// Memory
	DefaultFactDefaultImportance = 50 // Default importance for facts without explicit importance

	// Search
	DefaultPeopleSimilarityThreshold = 0.3 // Minimum similarity for people vector search
	DefaultPeopleMaxResults          = 5   // Max results for people vector search
)
View Source
const DefaultChunkInterval = 1 * time.Hour

DefaultChunkInterval is the default inactivity period before a session becomes a topic.

View Source
const DefaultRecentTopicsInContext = 3

DefaultRecentTopicsInContext is the default number of recent topics to show in context.

View Source
const DefaultSplitThreshold = 25000

DefaultSplitThreshold is the default character threshold for splitting large topics.

Variables

This section is empty.

Functions

func DefaultConfigBytes

func DefaultConfigBytes() []byte

DefaultConfigBytes returns the raw embedded default configuration. Useful for generating example config files.

Types

type AgentConfig added in v0.4.7

type AgentConfig struct {
	Name  string `yaml:"name"`
	Model string `yaml:"model"`
}

AgentConfig defines configuration for a single agent.

func (*AgentConfig) GetModel added in v0.4.7

func (a *AgentConfig) GetModel(defaultModel string) string

GetModel returns the agent's model, falling back to default if not set.

type AgentsConfig added in v0.4.7

type AgentsConfig struct {
	Default        AgentConfig          `yaml:"default"`                            // Default model for all agents
	Chat           ChatAgentConfig      `yaml:"chat"`                               // Main bot - talks to users
	ChatModel      string               `yaml:"-" env:"LAPLACED_AGENTS_CHAT_MODEL"` // Override for chat agent model
	Archivist      ArchivistAgentConfig `yaml:"archivist"`                          // Extracts facts and people from conversations
	Enricher       AgentConfig          `yaml:"enricher"`                           // Expands search queries
	Reranker       RerankerAgentConfig  `yaml:"reranker"`                           // Filters and ranks RAG candidates
	Splitter       AgentConfig          `yaml:"splitter"`                           // Splits large topics
	Merger         AgentConfig          `yaml:"merger"`                             // Merges similar topics
	Extractor      ExtractorAgentConfig `yaml:"extractor"`                          // Extracts content from artifacts
	ImageGenerator ImageGeneratorConfig `yaml:"image_generator"`                    // Generates/edits images (v0.8.0)
}

AgentsConfig defines all agents in the system.

func (*AgentsConfig) GetChatModel added in v0.5.3

func (a *AgentsConfig) GetChatModel() string

GetChatModel returns the chat agent's model, applying env override if set.

func (*AgentsConfig) GetChatThinkingLevel added in v0.8.0

func (a *AgentsConfig) GetChatThinkingLevel() string

GetChatThinkingLevel returns the chat agent's reasoning effort level. Falls back to "low" when unset — the minimum supported on Gemini 3.1 Pro. Passing an explicit level prevents the model from leaking internal reasoning into content (see docs/bugs/2026-04-22-laplace-thought-leak/).

type ArchivistAgentConfig added in v0.5.1

type ArchivistAgentConfig struct {
	AgentConfig   `yaml:",inline"`
	ThinkingLevel string `yaml:"thinking_level" env:"LAPLACED_ARCHIVIST_THINKING_LEVEL"`
	Timeout       string `yaml:"timeout" env:"LAPLACED_ARCHIVIST_TIMEOUT"`
	MaxToolCalls  int    `yaml:"max_tool_calls" env:"LAPLACED_ARCHIVIST_MAX_TOOL_CALLS"`
}

ArchivistAgentConfig extends AgentConfig with archivist-specific settings.

func (*ArchivistAgentConfig) GetModel added in v0.5.1

func (a *ArchivistAgentConfig) GetModel(defaultModel string) string

GetModel returns the archivist's model, falling back to default if not set.

type ArtifactsConfig added in v0.6.0

type ArtifactsConfig struct {
	Enabled      bool     `yaml:"enabled" env:"LAPLACED_ARTIFACTS_ENABLED"`
	StoragePath  string   `yaml:"storage_path" env:"LAPLACED_ARTIFACTS_STORAGE_PATH"`
	AllowedTypes []string `yaml:"allowed_types"`

	// Voice settings (about storage filtering, not extraction)
	MinVoiceDurationSeconds int `yaml:"min_voice_duration_seconds" env:"LAPLACED_ARTIFACTS_MIN_VOICE_DURATION_SECONDS"` // 0 = save all, -1 = disable voice artifacts
}

ArtifactsConfig defines configuration for the artifacts system (v0.6.0). Processing settings moved to agents.extractor. RAG settings moved to rag and agents.reranker.artifacts.

type BotConfig

type BotConfig struct {
	Language          string          `yaml:"language" env:"LAPLACED_BOT_LANGUAGE"`
	AllowedUserIDs    []int64         `yaml:"allowed_user_ids" env:"LAPLACED_ALLOWED_USER_IDS"`
	SystemPromptExtra string          `yaml:"system_prompt_extra"`
	TurnWaitDuration  string          `yaml:"turn_wait_duration"`
	Streaming         StreamingConfig `yaml:"streaming"`
}

type ChatAgentConfig added in v0.8.0

type ChatAgentConfig struct {
	AgentConfig   `yaml:",inline"`
	ThinkingLevel string `yaml:"thinking_level" env:"LAPLACED_AGENTS_CHAT_THINKING_LEVEL"`
}

ChatAgentConfig extends AgentConfig with chat-specific settings. Setting ThinkingLevel explicitly prevents Gemini 3.1 Pro from leaking internal reasoning into the user-visible content field (see docs/bugs/2026-04-22-laplace-thought-leak/).

type Config

type Config struct {
	Log struct {
		Level string `yaml:"level" env:"LAPLACED_LOG_LEVEL"`
	} `yaml:"log"`
	Server struct {
		ListenPort string `yaml:"listen_port" env:"LAPLACED_SERVER_PORT"`
		DebugMode  bool   `yaml:"debug_mode" env:"LAPLACED_SERVER_DEBUG"`
		Auth       struct {
			Enabled  bool   `yaml:"enabled" env:"LAPLACED_AUTH_ENABLED"`
			Username string `yaml:"username" env:"LAPLACED_AUTH_USERNAME"`
			Password string `yaml:"password" env:"LAPLACED_AUTH_PASSWORD"`
		} `yaml:"auth"`
	} `yaml:"server"`
	Telegram struct {
		Token         string `yaml:"token" env:"LAPLACED_TELEGRAM_TOKEN"`
		WebhookURL    string `yaml:"webhook_url" env:"LAPLACED_TELEGRAM_WEBHOOK_URL"`
		WebhookPath   string // Auto-generated from token hash (not configurable)
		WebhookSecret string // Auto-generated from token hash (not configurable)
		ProxyURL      string `yaml:"proxy_url" env:"LAPLACED_TELEGRAM_PROXY_URL"`
	} `yaml:"telegram"`
	OpenRouter OpenRouterConfig `yaml:"openrouter"`
	Agents     AgentsConfig     `yaml:"agents"`
	Embedding  EmbeddingConfig  `yaml:"embedding"`
	RAG        RAGConfig        `yaml:"rag"`
	Tools      []ToolConfig     `yaml:"tools"`
	Bot        BotConfig        `yaml:"bot"`
	Database   struct {
		Path string `yaml:"path" env:"LAPLACED_DATABASE_PATH"`
	} `yaml:"database"`
	Artifacts ArtifactsConfig `yaml:"artifacts"`
	Memory    MemoryConfig    `yaml:"memory"`
	Search    SearchConfig    `yaml:"search"`
	Telemetry TelemetryConfig `yaml:"telemetry"`
}

func Load

func Load(path string) (*Config, error)

Load loads configuration from the specified file path. It first loads the embedded default configuration, then merges the user config on top. Finally, it overrides values with environment variables.

func LoadDefault

func LoadDefault() (*Config, error)

LoadDefault loads the embedded default configuration.

func (*Config) Validate added in v0.2.1

func (c *Config) Validate() error

Validate checks configuration for required fields and valid ranges.

Complexity: HIGH (CC=55) - validates many config fields with conditional checks Dependencies: none (pure validation) Side effects: none Error handling: Accumulates all validation errors before returning

Returns an error describing all validation failures.

type EmbeddingConfig added in v0.4.7

type EmbeddingConfig struct {
	Model      string `yaml:"model" env:"LAPLACED_EMBEDDING_MODEL"`
	Dimensions int    `yaml:"dimensions" env:"LAPLACED_EMBEDDING_DIMENSIONS"`
}

EmbeddingConfig defines embedding model settings.

type ExtractorAgentConfig added in v0.6.0

type ExtractorAgentConfig struct {
	AgentConfig `yaml:",inline"` // Name, Model

	// Processing settings (moved from ArtifactsConfig in v0.6.0)
	MaxFileSizeMB      int    `yaml:"max_file_size_mb" env:"LAPLACED_EXTRACTOR_MAX_FILE_SIZE_MB"`
	Timeout            string `yaml:"timeout" env:"LAPLACED_EXTRACTOR_TIMEOUT"`
	MaxRetries         int    `yaml:"max_retries" env:"LAPLACED_EXTRACTOR_MAX_RETRIES"`
	PollingInterval    string `yaml:"polling_interval" env:"LAPLACED_EXTRACTOR_POLLING_INTERVAL"`
	MaxConcurrent      int    `yaml:"max_concurrent" env:"LAPLACED_EXTRACTOR_MAX_CONCURRENT"`
	RecoveryThreshold  string `yaml:"recovery_threshold" env:"LAPLACED_EXTRACTOR_RECOVERY_THRESHOLD"`
	RecentMessageCount int    `yaml:"recent_message_count" env:"LAPLACED_EXTRACTOR_RECENT_MESSAGE_COUNT"` // Number of recent session messages to include in artifact context (0 = disable)
}

ExtractorAgentConfig defines configuration for the Extractor agent (v0.6.0). Processing settings were moved from ArtifactsConfig to keep agent-related config together.

func (*ExtractorAgentConfig) GetModel added in v0.6.0

func (e *ExtractorAgentConfig) GetModel(defaultModel string) string

GetModel returns the extractor's model, falling back to default if not set.

func (*ExtractorAgentConfig) GetPollingInterval added in v0.6.0

func (e *ExtractorAgentConfig) GetPollingInterval() time.Duration

GetPollingInterval returns the interval for polling pending artifacts. Defaults to 30 seconds if not configured.

func (*ExtractorAgentConfig) GetRecoveryThreshold added in v0.6.0

func (e *ExtractorAgentConfig) GetRecoveryThreshold() time.Duration

GetRecoveryThreshold returns the threshold for recovering zombie artifact states. Defaults to 10 minutes if not configured.

func (*ExtractorAgentConfig) GetTimeout added in v0.6.0

func (e *ExtractorAgentConfig) GetTimeout() time.Duration

GetTimeout returns the timeout for artifact processing. Defaults to 2 minutes if not configured.

type ImageGeneratorConfig added in v0.8.0

type ImageGeneratorConfig struct {
	AgentConfig `yaml:",inline"` // Name, Model (e.g. google/gemini-3.1-flash-image-preview)

	Timeout            string `yaml:"timeout" env:"LAPLACED_IMAGE_GENERATOR_TIMEOUT"`
	DefaultAspectRatio string `yaml:"default_aspect_ratio" env:"LAPLACED_IMAGE_GENERATOR_DEFAULT_ASPECT_RATIO"`
	DefaultImageSize   string `yaml:"default_image_size" env:"LAPLACED_IMAGE_GENERATOR_DEFAULT_IMAGE_SIZE"`
	// SupportedImageSizes / SupportedAspectRatios drive the generate_image tool
	// JSON schema. They MUST match what the configured Model accepts upstream —
	// see the commented alternative in default.yaml for verified per-model sets.
	SupportedImageSizes   []string `yaml:"supported_image_sizes" env:"LAPLACED_IMAGE_GENERATOR_SUPPORTED_IMAGE_SIZES" env-separator:","`
	SupportedAspectRatios []string `yaml:"supported_aspect_ratios" env:"LAPLACED_IMAGE_GENERATOR_SUPPORTED_ASPECT_RATIOS" env-separator:","`
	MaxInputImages        int      `yaml:"max_input_images" env:"LAPLACED_IMAGE_GENERATOR_MAX_INPUT_IMAGES"`
	MaxOutputImages       int      `yaml:"max_output_images" env:"LAPLACED_IMAGE_GENERATOR_MAX_OUTPUT_IMAGES"`
	MaxInputImageBytes    int      `yaml:"max_input_image_bytes" env:"LAPLACED_IMAGE_GENERATOR_MAX_INPUT_IMAGE_BYTES"`
	// DocumentThresholdBytes: generated images larger than this are sent via
	// sendDocument instead of sendPhoto, preserving full resolution (Telegram
	// recompresses photos to ~1280 px on long side). Default 2 MB covers
	// 2K/4K outputs; set to 0 to always use sendPhoto.
	DocumentThresholdBytes int `yaml:"document_threshold_bytes" env:"LAPLACED_IMAGE_GENERATOR_DOCUMENT_THRESHOLD_BYTES"`
}

ImageGeneratorConfig defines configuration for the image-generation agent that drives OpenRouter image-output models (v0.8.0).

func (*ImageGeneratorConfig) GetTimeout added in v0.8.0

func (c *ImageGeneratorConfig) GetTimeout() time.Duration

GetTimeout returns the per-call timeout. Defaults to 90s.

type MemoryConfig added in v0.6.1

type MemoryConfig struct {
	FactDefaultImportance int `yaml:"fact_default_importance" env:"LAPLACED_MEMORY_FACT_DEFAULT_IMPORTANCE"`
}

MemoryConfig defines configuration for memory operations.

func (*MemoryConfig) GetFactDefaultImportance added in v0.6.1

func (c *MemoryConfig) GetFactDefaultImportance() int

GetFactDefaultImportance returns the default importance for facts without explicit importance. Falls back to DefaultFactDefaultImportance (50) if not configured.

type OpenRouterConfig

type OpenRouterConfig struct {
	APIKey          string                `yaml:"api_key" env:"LAPLACED_OPENROUTER_API_KEY"`
	ProxyURL        string                `yaml:"proxy_url" env:"LAPLACED_OPENROUTER_PROXY_URL"`
	PDFParserEngine string                `yaml:"pdf_parser_engine"`
	RequestCost     float64               `yaml:"request_cost"`
	PriceTiers      []PriceTier           `yaml:"price_tiers"`
	Provider        ProviderRoutingConfig `yaml:"provider"`
}

type PriceTier

type PriceTier struct {
	UpToTokens     int     `yaml:"up_to_tokens"`
	PromptCost     float64 `yaml:"prompt_cost"`
	CompletionCost float64 `yaml:"completion_cost"`
}

type ProviderRoutingConfig added in v0.9.0

type ProviderRoutingConfig struct {
	Order []string `yaml:"order" env:"LAPLACED_OPENROUTER_PROVIDER_ORDER" env-separator:","`
	// AllowFallbacks is YAML-only: cleanenv doesn't support *bool via env tags.
	// The common case (prefer a provider with default fallback) needs only Order,
	// so this is not a practical limitation.
	AllowFallbacks *bool `yaml:"allow_fallbacks"`
}

ProviderRoutingConfig configures OpenRouter provider preference. See https://openrouter.ai/docs/features/provider-routing for semantics. When Order is empty, no routing header is sent — OpenRouter picks freely. AllowFallbacks is a pointer: unset means "use OpenRouter default (true)"; explicit false means "never fall back outside the order list".

func (ProviderRoutingConfig) ToRouting added in v0.9.0

ToRouting converts the YAML config to an openrouter.ProviderRouting pointer. Returns nil when no preference is configured, so the client stays on OpenRouter's default behavior.

type RAGConfig

type RAGConfig struct {
	Enabled                          bool    `yaml:"enabled" env:"LAPLACED_RAG_ENABLED"`
	MaxContextMessages               int     `yaml:"max_context_messages"`
	MaxProfileFacts                  int     `yaml:"max_profile_facts"`
	RetrievedMessagesCount           int     `yaml:"retrieved_messages_count"`
	RetrievedTopicsCount             int     `yaml:"retrieved_topics_count"`
	SimilarityThreshold              float64 `yaml:"similarity_threshold"`
	ConsolidationSimilarityThreshold float64 `yaml:"consolidation_similarity_threshold"`
	MinSafetyThreshold               float64 `yaml:"min_safety_threshold"`
	MaxChunkSize                     int     `yaml:"max_chunk_size"`
	BackfillBatchSize                int     `yaml:"backfill_batch_size"`
	BackfillInterval                 string  `yaml:"backfill_interval"`
	ChunkInterval                    string  `yaml:"chunk_interval"`
	MaxMergedSizeChars               int     `yaml:"max_merged_size_chars"`
	SplitThresholdChars              int     `yaml:"split_threshold_chars"`
	RecentTopicsInContext            int     `yaml:"recent_topics_in_context"`
}

func (*RAGConfig) GetChunkDuration added in v0.4.6

func (c *RAGConfig) GetChunkDuration() time.Duration

GetChunkDuration returns the parsed chunk interval duration. Falls back to DefaultChunkInterval if not configured or invalid.

func (*RAGConfig) GetConsolidationThreshold added in v0.6.1

func (c *RAGConfig) GetConsolidationThreshold() float64

GetConsolidationThreshold returns the minimum similarity for topic consolidation. Falls back to DefaultConsolidationThreshold (0.75) if not configured. This strict threshold ensures we only merge very similar topics.

func (*RAGConfig) GetMaxChunkSize added in v0.6.1

func (c *RAGConfig) GetMaxChunkSize() int

GetMaxChunkSize returns the max messages per chunk before forced split. Falls back to DefaultMaxChunkSize (400) if not configured.

func (*RAGConfig) GetMaxMergedSizeChars added in v0.6.1

func (c *RAGConfig) GetMaxMergedSizeChars() int

GetMaxMergedSizeChars returns the max character count for merged topics. Falls back to DefaultMaxMergedSizeChars (50000) if not configured.

func (*RAGConfig) GetMinSafetyThreshold added in v0.6.1

func (c *RAGConfig) GetMinSafetyThreshold() float64

GetMinSafetyThreshold returns the minimum cosine similarity for vector search. Falls back to DefaultMinSafetyThreshold (0.1) if not configured. This relaxed threshold prioritizes recall over precision.

func (*RAGConfig) GetRecentTopicsInContext added in v0.4.6

func (c *RAGConfig) GetRecentTopicsInContext() int

GetRecentTopicsInContext returns the number of recent topics to include in context. Falls back to DefaultRecentTopicsInContext if not configured. Returns 0 to disable.

func (*RAGConfig) GetRetrievedTopicsCount added in v0.6.1

func (c *RAGConfig) GetRetrievedTopicsCount() int

GetRetrievedTopicsCount returns the max topics to retrieve without reranker. Falls back to DefaultRetrievedTopicsCount (10) if not configured.

func (*RAGConfig) GetSplitThreshold added in v0.4.6

func (c *RAGConfig) GetSplitThreshold() int

GetSplitThreshold returns the threshold for splitting large topics. Falls back to DefaultSplitThreshold if not configured.

type RerankerAgentConfig added in v0.4.7

type RerankerAgentConfig struct {
	AgentConfig        `yaml:",inline"`
	Enabled            bool   `yaml:"enabled" env:"LAPLACED_RERANKER_ENABLED"`
	Timeout            string `yaml:"timeout" env:"LAPLACED_RERANKER_TIMEOUT"`
	TurnTimeout        string `yaml:"turn_timeout" env:"LAPLACED_RERANKER_TURN_TIMEOUT"`
	MaxToolCalls       int    `yaml:"max_tool_calls" env:"LAPLACED_RERANKER_MAX_TOOL_CALLS"`
	ThinkingLevel      string `yaml:"thinking_level" env:"LAPLACED_RERANKER_THINKING_LEVEL"`
	TargetContextChars int    `yaml:"target_context_chars" env:"LAPLACED_RERANKER_TARGET_CONTEXT_CHARS"`

	// Per-type limits (v0.6.0)
	Topics    RerankerTypeConfig      `yaml:"topics"`
	People    RerankerTypeConfig      `yaml:"people"`
	Artifacts RerankerArtifactsConfig `yaml:"artifacts"`

	// Legacy fields (deprecated, kept for migration)
	Candidates int `yaml:"candidates" env:"LAPLACED_RERANKER_CANDIDATES"`
	MaxTopics  int `yaml:"max_topics" env:"LAPLACED_RERANKER_MAX_TOPICS"`
	MaxPeople  int `yaml:"max_people" env:"LAPLACED_RERANKER_MAX_PEOPLE"`
}

RerankerAgentConfig extends AgentConfig with reranker-specific settings.

func (*RerankerAgentConfig) GetModel added in v0.4.7

func (r *RerankerAgentConfig) GetModel(defaultModel string) string

GetModel returns the reranker's model, falling back to default if not set.

type RerankerArtifactsConfig added in v0.9.0

type RerankerArtifactsConfig struct {
	RerankerTypeConfig `yaml:",inline"`
	Session            RerankerArtifactsSessionConfig `yaml:"session"`
}

RerankerArtifactsConfig extends per-type limits with session-aware injection (artifacts attached to messages still in the active session, topic_id IS NULL).

type RerankerArtifactsSessionConfig added in v0.9.0

type RerankerArtifactsSessionConfig struct {
	Max    int    `yaml:"max" env:"LAPLACED_RERANKER_ARTIFACTS_SESSION_MAX"`
	MaxAge string `yaml:"max_age" env:"LAPLACED_RERANKER_ARTIFACTS_SESSION_MAX_AGE"`
}

RerankerArtifactsSessionConfig governs how many session-active artifacts are injected into the reranker candidate pool and how old they may be.

func (RerankerArtifactsSessionConfig) GetMaxAge added in v0.9.0

GetMaxAge returns the session age cap. Defaults to 24h when session is enabled but max_age is missing or invalid; returns 0 when session is disabled.

func (RerankerArtifactsSessionConfig) IsEnabled added in v0.9.0

func (c RerankerArtifactsSessionConfig) IsEnabled() bool

IsEnabled reports whether session-aware artifact injection is configured. Disabled (zero) by default — the operator must opt in via configs/default.yaml or env var. Tests using testutil.TestConfig() therefore won't trigger the new storage path unless they explicitly configure it.

type RerankerTypeConfig added in v0.6.0

type RerankerTypeConfig struct {
	CandidatesLimit int `yaml:"candidates_limit" env:"LAPLACED_RERANKER_TOPICS_CANDIDATES_LIMIT"`
	Max             int `yaml:"max" env:"LAPLACED_RERANKER_TOPICS_MAX"`
	MaxContextBytes int `yaml:"max_context_bytes,omitempty" env:"LAPLACED_RERANKER_TOPICS_MAX_CONTEXT_BYTES"` // For artifacts only (v0.6.0)
}

RerankerTypeConfig defines per-type reranker limits (v0.6.0). RerankerTypeConfig defines per-type reranker limits (v0.6.0).

type SearchConfig added in v0.6.1

type SearchConfig struct {
	PeopleSimilarityThreshold float64 `yaml:"people_similarity_threshold" env:"LAPLACED_SEARCH_PEOPLE_SIMILARITY_THRESHOLD"`
	PeopleMaxResults          int     `yaml:"people_max_results" env:"LAPLACED_SEARCH_PEOPLE_MAX_RESULTS"`
}

SearchConfig defines configuration for search operations.

func (*SearchConfig) GetPeopleMaxResults added in v0.6.1

func (c *SearchConfig) GetPeopleMaxResults() int

GetPeopleMaxResults returns the max results for people vector search. Falls back to DefaultPeopleMaxResults (5) if not configured.

func (*SearchConfig) GetPeopleSimilarityThreshold added in v0.6.1

func (c *SearchConfig) GetPeopleSimilarityThreshold() float64

GetPeopleSimilarityThreshold returns the minimum similarity for people vector search. Falls back to DefaultPeopleSimilarityThreshold (0.3) if not configured.

type StreamingConfig added in v0.9.0

type StreamingConfig struct {
	Enabled        bool `yaml:"enabled" env:"LAPLACED_BOT_STREAMING_ENABLED"`
	EditThrottleMs int  `yaml:"edit_throttle_ms" env:"LAPLACED_BOT_STREAMING_EDIT_THROTTLE_MS"`
	EditMinChars   int  `yaml:"edit_min_chars" env:"LAPLACED_BOT_STREAMING_EDIT_MIN_CHARS"`
	MaxBufferChars int  `yaml:"max_buffer_chars" env:"LAPLACED_BOT_STREAMING_MAX_BUFFER_CHARS"`
}

StreamingConfig controls progressive bot replies via editMessageText.

When Enabled, the bot sends a placeholder message immediately, edits it with tool-execution status during the agent's tool loop, and then progressively reveals the LLM's content as SSE deltas arrive. EditThrottleMs / EditMinChars throttle edits to keep under Telegram's edit rate limit. MaxBufferChars caps in-bubble streaming — past that the response falls back to the existing finalize+sendResponses path (separate messages).

func (StreamingConfig) GetEditMinChars added in v0.9.0

func (s StreamingConfig) GetEditMinChars() int

GetEditMinChars returns the minimum new-character threshold for an early edit (before the throttle elapses). Defaults to 80 when unset.

func (StreamingConfig) GetEditThrottle added in v0.9.0

func (s StreamingConfig) GetEditThrottle() time.Duration

GetEditThrottle returns the configured throttle as a Duration. Defaults to 1s when unset or non-positive.

func (StreamingConfig) GetMaxBufferChars added in v0.9.0

func (s StreamingConfig) GetMaxBufferChars() int

GetMaxBufferChars returns the in-bubble streaming cap. Defaults to 3400 — a safety margin under Telegram's 4096 UTF-16 limit accounting for HTML expansion.

type TelemetryConfig added in v0.9.0

type TelemetryConfig struct {
	Enabled bool `yaml:"enabled" env:"LAPLACED_TELEMETRY_ENABLED"`
	// Exporter selects the span exporter backend. Valid values: "otlp"
	// (default, sends to an OTLP/gRPC collector like Alloy) and "stdout"
	// (pretty-prints spans to stderr; for local dev where network-level
	// trace delivery is not being tested).
	Exporter     string `yaml:"exporter" env:"LAPLACED_TELEMETRY_EXPORTER"`
	OTLPEndpoint string `yaml:"otlp_endpoint" env:"LAPLACED_TELEMETRY_OTLP_ENDPOINT"`
	ServiceName  string `yaml:"service_name" env:"LAPLACED_TELEMETRY_SERVICE_NAME"`
	// TraceContent, when true, asks tracing to record full content (LLM
	// request/response bodies, raw RAG queries, tool args/results) as span
	// events. Default off — flip only for debug sessions. Also surfaces as
	// resource attribute laplaced.trace_content on the captured trace.
	TraceContent bool `yaml:"trace_content" env:"LAPLACED_TELEMETRY_TRACE_CONTENT"`
}

TelemetryConfig defines configuration for OpenTelemetry export (traces first, metrics and logs as subsequent iterations). Disabled by default — callers must flip `enabled: true` (or set LAPLACED_TELEMETRY_ENABLED=true) to start an exporter. When disabled, the global OTel provider stays no-op.

type ToolConfig

type ToolConfig struct {
	Name                 string `yaml:"name"`
	Model                string `yaml:"model"`
	Description          string `yaml:"description"`
	ParameterDescription string `yaml:"parameter_description"`
}

Jump to

Keyboard shortcuts

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