{"record":{"id":"a7c72b5ac563ff19","repo":"BerriAI/litellm","slug":"unexpected-delta-type-delta-type","errorCode":null,"errorMessage":"Unexpected delta type: {delta_type}","messagePattern":"Unexpected delta type: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/gemini/realtime/transformation.py","lineNumber":173,"sourceCode":"            parts: Final = model_turn[\"parts\"]\n            if len(parts) != 1:\n                verbose_logger.warning(\"Realtime: Expected 1 part, got %s for Gemini model turn event.\", len(parts))\n            part: Final = parts[0]\n            if \"text\" in part:\n                return OpenAIRealtimeEventTypes.RESPONSE_TEXT_DELTA\n            elif \"inlineData\" in part:\n                return OpenAIRealtimeEventTypes.RESPONSE_AUDIO_DELTA\n            else:\n                raise ValueError(f\"Unexpected part type: {part}\")\n        raise ValueError(f\"Unexpected model turn event, no 'parts' key: {model_turn}\")\n\n    def map_generation_complete_event(self, delta_type: ALL_DELTA_TYPES | None) -> OpenAIRealtimeEventTypes:\n        if delta_type == \"text\":\n            return OpenAIRealtimeEventTypes.RESPONSE_TEXT_DONE\n        elif delta_type == \"audio\":\n            return OpenAIRealtimeEventTypes.RESPONSE_AUDIO_DONE\n        else:\n            raise ValueError(f\"Unexpected delta type: {delta_type}\")\n\n    def get_audio_mime_type(self, input_audio_format: str = \"pcm16\"):\n        mime_types: Final = {\n            \"pcm16\": \"audio/pcm;rate=24000\",\n            \"g711_ulaw\": \"audio/pcmu\",\n            \"g711_alaw\": \"audio/pcma\",\n        }\n\n        return mime_types.get(input_audio_format, \"application/octet-stream\")\n\n    def _manual_turn_detection_enabled(self, session_configuration_request: str | None) -> bool:\n        if not session_configuration_request:\n            return False\n        try:\n            setup: Final = json.loads(session_configuration_request).get(\"setup\", {})\n            automatic_detection: Final = setup.get(\"realtimeInputConfig\", {}).get(\"automaticActivityDetection\", {})\n            return isinstance(automatic_detection, dict) and automatic_detection.get(\"disabled\") is True\n        except (json.JSONDecodeError, TypeError, AttributeError):","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/gemini/realtime/transformation.py#L155-L191","documentation":"Error \"Unexpected delta type: {delta_type}\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/gemini/realtime/transformation.py:173 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The realtime stream sent a part type this litellm version does not map; upgrade litellm to handle newer Gemini Live event shapes."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}