mirror of
https://github.com/tiennm99/litellm.git
synced 2026-07-11 01:05:19 +00:00
[Fix] Correct mypy fixes for realtime_api and presidio
- realtime_api/main.py: Revert param types to Dict, explicitly construct RealtimeSessionConfig/RealtimeExpiresAfter before passing to RealtimeClientSecretRequest - presidio.py: Move type:ignore[override] to def line where mypy reports it Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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.
|
||||
|
||||
|
||||
@@ -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, cast
|
||||
|
||||
import litellm
|
||||
from litellm.constants import REALTIME_WEBSOCKET_MAX_MESSAGE_SIZE_BYTES, request_timeout
|
||||
@@ -98,15 +98,15 @@ def _get_realtime_http_provider_config(
|
||||
@wrapper_client
|
||||
async 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)
|
||||
|
||||
Reference in New Issue
Block a user