The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
refactor(oci): build the identity-pinned stream chunk in one shot
mateo-berrifd2104a61efe
diff --git a/litellm/llms/oci/chat/transformation.py b/litellm/llms/oci/chat/transformation.pyindex 17aed74b9d3..b1167d447fc 100644--- a/litellm/llms/oci/chat/transformation.py+++ b/litellm/llms/oci/chat/transformation.py@@ -746,9 +746,7 @@ class OCIStreamWrapper(CustomStreamWrapper):self._cohere_text_emitted = Falsedef _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):diff --git a/tests/test_litellm/llms/oci/chat/test_oci_chat_transformation.py b/tests/test_litellm/llms/oci/chat/test_oci_chat_transformation.pyindex 6601de2853d..e77b2c24d01 100644--- a/tests/test_litellm/llms/oci/chat/test_oci_chat_transformation.py+++ b/tests/test_litellm/llms/oci/chat/test_oci_chat_transformation.py@@ -1902,10 +1902,6 @@ class TestOCIImageUrlTransformation:assert "image_url" in str(exc_info.value)-# ----------------------------------------------------------------------------# OCIStreamWrapper: per-stream identity and the GENERIC `[DONE]` sentinel-# ----------------------------------------------------------------------------import itertoolsfrom unittest.mock import patch