Skip to content

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]

fix: fix linting errors

Krrish Dholakiaee1e9da7b227
diff --git a/litellm/responses/litellm_completion_transformation/streaming_iterator.py b/litellm/responses/litellm_completion_transformation/streaming_iterator.py
index e0cbea501f9..d3a8cea3497 100644
--- a/litellm/responses/litellm_completion_transformation/streaming_iterator.py
+++ b/litellm/responses/litellm_completion_transformation/streaming_iterator.py
@@ -10,6 +10,7 @@ from litellm.responses.litellm_completion_transformation.transformation import (
from litellm.responses.streaming_iterator import ResponsesAPIStreamingIterator
from litellm.responses.utils import ResponsesAPIRequestUtils
from litellm.types.llms.openai import (
+ PART_UNION_TYPES,
BaseLiteLLMOpenAIResponseObject,
ContentPartAddedEvent,
ContentPartDoneEvent,
@@ -203,6 +204,7 @@ class LiteLLMCompletionStreamingIterator(ResponsesAPIStreamingIterator):
text = getattr(litellm_complete_object.choices[0].message, "content", "") or "" # type: ignore
reasoning_content = getattr(litellm_complete_object.choices[0].message, "reasoning_content", "") or "" # type: ignore
+ part: Optional[PART_UNION_TYPES] = None
if reasoning_content:
part = ContentPartDonePartReasoningText(
type="reasoning_text",
diff --git a/litellm/types/llms/openai.py b/litellm/types/llms/openai.py
index 5306dc8bfc2..c9761beeafc 100644
--- a/litellm/types/llms/openai.py
+++ b/litellm/types/llms/openai.py
@@ -1059,7 +1059,9 @@ class ResponsesAPIResponse(BaseLiteLLMOpenAIResponseObject):
parallel_tool_calls: Optional[bool] = None
temperature: Optional[float] = None
tool_choice: Optional[ToolChoice] = None
- tools: Optional[Union[List[Tool], List[ResponseFunctionToolCall], List[Dict[str, Any]]]] = None
+ tools: Optional[
+ Union[List[Tool], List[ResponseFunctionToolCall], List[Dict[str, Any]]]
+ ] = None
top_p: Optional[float] = None
max_output_tokens: Optional[int] = None
previous_response_id: Optional[str] = None
@@ -1231,16 +1233,19 @@ class ContentPartDonePartReasoningText(BaseLiteLLMOpenAIResponseObject):
reasoning: str
+PART_UNION_TYPES = Union[
+ ContentPartDonePartOutputText,
+ ContentPartDonePartRefusal,
+ ContentPartDonePartReasoningText,
+]
+
+
class ContentPartDoneEvent(BaseLiteLLMOpenAIResponseObject):
type: Literal[ResponsesAPIStreamEvents.CONTENT_PART_DONE]
item_id: str
output_index: int
content_index: int
- part: Union[
- ContentPartDonePartOutputText,
- ContentPartDonePartRefusal,
- ContentPartDonePartReasoningText,
- ]
+ part: PART_UNION_TYPES
class OutputTextDeltaEvent(BaseLiteLLMOpenAIResponseObject):