mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
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:
parent
69efad0384
commit
fd2104a61e
2 changed files with 1 additions and 7 deletions
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue