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): close the message content part as output_text on reasoning turns
Devin AI8ce288788864
diff --git a/litellm/responses/litellm_completion_transformation/streaming_iterator.py b/litellm/responses/litellm_completion_transformation/streaming_iterator.pyindex 71502e33d5c..0cda83d979d 100644--- a/litellm/responses/litellm_completion_transformation/streaming_iterator.py+++ b/litellm/responses/litellm_completion_transformation/streaming_iterator.py@@ -22,7 +22,6 @@ from litellm.types.llms.openai import (ContentPartAddedEvent,ContentPartDoneEvent,ContentPartDonePartOutputText,- ContentPartDonePartReasoningText,FunctionCallArgumentsDeltaEvent,FunctionCallArgumentsDoneEvent,OutputItemAddedEvent,@@ -751,28 +750,19 @@ class LiteLLMCompletionStreamingIterator(ResponsesAPIStreamingIterator):self._cached_item_id = f"msg_{uuid.uuid4()}"text: Final = getattr(litellm_complete_object.choices[0].message, "content", "") or ""- reasoning_content = getattr(litellm_complete_object.choices[0].message, "reasoning_content", "") or ""annotations: Final = getattr(litellm_complete_object.choices[0].message, "annotations", None)- part: PART_UNION_TYPES | None = None- if reasoning_content:- part = ContentPartDonePartReasoningText(- type="reasoning_text",- reasoning=reasoning_content,- )-- else:- response_annotations: Final = (- LiteLLMCompletionResponsesConfig._transform_chat_completion_annotations_to_response_output_annotations(- annotations=annotations- )- )- part = ContentPartDonePartOutputText(- type="output_text",- text=text,- annotations=response_annotations,- logprobs=None,+ response_annotations: Final = (+ LiteLLMCompletionResponsesConfig._transform_chat_completion_annotations_to_response_output_annotations(+ annotations=annotations)+ )+ part: Final[PART_UNION_TYPES] = ContentPartDonePartOutputText(+ type="output_text",+ text=text,+ annotations=response_annotations,+ logprobs=None,+ )return ContentPartDoneEvent(type=ResponsesAPIStreamEvents.CONTENT_PART_DONE,