fix(adapters): raise a clear error for Groq embeddings#1536
Merged
Conversation
…y Groq API)
Groq has no text embeddings API, but GroqEmbeddingModel defaulted to 'llama-3.1-8b-instant' (a Groq chat model), causing a cryptic failure on first use. Raise a clear NotImplementedError instead, covering both GroqEmbeddingModel() and EmbeddingModel.from_name('groq'). Remove the broken example usage, mark Groq embedding as unsupported in the docs table, and add unit tests.
Signed-off-by: Edgar Bruney Castañeda Torres <edgar.castaneda@ibm.com>
Contributor
There was a problem hiding this comment.
Code Review
This pull request disables the unsupported Groq embedding model and updates the documentation, examples, and tests accordingly. Since Groq does not offer a text embeddings API, the GroqEmbeddingModel class now explicitly raises a NotImplementedError with a clear, actionable error message. I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
#1537
The
GroqEmbeddingModelshipped with a defaultmodel_idof"llama-3.1-8b-instant", which is a Groq chat model — not an embedding model. Worse, Groq does not expose a text embeddings API at all (Groq models), so constructing the model without an explicitmodel_id(e.g.EmbeddingModel.from_name("groq")orGroqEmbeddingModel()) produced a cryptic provider failure on the first request.This PR makes the limitation explicit instead of failing obscurely:
GroqEmbeddingModel.__init__now raises a clearNotImplementedErrorexplaining that Groq has no embeddings API and pointing to providers that do (OpenAI, Ollama, watsonx, Gemini, MistralAI). Because the dynamic model loader resolves the same class, this also coversEmbeddingModel.from_name("groq").GroqEmbeddingModel()usage frompython/examples/backend/providers/groq.py.docs/src/content/docs/modules/backend.mdx: Groq embedding✅ → ❌, and drops the misleadingGROQ_EMBEDDING_MODELenv var.python/tests/adapters/groq/) asserting both construction paths raise the clear error.No breaking change for working code: there was no valid Groq embedding configuration before, so any prior usage already failed at runtime — now it fails immediately with an actionable message.
Checklist
General
Pythonfor Python changes,TypeScriptfor TypeScript changesCode quality checks
mise check(mise fixto auto-fix)Testing
mise test:unitmise test:e2eDocumentation
mise docs:fix