refactor(oci): build the identity-pinned stream chunk in one shot

Address the two Greptile P2 notes: construct the chunk through the shared
creator instead of mutating its choices afterwards, and drop the decorative
divider comment from the new tests.
This commit is contained in:
mateo-berri 2026-09-03 00:27:54 -07:00
parent 69efad0384
commit fd2104a61e
2 changed files with 1 additions and 7 deletions

View file

@ -746,9 +746,7 @@ class OCIStreamWrapper(CustomStreamWrapper):
self._cohere_text_emitted = False
def _with_stream_identity(self, parsed: ModelResponseStream) -> ModelResponseStream:
model_response: Final = self.model_response_creator()
model_response.choices = parsed.choices
return model_response
return self.model_response_creator(chunk={"choices": parsed.choices})
def chunk_creator(self, chunk: Any) -> ModelResponseStream | None:
if not isinstance(chunk, str):

View file

@ -1902,10 +1902,6 @@ class TestOCIImageUrlTransformation:
assert "image_url" in str(exc_info.value)
# ---------------------------------------------------------------------------
# OCIStreamWrapper: per-stream identity and the GENERIC `[DONE]` sentinel
# ---------------------------------------------------------------------------
import itertools
from unittest.mock import patch