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
fix: fix linting errors
Krrish Dholakiaa69746735c06
diff --git a/litellm/litellm_core_utils/streaming_handler.py b/litellm/litellm_core_utils/streaming_handler.pyindex b2f6c621407..1daf543cfcb 100644--- a/litellm/litellm_core_utils/streaming_handler.py+++ b/litellm/litellm_core_utils/streaming_handler.py@@ -5,7 +5,6 @@ import jsonimport threadingimport timeimport traceback-from litellm._uuid import uuidfrom typing import Any, Callable, Dict, List, Optional, Union, castimport httpx@@ -13,6 +12,7 @@ from pydantic import BaseModelimport litellmfrom litellm import verbose_logger+from litellm._uuid import uuidfrom litellm.litellm_core_utils.model_response_utils import (is_model_response_stream_empty,)@@ -1024,7 +1024,7 @@ class CustomStreamWrapper:returndef chunk_creator(self, chunk: Any): # type: ignore # noqa: PLR0915- if hasattr(chunk, 'id'):+ if hasattr(chunk, "id"):self.response_id = chunk.idmodel_response = self.model_response_creator()response_obj: Dict[str, Any] = {}@@ -1365,12 +1365,13 @@ class CustomStreamWrapper:f"model_response finish reason 3: {self.received_finish_reason}; response_obj={response_obj}")## FUNCTION CALL PARSING+ original_chunk = (+ response_obj.get("original_chunk") if response_obj is not None else None+ )if (- response_obj is not None- and response_obj.get("original_chunk", None) is not None+ original_chunk is not None): # function / tool calling branch - only set for openai/azure compatible endpoints# enter this branch when no content has been passed in response- original_chunk = response_obj.get("original_chunk", None)if hasattr(original_chunk, "id"):model_response = self.set_model_id(original_chunk.id, model_response