Aug 19 - Update: AI model since the old one no longer exist

This commit is contained in:
2026-08-19 11:29:12 -04:00
parent 070e9be993
commit 1a9666d731
2 changed files with 24 additions and 3 deletions
+23 -2
View File
@@ -161,6 +161,10 @@ INSPECTOR_FAQS = [
]
#: Groq model used when GROQ_MODEL is unset. Verified available Aug 2026.
#: Groq retires models periodically — see the error handler in chat_message().
_DEFAULT_GROQ_MODEL = 'openai/gpt-oss-120b'
# Soft cap on injected knowledge to keep prompt size (and token cost) reasonable.
_KB_MAX_CHARS = 6000
@@ -397,7 +401,14 @@ def chat_message():
messages.append({'role': m['role'], 'content': _redact_pii(m['content'])})
messages.append({'role': 'user', 'content': _redact_pii(user_message)})
model = os.environ.get('GROQ_MODEL', 'llama-3.3-70b-versatile')
# Default model. Groq RETIRES models without notice, and when the
# configured one disappears every question fails with the generic
# "problem reaching the AI assistant" reply — invisible until a
# customer complains. That is exactly how llama-3.3-70b-versatile
# took the chat down (404 model_not_found, Aug 2026). If this
# happens again, check the log line below and set GROQ_MODEL to a
# current model — no deploy needed.
model = os.environ.get('GROQ_MODEL', _DEFAULT_GROQ_MODEL)
completion = client.chat.completions.create(
model=model,
messages=messages,
@@ -406,7 +417,17 @@ def chat_message():
)
reply = completion.choices[0].message.content.strip()
except Exception as exc:
logger.error('SUPPORT | Groq error: %s', exc)
# Always name the model — a bare "Groq error" gives whoever reads
# the log nothing to act on, and a retired model is the most likely
# cause of a total outage here.
if 'model_not_found' in str(exc) or 'does not exist' in str(exc):
logger.error(
'SUPPORT | Groq model %r is not available on this account — '
'the assistant is DOWN for every user. Set GROQ_MODEL to a '
'current model (see https://console.groq.com/docs/models). '
'Underlying error: %s', model, exc)
else:
logger.error('SUPPORT | Groq error (model=%r): %s', model, exc)
reply = ("I ran into a problem reaching the AI assistant. "
"Please try again, or use **Submit to Support** to contact our team.")