from concurrent.futures import ThreadPoolExecutor from dataclasses import dataclass import os from dotenv import load_dotenv from core.rate_gate import RateGate load_dotenv() @dataclass(frozen=True) class Settings: api_key: str | None = os.environ.get("API_KEY") groq_api_key: str | None = os.environ.get("GROQ_API_KEY") groq_model: str = os.environ.get("GROQ_MODEL", "llama-3.1-8b-instant") supabase_url: str | None = os.environ.get("SUPABASE_URL") supabase_service_key: str | None = os.environ.get("SUPABASE_SERVICE_KEY") database_url: str | None = os.environ.get("DATABASE_URL") shopify_api_version: str = os.environ.get("SHOPIFY_API_VERSION", "2024-01") embedding_model: str = os.environ.get("EMBEDDING_MODEL", "all-MiniLM-L6-v2") settings = Settings() APP_TITLE = "ReplyFlow RAG API" APP_DESCRIPTION = "Multi-brand comment reply API powered by RAG + Shopify" APP_VERSION = "2.0.0" query_executor = ThreadPoolExecutor(max_workers=20, thread_name_prefix="query") ingest_executor = ThreadPoolExecutor(max_workers=9, thread_name_prefix="ingest") shopify_gate = RateGate(max_concurrent=5, min_interval=0.1) groq_gate = RateGate(max_concurrent=10, min_interval=0.05)