The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(responses): emit content_part.added event for non-OpenAI models
Lei Nied560e4c009b6
diff --git a/litellm/responses/litellm_completion_transformation/streaming_iterator.py b/litellm/responses/litellm_completion_transformation/streaming_iterator.pyindex 0672b03bcd7..9acc8f41c2a 100644--- a/litellm/responses/litellm_completion_transformation/streaming_iterator.py+++ b/litellm/responses/litellm_completion_transformation/streaming_iterator.py@@ -845,6 +845,14 @@ class LiteLLMCompletionStreamingIterator(ResponsesAPIStreamingIterator):)event.__dict__["sequence_number"] = self._sequence_numberself._pending_response_events.append(event)++ # Emit content_part.added immediately after output_item.added for message+ # items. The OpenAI Responses spec requires this event before any+ # output_text.delta events so downstream parsers can initialize the+ # text part structure.+ self.sent_content_part_added_event = True+ content_part_event = self.create_content_part_added_event()+ self._pending_response_events.append(content_part_event)returnasync def __anext__(