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): suppress attr-defined errors on websocket send/close calls

Julio Quinteros Pro494d783a8092
diff --git a/litellm/litellm_core_utils/realtime_streaming.py b/litellm/litellm_core_utils/realtime_streaming.py
index 8df41aea4a3..760efa71ab7 100644
--- a/litellm/litellm_core_utils/realtime_streaming.py
+++ b/litellm/litellm_core_utils/realtime_streaming.py
@@ -230,9 +230,9 @@ class RealTimeStreaming:
message, self.model, self.session_configuration_request
)
for msg in transformed:
- await self.backend_ws.send(msg)
+ await self.backend_ws.send(msg) # type: ignore[union-attr]
else:
- await self.backend_ws.send(message)
+ await self.backend_ws.send(message) # type: ignore[union-attr]
def _has_realtime_guardrails(self) -> bool:
"""Return True if any callback is registered for realtime guardrail event types."""
@@ -362,7 +362,7 @@ class RealTimeStreaming:
"[realtime guardrail] ending session after violation %d",
self._violation_count,
)
- await self.backend_ws.close()
+ await self.backend_ws.close() # type: ignore[union-attr]
verbose_logger.warning(
"[realtime guardrail] BLOCKED transcript (violation %d): %r",