mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-05 02:41:56 +00:00
Fix greptile reviews
This commit is contained in:
parent
d3e375443a
commit
eb3ab4bcfb
2 changed files with 22 additions and 9 deletions
|
|
@ -69,6 +69,20 @@ class BaseRealtimeConfig(ABC):
|
|||
) -> Optional[str]: # message sent to setup the realtime session
|
||||
return None
|
||||
|
||||
def transform_session_created_event(
|
||||
self,
|
||||
model: str,
|
||||
logging_session_id: str,
|
||||
session_configuration_request: Optional[str] = None,
|
||||
) -> Optional[dict]:
|
||||
"""
|
||||
Optional hook for providers that defer session setup until client `session.update`.
|
||||
|
||||
Return an OpenAI-compatible `session.created` payload when the proxy should
|
||||
emit a synthetic event immediately after backend websocket connection.
|
||||
"""
|
||||
return None
|
||||
|
||||
@abstractmethod
|
||||
def transform_realtime_response(
|
||||
self,
|
||||
|
|
|
|||
|
|
@ -5156,20 +5156,19 @@ class BaseLLMHTTPHandler:
|
|||
if _session_config:
|
||||
realtime_streaming.session_configuration_request = _session_config
|
||||
|
||||
# For Gemini/Vertex AI: if no initial setup sent (waiting for client's session.update),
|
||||
# send synthetic session.created to unblock client
|
||||
if not provider_config.requires_session_configuration() and hasattr(
|
||||
provider_config, 'transform_session_created_event'
|
||||
):
|
||||
# For providers that defer setup until client session.update, optionally
|
||||
# send synthetic session.created to unblock clients waiting on connect.
|
||||
if not provider_config.requires_session_configuration():
|
||||
synthetic_session = provider_config.transform_session_created_event(
|
||||
model=model,
|
||||
logging_session_id=logging_obj.litellm_trace_id,
|
||||
session_configuration_request=None,
|
||||
)
|
||||
await websocket.send_text(json.dumps(synthetic_session))
|
||||
verbose_logger.debug(
|
||||
"Sent synthetic session.created to client to unblock connection"
|
||||
)
|
||||
if synthetic_session is not None:
|
||||
await websocket.send_text(json.dumps(synthetic_session))
|
||||
verbose_logger.debug(
|
||||
"Sent synthetic session.created to client to unblock connection"
|
||||
)
|
||||
|
||||
await realtime_streaming.bidirectional_forward()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue