fix(interactions): only set object/id/delta on step.stop for legacy schema

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 <cursoragent@cursor.com>
This commit is contained in:
Sameer Kankute 2026-05-18 14:29:10 +05:30
parent 302069ca0e
commit 1737787233
No known key found for this signature in database

View file

@ -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,