ayn / config.py
AndreaNotes1's picture
Upload 12 files
475aa1b verified
Raw History Blame Contribute Delete
2.56 kB
"""
Central configuration for the Ms. Q backend.
All values are pulled from environment variables so nothing sensitive
is ever hard-coded. Copy .env.example to .env locally, and set the same
keys as "Secrets" in your Hugging Face Space settings when deploying.
"""
import os
from pydantic_settings import BaseSettings
class Settings(BaseSettings):
# MongoDB Atlas
MONGODB_URI: str = os.getenv("MONGODB_URI", "")
MONGODB_DB_NAME: str = os.getenv("MONGODB_DB_NAME", "msq_db")
# Auth
JWT_SECRET: str = os.getenv("JWT_SECRET", "change-this-in-production")
JWT_ALGORITHM: str = "HS256"
JWT_EXPIRE_MINUTES: int = 60 * 24 * 7 # 7 days
# ---- LLM provider ----
# "groq" -> free, no credit card (default for launch)
# "anthropic" -> paid, higher quality (upgrade path)
LLM_PROVIDER: str = os.getenv("LLM_PROVIDER", "groq")
GROQ_API_KEY: str = os.getenv("GROQ_API_KEY", "")
GROQ_MODEL: str = os.getenv("GROQ_MODEL", "openai/gpt-oss-120b")
ANTHROPIC_API_KEY: str = os.getenv("ANTHROPIC_API_KEY", "")
ANTHROPIC_MODEL: str = os.getenv("ANTHROPIC_MODEL", "claude-sonnet-4-6")
# ---- Live web search (optional, free) ----
# Free key - https://app.tavily.com (1,000 searches/month, no credit card).
# Leave blank to disable - Ms. Q just won't be offered the search tool.
TAVILY_API_KEY: str = os.getenv("TAVILY_API_KEY", "")
# ---- Document memory / RAG ----
# Name of the MongoDB Atlas Vector Search index (see DEPLOYMENT_GUIDE.md
# for the one-time setup step in the Atlas UI).
VECTOR_INDEX_NAME: str = os.getenv("VECTOR_INDEX_NAME", "vector_index")
# ---- Text-to-speech provider ----
# "piper" -> free, self-hosted, no API key, reliable on cloud hosts (default for launch)
# "edge" -> free, no API key, but often blocked from cloud/datacenter IPs
# "elevenlabs" -> paid, most expressive voices (upgrade path)
TTS_PROVIDER: str = os.getenv("TTS_PROVIDER", "piper")
PIPER_MODEL_PATH: str = os.getenv("PIPER_MODEL_PATH", "/app/voices/en_US-lessac-medium.onnx")
EDGE_TTS_VOICE: str = os.getenv("EDGE_TTS_VOICE", "en-US-AriaNeural")
ELEVENLABS_API_KEY: str = os.getenv("ELEVENLABS_API_KEY", "")
ELEVENLABS_VOICE_ID: str = os.getenv("ELEVENLABS_VOICE_ID", "21m00Tcm4TlvDq8ikWAM") # default calm female voice
# CORS - your deployed Vercel URL(s), comma separated
ALLOWED_ORIGINS: str = os.getenv("ALLOWED_ORIGINS", "http://localhost:3000")
class Config:
env_file = ".env"
settings = Settings()