File size: 1,197 Bytes
de28957
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ea04d87
 
de28957
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
42
43
44
45
46
47
48
49
from functools import lru_cache

from pydantic_settings import BaseSettings, SettingsConfigDict


class Settings(BaseSettings):
    model_config = SettingsConfigDict(
        env_file=".env",
        env_file_encoding="utf-8",
        extra="ignore",
    )

    # --- App ---
    env: str = "development"
    log_level: str = "info"
    port: int = 8002

    # --- LLM ---
    groq_api_key: str
    nvidia_api_key: str = ""
    
    # --- Internal service auth (shared secret with Django) ---
    chat_service_internal_token: str = ""

    # --- Postgres (read-only role) ---
    postgres_readonly_url: str = ""

    # --- Neo4j (Aura Free — no RBAC, enforcement is app-level only) ---
    neo4j_uri: str = ""
    neo4j_user: str = ""
    neo4j_password: str = ""

    # --- Redis ---
    redis_url: str = ""

    # --- Chat session behavior ---
    chat_session_ttl_seconds: int = 86400
    chat_history_max_turns: int = 10

    # --- NLP EMBED ---
    nlp_service_url: str = ""
    nlp_service_token: str = ""


@lru_cache
def get_settings() -> Settings:
    """Cached settings instance — reads .env once per process."""
    return Settings()