NOT-OMEGA commited on
Commit
175e60b
·
verified ·
1 Parent(s): 7fb903d

Update processor_llm.py

Browse files
Files changed (1) hide show
  1. processor_llm.py +7 -1
processor_llm.py CHANGED
@@ -153,13 +153,19 @@ def classify_with_llm(log_msg: str) -> str:
153
  return label
154
 
155
  except Exception as e:
 
 
 
 
 
 
156
  last_err = e
157
  if attempt <= MAX_RETRIES:
158
  logger.warning(f"[LLM] Attempt {attempt} failed ({e}), retrying in {delay:.1f}s…")
159
  time.sleep(delay)
160
  delay *= 2 # exponential backoff
161
  else:
162
- logger.error(f"[LLM] All {MAX_RETRIES + 1} attempts failed. Last error: {e}")
163
 
164
  return "Unclassified"
165
 
 
153
  return label
154
 
155
  except Exception as e:
156
+ # 🚨 JUGAD: Agar credits khatam hain (402), toh turant fallback do
157
+ # Isse UI hang nahi hoga aur retry ka wait nahi karna padega
158
+ if "402" in str(e) or "credits" in str(e).lower():
159
+ logger.error(f"[LLM] Credits Finished (402). Returning Fallback Label.")
160
+ return "Escalated: Manual Review Required (API Limit)"
161
+
162
  last_err = e
163
  if attempt <= MAX_RETRIES:
164
  logger.warning(f"[LLM] Attempt {attempt} failed ({e}), retrying in {delay:.1f}s…")
165
  time.sleep(delay)
166
  delay *= 2 # exponential backoff
167
  else:
168
+ logger.error(f"[LLM] All attempts failed. Last error: {e}")
169
 
170
  return "Unclassified"
171