fix(backend): replace decommissioned gemma2-9b-it with llama-3.3-70b-versatile#133
fix(backend): replace decommissioned gemma2-9b-it with llama-3.3-70b-versatile#133Prabhatyadav60 wants to merge 2 commits intoAOSSIE-Org:mainfrom
Conversation
📝 WalkthroughWalkthroughThis PR updates the LLM model identifier from "gemma2-9b-it" to "llama-3.3-70b-versatile" across five backend modules. No other logic, control flow, or error handling is modified. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
backend/app/modules/facts_check/llm_processing.py (1)
143-148:⚠️ Potential issue | 🟡 MinorPre-existing bug:
parsedis used unbound if JSON parsing fails.Not introduced by this PR, but worth noting: if
json.loadsraises on line 144, theexceptblock logs the error but doesn't setparsedorcontinue/skip. Line 148 then referencesparsed, which will raiseNameErrorand crash the entire function.This risk increases slightly with a model change, as the new model's output format may differ.
Suggested fix
try: parsed = json.loads(content) except Exception as parse_err: logger.error(f"LLM JSON parse error: {parse_err}") + parsed = { + "verdict": "Unknown", + "explanation": f"Parse error: {parse_err}", + "original_claim": claim, + "source_link": source, + }
🧹 Nitpick comments (1)
backend/app/modules/bias_detection/check_bias.py (1)
64-64: Consider centralizing the model identifier into a shared constant.The string
"llama-3.3-70b-versatile"is now hardcoded in five separate files. The next time the model needs to change (as happened with this PR), every occurrence must be found and updated. A single constant (e.g.,GROQ_MODELin a shared config module or environment variable) would make future swaps a one-line change.Example
In a shared config (e.g.,
backend/app/config.py):GROQ_MODEL = os.getenv("GROQ_MODEL", "llama-3.3-70b-versatile")Then in each module:
- model="llama-3.3-70b-versatile", + model=GROQ_MODEL,
9e7592b to
3b4593a
Compare
Fixes #134
Description
The current hardcoded model
gemma2-9b-ithas been decommissioned by Groq, causing the backend to crash withgroq.BadRequestErrorimmediately upon running any analysis (Bias, Chat, or Fact-Check).Changes Proposed
gemma2-9b-itto the stablellama-3.3-70b-versatilemodel.Verification
Reasoning
llama-3.3-70bis natively supported by the existing Groq client, requiring zero code refactoring.Summary by CodeRabbit