From fce6f976b0dbe1de72e137a9cc6e272d5a475184 Mon Sep 17 00:00:00 2001 From: Sushant Kumar Date: Fri, 30 Oct 2026 12:31:38 +0530 Subject: [PATCH] fix(responses): give bridged reasoning items a summary and reasoning_text content A chat provider's reasoning item had no summary and typed its text output_text. The Responses API requires a summary and types reasoning text reasoning_text, so a client that validates output items rejected it, such as the OpenAI Agents SDK restoring a run paused for human input Co-Authored-By: Claude Opus 5.5 --- .../transformation.py | 3 ++- .../test_litellm_completion_responses.py | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/litellm/responses/litellm_completion_transformation/transformation.py b/litellm/responses/litellm_completion_transformation/transformation.py index ce8841c9190..c068791b8a2 100644 --- a/litellm/responses/litellm_completion_transformation/transformation.py +++ b/litellm/responses/litellm_completion_transformation/transformation.py @@ -3442,9 +3442,10 @@ class LiteLLMCompletionResponsesConfig: choice.finish_reason ), role="assistant", + summary=[], content=[ OutputText( - type="output_text", + type="reasoning_text", text=text, annotations=[], ) diff --git a/tests/unit/responses/litellm_completion_transformation/test_litellm_completion_responses.py b/tests/unit/responses/litellm_completion_transformation/test_litellm_completion_responses.py index 4250c78c669..c496ef65723 100644 --- a/tests/unit/responses/litellm_completion_transformation/test_litellm_completion_responses.py +++ b/tests/unit/responses/litellm_completion_transformation/test_litellm_completion_responses.py @@ -313,7 +313,7 @@ class TestLiteLLMCompletionResponsesConfig: assert reasoning_item.status == "completed" assert reasoning_item.role == "assistant" assert len(reasoning_item.content) == 1 - assert reasoning_item.content[0].type == "output_text" + assert reasoning_item.content[0].type == "reasoning_text" assert "step by step" in reasoning_item.content[0].text assert "42" in reasoning_item.content[0].text @@ -5432,6 +5432,16 @@ class TestBridgedOutputItemIdPrefixes: assert not suffix.lstrip("-").isdigit() assert not suffix.startswith("-") + def test_reasoning_item_is_a_responses_reasoning_item(self): + """A client that validates output items (the OpenAI Agents SDK restoring a paused run) + rejected the bridged item: it had no ``summary`` and typed its text ``output_text``.""" + from openai.types.responses import ResponseReasoningItem + + item = ResponseReasoningItem.model_validate(self._reasoning_items()[0].model_dump()) + + assert item.summary == [] + assert [(part.type, part.text) for part in item.content or []] == [("reasoning_text", "thinking about fruit")] + class TestStreamingSnapshotItemIds: """The response.completed snapshot must reuse the streamed item ID (issue #27333).