47 lines
1.5 KiB
Python
47 lines
1.5 KiB
Python
"""Typed application settings: the only reader of environment variables."""
|
|
|
|
from enum import StrEnum
|
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class AppMode(StrEnum):
|
|
"""Runtime mode: live Spotify + Anthropic, or fixture-replay demo."""
|
|
|
|
LIVE = "live"
|
|
DEMO = "demo"
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""Application settings, loaded from the environment or a .env file."""
|
|
|
|
model_config = SettingsConfigDict(env_file=".env", extra="ignore")
|
|
|
|
app_mode: AppMode = AppMode.DEMO
|
|
spotify_client_id: str = ""
|
|
spotify_redirect_uri: str = "http://127.0.0.1:8888/callback"
|
|
spotify_api_base_url: str = "https://api.spotify.com/v1"
|
|
spotify_timeout_seconds: float = 10.0
|
|
spotify_retry_after_cap_seconds: float = 5.0
|
|
session_cookie_secure: bool = False
|
|
anthropic_api_key: str = ""
|
|
llm_model: str = "claude-sonnet-5"
|
|
intent_effort: str = "low"
|
|
rerank_effort: str = "medium"
|
|
candidate_count: int = 35
|
|
rerank_count: int = 15
|
|
rerank_pool_buffer: int = 5
|
|
grounding_concurrency: int = 6
|
|
grounding_floor: int = 8
|
|
title_similarity_threshold: float = 0.82
|
|
request_deadline_seconds: float = 25.0
|
|
resolution_cache_ttl_seconds: float = 3600.0
|
|
resolution_cache_max_entries: int = 2048
|
|
taste_profile_ttl_seconds: float = 900.0
|
|
playlist_name_prefix: str = "discovery-by-llm"
|
|
spotify_seed_refresh_token: str = ""
|
|
top_items_limit: int = 50
|
|
saved_tracks_limit: int = 100
|
|
|
|
|
|
settings = Settings()
|