File size: 904 Bytes
ff7b177
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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()