2026-07-17 18:54:25 +02:00

57 lines
1.5 KiB
Python

"""Configuration management for LightRAG sidecar."""
from pydantic_settings import BaseSettings
from typing import Literal
class Settings(BaseSettings):
"""Application settings from environment variables."""
# Server
LIGHTRAG_PORT: int = 3140
ENVIRONMENT: Literal["development", "production"] = "production"
# Domain & domain configuration
LIGHTRAG_DOMAIN: str = "transceiver" # Active domain
MAX_DOMAINS: int = 5 # Support multiple domains
# LLM Backend
LLM_BACKEND: Literal["ollama", "claude"] = "ollama"
OLLAMA_URL: str = "http://localhost:11434"
OLLAMA_MODEL: str = "qwen2.5:14b" # For entity extraction
# Vector Search
QDRANT_URL: str = "http://localhost:6333"
EMBEDDING_MODEL: str = "bge-m3" # Multilingual, 384-dim
EMBEDDING_BATCH_SIZE: int = 32
VECTOR_SIMILARITY_THRESHOLD: float = 0.7
# Database
DATABASE_URL: str = "postgresql://tip_kg@localhost/tip_lightrag"
DB_POOL_SIZE: int = 10
DB_ECHO: bool = False # SQL logging
# Ingestion
MAX_WORKERS: int = 4
INGEST_BATCH_SIZE: int = 10
ENTITY_EXTRACTION_TIMEOUT: int = 30 # seconds
# Retrieval
DEFAULT_TOP_K: int = 5
HYBRID_RETRIEVAL_WEIGHTS: dict = {
"bm25": 0.4,
"vector": 0.6
}
# Evaluation
EVAL_Q_PER_DOMAIN: int = 50
EVAL_CONFIDENCE_THRESHOLD: float = 0.7
class Config:
env_file = ".env"
env_file_encoding = "utf-8"
case_sensitive = True
settings = Settings()