BEASTZZZ commited on
Commit
6cccf29
·
verified ·
1 Parent(s): a3777f8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -2
app.py CHANGED
@@ -117,7 +117,7 @@ CONFIG = {
117
  },
118
  "nlp": {
119
  "provider": "groq",
120
- "model": "llama-3.1-8b-instant",
121
  "max_comments_per_batch": 20,
122
  "clustering": {
123
  "min_k": 3,
@@ -524,7 +524,11 @@ class PRSScraper:
524
  # =====================================================================
525
 
526
  GROQ_URL = "https://api.groq.com/openai/v1/chat/completions"
527
- DEFAULT_MODEL = "llama-3.1-8b-instant"
 
 
 
 
528
 
529
 
530
  class GroqError(RuntimeError):
@@ -559,6 +563,15 @@ def call_groq_json(system_prompt: str, user_prompt: str, model: str = DEFAULT_MO
559
  logger.warning("Groq rate-limited, backing off %ss", wait)
560
  time.sleep(wait)
561
  continue
 
 
 
 
 
 
 
 
 
562
  resp.raise_for_status()
563
  content = resp.json()["choices"][0]["message"]["content"]
564
  return json.loads(content)
 
117
  },
118
  "nlp": {
119
  "provider": "groq",
120
+ "model": "openai/gpt-oss-20b",
121
  "max_comments_per_batch": 20,
122
  "clustering": {
123
  "min_k": 3,
 
524
  # =====================================================================
525
 
526
  GROQ_URL = "https://api.groq.com/openai/v1/chat/completions"
527
+ # Groq deprecated llama-3.1-8b-instant (announced 2026-06-17); by
528
+ # 2026-08-24 it's fully decommissioned and returns 404 instead of a
529
+ # softer 400 model_decommissioned error. openai/gpt-oss-20b is Groq's
530
+ # recommended replacement. See https://console.groq.com/docs/deprecations
531
+ DEFAULT_MODEL = "openai/gpt-oss-20b"
532
 
533
 
534
  class GroqError(RuntimeError):
 
563
  logger.warning("Groq rate-limited, backing off %ss", wait)
564
  time.sleep(wait)
565
  continue
566
+ if resp.status_code in (400, 404):
567
+ # Bad model name / malformed request — retrying with the
568
+ # same payload will never succeed, so fail immediately
569
+ # instead of burning 3 attempts x backoff sleep per call.
570
+ raise GroqError(
571
+ f"Groq call failed with {resp.status_code} for model "
572
+ f"{model!r} — not retrying (this is a request/model "
573
+ f"problem, not transient): {resp.text[:300]}"
574
+ )
575
  resp.raise_for_status()
576
  content = resp.json()["choices"][0]["message"]["content"]
577
  return json.loads(content)