Spaces:
Sleeping
Sleeping
Update app/core/model_loader.py
Browse files- app/core/model_loader.py +6 -4
app/core/model_loader.py
CHANGED
|
@@ -38,11 +38,13 @@ class LLMSingleton:
|
|
| 38 |
raw_key = os.getenv("GROQ_API_KEY", "")
|
| 39 |
self.api_key = raw_key.strip().strip('"').strip("'") if raw_key else ""
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
self.
|
| 44 |
-
else:
|
| 45 |
self.client = Groq(api_key=self.api_key)
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
# 2. Load and sanitize Model Name
|
| 48 |
raw_model = os.getenv("GROQ_MODEL", DEFAULT_MODEL)
|
|
|
|
| 38 |
raw_key = os.getenv("GROQ_API_KEY", "")
|
| 39 |
self.api_key = raw_key.strip().strip('"').strip("'") if raw_key else ""
|
| 40 |
|
| 41 |
+
# Debug check for API key loading status
|
| 42 |
+
if self.api_key:
|
| 43 |
+
logger.info(f"✅ Loaded GROQ_API_KEY successfully! (Length: {len(self.api_key)}, Starts with: {self.api_key[:4]})")
|
|
|
|
| 44 |
self.client = Groq(api_key=self.api_key)
|
| 45 |
+
else:
|
| 46 |
+
logger.error("❌ GROQ_API_KEY is empty or missing from environment variables!")
|
| 47 |
+
self.client = None
|
| 48 |
|
| 49 |
# 2. Load and sanitize Model Name
|
| 50 |
raw_model = os.getenv("GROQ_MODEL", DEFAULT_MODEL)
|