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 mypy linting errors

Ishaan Jaffde473bee4bdb
diff --git a/litellm/responses/streaming_iterator.py b/litellm/responses/streaming_iterator.py
index 88d963c94ed..c016e71e7e2 100644
--- a/litellm/responses/streaming_iterator.py
+++ b/litellm/responses/streaming_iterator.py
@@ -36,7 +36,7 @@ class BaseResponsesAPIStreamingIterator:
self.logging_obj = logging_obj
self.finished = False
self.responses_api_provider_config = responses_api_provider_config
- self.completed_response = None
+ self.completed_response: Optional[ResponsesAPIStreamingResponse] = None
self.start_time = datetime.now()
def _process_chunk(self, chunk):
@@ -102,7 +102,6 @@ class ResponsesAPIStreamingIterator(BaseResponsesAPIStreamingIterator):
):
super().__init__(response, model, responses_api_provider_config, logging_obj)
self.stream_iterator = response.aiter_lines()
- self.completed_response: Optional[ResponsesAPIStreamingResponse] = None
def __aiter__(self):
return self
diff --git a/litellm/responses/utils.py b/litellm/responses/utils.py
index 3a148aed033..49d850ec6aa 100644
--- a/litellm/responses/utils.py
+++ b/litellm/responses/utils.py
@@ -1,4 +1,4 @@
-from typing import Any, Dict, get_type_hints
+from typing import Any, Dict, cast, get_type_hints
import litellm
from litellm.llms.base_llm.responses.transformation import BaseResponsesAPIConfig
@@ -73,7 +73,7 @@ class ResponsesAPIRequestUtils:
"""
valid_keys = get_type_hints(ResponsesAPIOptionalRequestParams).keys()
filtered_params = {k: v for k, v in params.items() if k in valid_keys}
- return ResponsesAPIOptionalRequestParams(**filtered_params)
+ return cast(ResponsesAPIOptionalRequestParams, filtered_params)
class ResponseAPILoggingUtils:
diff --git a/litellm/types/llms/openai.py b/litellm/types/llms/openai.py
index 58cb2ab479d..5b811830e70 100644
--- a/litellm/types/llms/openai.py
+++ b/litellm/types/llms/openai.py
@@ -35,7 +35,6 @@ from openai.types.embedding import Embedding as OpenAIEmbedding
from openai.types.fine_tuning.fine_tuning_job import FineTuningJob
from openai.types.responses.response import (
IncompleteDetails,
- Reasoning,
Response,
ResponseOutputItem,
ResponseTextConfig,