BerriAI/litellm · error

Error transforming Deepgram response

Error message

Error transforming Deepgram response: {e}
Response: {raw_response.text}

What it means

Transform failure in the Deepgram transcription response handler: while mapping the Deepgram JSON (channels/alternatives/words) into the OpenAI-style shape, an expected key was missing or malformed, and the handler surfaces the exception plus the raw response text.

Solutions

  1. Inspect the raw response in the error; Deepgram returned a payload the transformer did not expect.
  2. Verify the requested Deepgram model and transcription options are valid for your audio input.
  3. Upgrade litellm if the response schema differs from what your version handles.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at litellm/llms/deepgram/audio_transcription/transformation.py:126 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/7e7d5d86a78c202b. Report an issue: GitHub.

Appendix: source

Thrown at litellm/llms/deepgram/audio_transcription/transformation.py:126

            detected_language: Final = first_channel.get("detected_language")
            response["language"] = detected_language if detected_language else "en"

            response["duration"] = response_json["metadata"]["duration"]

            # Transform words to match OpenAI format
            if "words" in first_alternative:
                response["words"] = [
                    {"word": word["word"], "start": word["start"], "end": word["end"]}
                    for word in first_alternative["words"]
                ]

            # Store full response in hidden params
            response._hidden_params = response_json

            return response

        except Exception as e:
            raise ValueError(f"Error transforming Deepgram response: {e}\nResponse: {raw_response.text}")

    def _reconstruct_diarized_transcript(self, words: list) -> str:
        """
        Reconstructs a diarized transcript from words with speaker information.

        Args:
            words: List of word objects with speaker, word, and optionally punctuated_word

        Returns:
            Formatted transcript with speaker labels
        """
        if not words:
            return ""

        segments: Final = []
        current_speaker = None
        current_words: list[str] = []

View on GitHub (pinned to 77b7c6c40c)