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] Correct mypy fixes for realtime_api and presidio
yuneng-jiang5b755db329e2
diff --git a/litellm/proxy/guardrails/guardrail_hooks/presidio.py b/litellm/proxy/guardrails/guardrail_hooks/presidio.pyindex 79c00948d5e..48ffab39bd0 100644--- a/litellm/proxy/guardrails/guardrail_hooks/presidio.py+++ b/litellm/proxy/guardrails/guardrail_hooks/presidio.py@@ -1229,12 +1229,12 @@ class _OPTIONAL_PresidioPIIMasking(CustomGuardrail):for chunk in remaining_chunks:yield chunk- async def async_post_call_streaming_iterator_hook(+ async def async_post_call_streaming_iterator_hook( # type: ignore[override]self,user_api_key_dict: UserAPIKeyAuth,response: Any,request_data: dict,- ) -> AsyncGenerator[Union[ModelResponseStream, bytes], None]: # type: ignore[override]+ ) -> AsyncGenerator[Union[ModelResponseStream, bytes], None]:"""Process streaming response chunks to unmask PII tokens when needed.diff --git a/litellm/realtime_api/main.py b/litellm/realtime_api/main.pyindex 92e221577f3..38964bd61f2 100644--- a/litellm/realtime_api/main.py+++ b/litellm/realtime_api/main.py@@ -1,7 +1,7 @@"""Abstraction function for OpenAI's realtime API"""import os-from typing import Any, Dict, Optional, Union, cast+from typing import Any, Dict, Optional, castimport litellmfrom litellm.constants import REALTIME_WEBSOCKET_MAX_MESSAGE_SIZE_BYTES, request_timeout@@ -98,15 +98,15 @@ def _get_realtime_http_provider_config(@wrapper_clientasync def acreate_realtime_client_secret(model: Optional[str] = None,- session: Optional[Union[Dict[str, Any], RealtimeSessionConfig]] = None,- expires_after: Optional[Union[Dict[str, Any], RealtimeExpiresAfter]] = None,+ session: Optional[Dict[str, Any]] = None,+ expires_after: Optional[Dict[str, Any]] = None,timeout: Optional[float] = None,**kwargs,):req = RealtimeClientSecretRequest(model=model,- session=session,- expires_after=expires_after,+ session=RealtimeSessionConfig(**session) if session else None,+ expires_after=RealtimeExpiresAfter(**expires_after) if expires_after else None,)model_name = ((req.session.model if req.session is not None else None)