from pydantic_settings import BaseSettings from functools import lru_cache class Settings(BaseSettings): # Ollama cloud ollama_host: str = "https://ollama.com" ollama_api_key: str = "" ollama_model: str = "gpt-oss:120b-cloud" # Redis redis_url: str = "redis://localhost:6379" # CORS (comma-separated) cors_origins: str = "http://localhost:3000" # App debug: bool = False log_level: str = "INFO" # Model embedding_model: str = "all-MiniLM-L6-v2" # Matching bm25_prefilter_threshold: int = 200 bm25_top_k: int = 500 @property def cors_origins_list(self) -> list[str]: return [o.strip() for o in self.cors_origins.split(",") if o.strip()] model_config = {"env_file": ".env", "case_sensitive": False, "extra": "ignore"} @lru_cache def get_settings() -> Settings: return Settings() settings = get_settings()