| import os | |
| from pydantic_settings import BaseSettings | |
| class Settings(BaseSettings): | |
| # Groq API Configuration | |
| groq_api_key: str = os.getenv("GROQ_API_KEY", "") | |
| groq_model: str = os.getenv("GROQ_MODEL", "llama-3.3-70b-versatile") | |
| # API Configuration | |
| api_title: str = "ICD-CPT Coding API" | |
| api_version: str = "1.0.0" | |
| api_description: str = "Medical coding assistant powered by Groq LLaMA 3.3 70B" | |
| class Config: | |
| env_file = ".env" | |
| case_sensitive = False | |
| settings = Settings() | |
| # Validate API key on startup | |
| if not settings.groq_api_key: | |
| print("WARNING: GROQ_API_KEY is not set! API will not function properly.") | |
| print("Please set GROQ_API_KEY in Hugging Face Space secrets.") | |
| else: | |
| print(f"Groq API Key loaded (length: {len(settings.groq_api_key)})") | |
| print(f"Using model: {settings.groq_model}") |