diff --git a/litellm/llms/anthropic/experimental_pass_through/responses_adapters/handler.py b/litellm/llms/anthropic/experimental_pass_through/responses_adapters/handler.py index c268d6c5be8..ebc7d136f6e 100644 --- a/litellm/llms/anthropic/experimental_pass_through/responses_adapters/handler.py +++ b/litellm/llms/anthropic/experimental_pass_through/responses_adapters/handler.py @@ -65,7 +65,7 @@ def _build_responses_kwargs( if output_format: request_data["output_format"] = output_format - anthropic_request = AnthropicMessagesRequest(**request_data) + anthropic_request = AnthropicMessagesRequest(**request_data) # type: ignore[typeddict-item] responses_kwargs = _ADAPTER.translate_request(anthropic_request) if stream: diff --git a/litellm/llms/anthropic/experimental_pass_through/responses_adapters/streaming_iterator.py b/litellm/llms/anthropic/experimental_pass_through/responses_adapters/streaming_iterator.py index 2179e8005b8..40d8a6df05d 100644 --- a/litellm/llms/anthropic/experimental_pass_through/responses_adapters/streaming_iterator.py +++ b/litellm/llms/anthropic/experimental_pass_through/responses_adapters/streaming_iterator.py @@ -188,8 +188,8 @@ class AnthropicResponsesStreamWrapper: if usage is not None: input_tokens = getattr(usage, "input_tokens", 0) or 0 output_tokens = getattr(usage, "output_tokens", 0) or 0 - cache_creation_tokens = getattr(usage, "input_tokens_details", None) - cache_read_tokens = getattr(usage, "output_tokens_details", None) + cache_creation_tokens = getattr(usage, "input_tokens_details", None) # type: ignore[assignment] + cache_read_tokens = getattr(usage, "output_tokens_details", None) # type: ignore[assignment] # Prefer direct cache fields if present cache_creation_tokens = getattr(usage, "cache_creation_input_tokens", 0) or 0 cache_read_tokens = getattr(usage, "cache_read_input_tokens", 0) or 0 diff --git a/litellm/llms/anthropic/experimental_pass_through/responses_adapters/transformation.py b/litellm/llms/anthropic/experimental_pass_through/responses_adapters/transformation.py index fcef70cf255..6fe28805c42 100644 --- a/litellm/llms/anthropic/experimental_pass_through/responses_adapters/transformation.py +++ b/litellm/llms/anthropic/experimental_pass_through/responses_adapters/transformation.py @@ -313,7 +313,7 @@ class LiteLLMAnthropicToResponsesAPIAdapter: output_format = anthropic_request.get("output_format") output_config = anthropic_request.get("output_config") if not isinstance(output_format, dict) and isinstance(output_config, dict): - output_format = output_config.get("format") + output_format = output_config.get("format") # type: ignore[assignment] if isinstance(output_format, dict) and output_format.get("type") == "json_schema": schema = output_format.get("schema") if schema: @@ -392,7 +392,7 @@ class LiteLLMAnthropicToResponsesAPIAdapter: content.append( AnthropicResponseContentBlockToolUse( type="tool_use", - id=item.call_id or item.id, + id=item.call_id or item.id or "", name=item.name, input=input_data, ).model_dump() diff --git a/litellm/proxy/middleware/in_flight_requests_middleware.py b/litellm/proxy/middleware/in_flight_requests_middleware.py index d615640d870..f7f75f4a551 100644 --- a/litellm/proxy/middleware/in_flight_requests_middleware.py +++ b/litellm/proxy/middleware/in_flight_requests_middleware.py @@ -41,13 +41,13 @@ class InFlightRequestsMiddleware: InFlightRequestsMiddleware._in_flight += 1 gauge = InFlightRequestsMiddleware._get_gauge() if gauge is not None: - gauge.inc() # type: ignore[union-attr] + gauge.inc() # type: ignore[attr-defined] try: await self.app(scope, receive, send) finally: InFlightRequestsMiddleware._in_flight -= 1 if gauge is not None: - gauge.dec() # type: ignore[union-attr] + gauge.dec() # type: ignore[attr-defined] @staticmethod def get_count() -> int: @@ -69,7 +69,7 @@ class InFlightRequestsMiddleware: InFlightRequestsMiddleware._gauge = Gauge( "litellm_in_flight_requests", "Number of HTTP requests currently in-flight on this uvicorn worker", - **kwargs, + **kwargs, # type: ignore[arg-type] ) except Exception: InFlightRequestsMiddleware._gauge = None diff --git a/litellm/proxy/public_endpoints/public_endpoints.py b/litellm/proxy/public_endpoints/public_endpoints.py index 09fc6477829..a74b9a40a1b 100644 --- a/litellm/proxy/public_endpoints/public_endpoints.py +++ b/litellm/proxy/public_endpoints/public_endpoints.py @@ -337,7 +337,7 @@ async def get_supported_endpoints() -> SupportedEndpointsResponse: """ global _cached_endpoints if _cached_endpoints is None: - _cached_endpoints = SupportedEndpointsResponse(endpoints=_load_endpoints()) + _cached_endpoints = SupportedEndpointsResponse(endpoints=_load_endpoints()) # type: ignore[arg-type] return _cached_endpoints diff --git a/litellm/responses/main.py b/litellm/responses/main.py index a627531e994..05fd6026af2 100644 --- a/litellm/responses/main.py +++ b/litellm/responses/main.py @@ -304,7 +304,7 @@ async def aresponses_api_with_mcp( ) # Extract MCP auth headers from the request to pass to MCP server - secret_fields: Optional[Dict[str, Any]] = kwargs.get("secret_fields") + secret_fields = kwargs.get("secret_fields") ( mcp_auth_header, mcp_server_auth_headers,