Course
llm-zoomcamp
Question
Q: starter.py crashes with openai.OpenAIError: Missing credentials even though I'm using Groq, not OpenAI. Why?
Q: I get openai.NotFoundError: Error code: 404 - The model 'qwen/qwen3-32b' does not exist. What happened?
Q: rag_helper.py's RAGBase.llm() uses self.llm_client.responses.create(...). When I point that at Groq, I get errors. Why?
Q: My 4 repeated homework runs fail with Request too large ... Limit 8000, Requested 8581, ... rate_limit_exceeded. Retrying with delays didn't help. Why?
Answer
A: starter.py builds its own client = OpenAI() for its own if name == "main" demo block. If you from starter import index to reuse the search index, Python still runs the entire file top-to-bottom — including that OpenAI() line — which requires OPENAI_API_KEY to exist, even if it's never actually used. Fix: add a placeholder value to your .env file:
OPENAI_API_KEY=not-needed-using-groq-instead
It doesn't need to be a real key — the client only checks that something is set at construction time, and never actually authenticates unless you call it.
A: I get openai.NotFoundError: Error code: 404 - The model 'qwen/qwen3-32b' does not exist. What happened?
A: responses.create() is OpenAI's newer Responses API, which Groq does not support — Groq only implements the older Chat Completions API (chat.completions.create). If you're adapting this homework to run on Groq, you need to override llm() (and rag(), since it depends on llm()'s return shape) in a subclass, using chat.completions.create instead, and reading the answer from response.choices[0].message.content rather than response.output_text.
A: This isn't a rate-limit-that-resets problem — check the numbers. If a single request already needs more tokens than your tier's per-minute cap (Groq's free tier caps at 8,000 TPM), no amount of waiting between calls fixes it, since even the first call alone exceeds the limit. The actual fix is reducing how much context you send per call — e.g. lowering num_results in your search function (from 5 down to 2) cuts the retrieved context enough to fit comfortably under the cap.
Checklist
Course
llm-zoomcamp
Question
Q: starter.py crashes with openai.OpenAIError: Missing credentials even though I'm using Groq, not OpenAI. Why?
Q: I get openai.NotFoundError: Error code: 404 - The model 'qwen/qwen3-32b' does not exist. What happened?
Q: rag_helper.py's RAGBase.llm() uses self.llm_client.responses.create(...). When I point that at Groq, I get errors. Why?
Q: My 4 repeated homework runs fail with Request too large ... Limit 8000, Requested 8581, ... rate_limit_exceeded. Retrying with delays didn't help. Why?
Answer
A: starter.py builds its own client = OpenAI() for its own if name == "main" demo block. If you from starter import index to reuse the search index, Python still runs the entire file top-to-bottom — including that OpenAI() line — which requires OPENAI_API_KEY to exist, even if it's never actually used. Fix: add a placeholder value to your .env file:
OPENAI_API_KEY=not-needed-using-groq-instead
It doesn't need to be a real key — the client only checks that something is set at construction time, and never actually authenticates unless you call it.
A: I get openai.NotFoundError: Error code: 404 - The model 'qwen/qwen3-32b' does not exist. What happened?
A: responses.create() is OpenAI's newer Responses API, which Groq does not support — Groq only implements the older Chat Completions API (chat.completions.create). If you're adapting this homework to run on Groq, you need to override llm() (and rag(), since it depends on llm()'s return shape) in a subclass, using chat.completions.create instead, and reading the answer from response.choices[0].message.content rather than response.output_text.
A: This isn't a rate-limit-that-resets problem — check the numbers. If a single request already needs more tokens than your tier's per-minute cap (Groq's free tier caps at 8,000 TPM), no amount of waiting between calls fixes it, since even the first call alone exceeds the limit. The actual fix is reducing how much context you send per call — e.g. lowering num_results in your search function (from 5 down to 2) cuts the retrieved context enough to fit comfortably under the cap.
Checklist