From 17377872332b334c58479c794823c9831be4f8f9 Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Mon, 18 May 2026 14:29:10 +0530 Subject: [PATCH] fix(interactions): only set object/id/delta on step.stop for legacy schema MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit StepStop (new schema) has no object, id, or delta fields. Setting them unconditionally caused spec-breaking extra fields on new-schema step.stop events in all four construction sites (sync/async × main-loop/StopIteration). Legacy content.stop still receives id, object, and delta unchanged. Co-authored-by: Cursor --- .../streaming_iterator.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/litellm/interactions/litellm_responses_transformation/streaming_iterator.py b/litellm/interactions/litellm_responses_transformation/streaming_iterator.py index 3627736fde9..9c18b511605 100644 --- a/litellm/interactions/litellm_responses_transformation/streaming_iterator.py +++ b/litellm/interactions/litellm_responses_transformation/streaming_iterator.py @@ -244,10 +244,10 @@ class LiteLLMResponsesInteractionsStreamingIterator: stop_kwargs: Dict[str, Any] = { "event_type": stop_event_type, "index": 0, - "id": transformed.id, - "object": "content", } if self._use_legacy: + stop_kwargs["id"] = transformed.id + stop_kwargs["object"] = "content" stop_kwargs["delta"] = { "type": "text", "text": self.collected_text, @@ -270,9 +270,9 @@ class LiteLLMResponsesInteractionsStreamingIterator: stop_kwargs = { "event_type": stop_event_type, "index": 0, - "object": "content", } if self._use_legacy: + stop_kwargs["object"] = "content" stop_kwargs["delta"] = { "type": "text", "text": self.collected_text, @@ -330,10 +330,10 @@ class LiteLLMResponsesInteractionsStreamingIterator: stop_kwargs_async: Dict[str, Any] = { "event_type": stop_event_type, "index": 0, - "id": transformed.id, - "object": "content", } if self._use_legacy: + stop_kwargs_async["id"] = transformed.id + stop_kwargs_async["object"] = "content" stop_kwargs_async["delta"] = { "type": "text", "text": self.collected_text, @@ -358,9 +358,9 @@ class LiteLLMResponsesInteractionsStreamingIterator: stop_kwargs_async = { "event_type": stop_event_type, "index": 0, - "object": "content", } if self._use_legacy: + stop_kwargs_async["object"] = "content" stop_kwargs_async["delta"] = { "type": "text", "text": self.collected_text,