diff --git a/llama_stack/providers/remote/inference/groq/groq.py b/llama_stack/providers/remote/inference/groq/groq.py index 22369e7e6b..5e2a0513d4 100644 --- a/llama_stack/providers/remote/inference/groq/groq.py +++ b/llama_stack/providers/remote/inference/groq/groq.py @@ -125,12 +125,14 @@ async def chat_completion( ) ) - try: + try: response = self._get_client().chat.completions.create(**request) except groq.BadRequestError as e: if e.body.get("error", {}).get("code") == "tool_use_failed": # For smaller models, Groq may fail to call a tool even when the request is well formed - raise ValueError("Groq failed to call a tool", e.body.get("error", {})) + raise ValueError( + "Groq failed to call a tool", e.body.get("error", {}) + ) from e else: raise e