Documentation
¶
Index ¶
Constants ¶
const DefaultChunkInterval = 1 * time.Hour
DefaultChunkInterval is the default inactivity period before a session becomes a topic.
const DefaultRecentTopicsInContext = 3
DefaultRecentTopicsInContext is the default number of recent topics to show in context.
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 BotConfig ¶
type BotConfig struct {
Language string `yaml:"language" env:"LAPLACED_BOT_LANGUAGE"`
BotName string `yaml:"bot_name" env:"LAPLACED_BOT_NAME"`
AllowedUserIDs []int64 `yaml:"allowed_user_ids" env:"LAPLACED_ALLOWED_USER_IDS"`
SystemPrompt string `yaml:"system_prompt"` // Deprecated: moved to i18n
SystemPromptExtra string `yaml:"system_prompt_extra"` // New
TurnWaitDuration string `yaml:"turn_wait_duration"`
}
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"`
RAG RAGConfig `yaml:"rag"`
Tools []ToolConfig `yaml:"tools"`
Bot BotConfig `yaml:"bot"`
Database struct {
Path string `yaml:"path" env:"LAPLACED_DATABASE_PATH"`
} `yaml:"database"`
Yandex YandexConfig `yaml:"yandex"`
}
func Load ¶
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 ¶
LoadDefault loads the embedded default configuration.
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"`
Model string `yaml:"model" env:"LAPLACED_OPENROUTER_MODEL"`
PDFParserEngine string `yaml:"pdf_parser_engine"`
RequestCost float64 `yaml:"request_cost"`
PriceTiers []PriceTier `yaml:"price_tiers"`
}
type RAGConfig ¶
type RAGConfig struct {
Enabled bool `yaml:"enabled" env:"LAPLACED_RAG_ENABLED"`
EmbeddingModel string `yaml:"embedding_model"`
SummaryModel string `yaml:"summary_model"`
QueryModel string `yaml:"query_model"`
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"` // New
MinSafetyThreshold float64 `yaml:"min_safety_threshold"` // New
MaxChunkSize int `yaml:"max_chunk_size"` // New
BackfillBatchSize int `yaml:"backfill_batch_size"`
BackfillInterval string `yaml:"backfill_interval"`
TopicModel string `yaml:"topic_model"`
ChunkInterval string `yaml:"chunk_interval"`
MaxMergedSizeChars int `yaml:"max_merged_size_chars"` // Max combined size for topic merge (default 50000)
SplitThresholdChars int `yaml:"split_threshold_chars"` // Threshold for splitting large topics
RecentTopicsInContext int `yaml:"recent_topics_in_context"` // Number of recent topics to show in context (metadata only)
TopicExtractionPrompt string `yaml:"topic_extraction_prompt"` // Deprecated: moved to i18n
EnrichmentPrompt string `yaml:"enrichment_prompt"` // Deprecated: moved to i18n
Reranker RerankerConfig `yaml:"reranker"` // v0.4
}
func (*RAGConfig) GetChunkDuration ¶ added in v0.4.6
GetChunkDuration returns the parsed chunk interval duration. Falls back to DefaultChunkInterval if not configured or invalid.
func (*RAGConfig) GetRecentTopicsInContext ¶ added in v0.4.6
GetRecentTopicsInContext returns the number of recent topics to include in context. Falls back to DefaultRecentTopicsInContext if not configured. Returns 0 to disable.
func (*RAGConfig) GetSplitThreshold ¶ added in v0.4.6
GetSplitThreshold returns the threshold for splitting large topics. Falls back to DefaultSplitThreshold if not configured.
type RerankerConfig ¶ added in v0.4.1
type RerankerConfig struct {
Enabled bool `yaml:"enabled" env:"LAPLACED_RAG_RERANKER_ENABLED"`
Model string `yaml:"model" env:"LAPLACED_RAG_RERANKER_MODEL"`
Candidates int `yaml:"candidates" env:"LAPLACED_RAG_RERANKER_CANDIDATES"` // summaries to show Flash
MaxTopics int `yaml:"max_topics" env:"LAPLACED_RAG_RERANKER_MAX_TOPICS"` // max topics in final selection
MaxPeople int `yaml:"max_people" env:"LAPLACED_RAG_RERANKER_MAX_PEOPLE"` // max people in final selection (v0.5)
Timeout string `yaml:"timeout" env:"LAPLACED_RAG_RERANKER_TIMEOUT"` // timeout for entire reranker flow
TurnTimeout string `yaml:"turn_timeout" env:"LAPLACED_RAG_RERANKER_TURN_TIMEOUT"` // timeout per LLM turn (default: Timeout / (MaxToolCalls+1))
MaxToolCalls int `yaml:"max_tool_calls" env:"LAPLACED_RAG_RERANKER_MAX_TOOL_CALLS"` // max tool calls before stopping
ThinkingLevel string `yaml:"thinking_level" env:"LAPLACED_RAG_RERANKER_THINKING_LEVEL"` // reasoning effort: "minimal", "low", "medium", "high" (default: "minimal")
LargeTopicThreshold int `yaml:"large_topic_threshold" env:"LAPLACED_RAG_RERANKER_LARGE_TOPIC_THRESHOLD"` // chars threshold for excerpt request (default 25000)
TargetContextChars int `yaml:"target_context_chars" env:"LAPLACED_RAG_RERANKER_TARGET_CONTEXT_CHARS"` // target total chars for all selected topics (default 25000)
IgnoreExcerpts bool `yaml:"ignore_excerpts" env:"LAPLACED_RAG_RERANKER_IGNORE_EXCERPTS"` // if true, always use full topic content instead of excerpts
}
RerankerConfig configures the agentic LLM reranker for RAG candidates (v0.4)
type ToolConfig ¶
type YandexConfig ¶
type YandexConfig struct {
Enabled bool `yaml:"enabled" env:"LAPLACED_YANDEX_ENABLED"`
APIKey string `yaml:"api_key" env:"LAPLACED_YANDEX_API_KEY"`
FolderID string `yaml:"folder_id" env:"LAPLACED_YANDEX_FOLDER_ID"`
Language string `yaml:"language"`
AudioFormat string `yaml:"audio_format"`
SampleRate string `yaml:"sample_rate"`
}