Distopia22's picture
Fix: Update groq library version and add error handling
c481ed9
raw
history blame contribute delete
758 Bytes
import os
from dotenv import load_dotenv
# Load environment variables from .env file
load_dotenv()
class Settings:
def __init__(self):
self.GROQ_API_KEY = os.getenv("GROQ_API_KEY")
self.MODEL_ID = os.getenv("MODEL_ID", "llama-3.3-70b-versatile")
# Validate required environment variables
if not self.GROQ_API_KEY:
raise ValueError(
"GROQ_API_KEY not found in environment variables. "
"Please set it in Hugging Face Space Settings -> Repository secrets"
)
print(f"βœ… Settings loaded successfully")
print(f"βœ… Model ID: {self.MODEL_ID}")
print(f"βœ… API Key configured: {self.GROQ_API_KEY[:10]}...")
settings = Settings()