Fix greptile reviews

This commit is contained in:
Sameer Kankute 2026-04-27 17:14:40 +05:30
parent d3e375443a
commit eb3ab4bcfb
No known key found for this signature in database
2 changed files with 22 additions and 9 deletions

View file

@ -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,

View file

@ -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()