From 836c9efea47ba41d4c34464b5664736b7f142c61 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Wed, 25 Feb 2026 21:40:27 -0800 Subject: [PATCH] fix: drop unknown event types in Gemini transform; add vertex_ai health check --- .../llms/gemini/realtime/transformation.py | 5 ++-- litellm/realtime_api/main.py | 27 +++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/litellm/llms/gemini/realtime/transformation.py b/litellm/llms/gemini/realtime/transformation.py index 9a87136c407..ad199d92f78 100644 --- a/litellm/llms/gemini/realtime/transformation.py +++ b/litellm/llms/gemini/realtime/transformation.py @@ -263,8 +263,9 @@ class GeminiRealtimeConfig(BaseRealtimeConfig): return [] realtime_input_dict["text"] = text else: - # Pass through any other message types as raw text - realtime_input_dict["text"] = message + # Unknown/unsupported OpenAI event type — drop silently rather than + # forwarding raw JSON as text input to the model. + return [] if len(realtime_input_dict) != 1: raise ValueError( diff --git a/litellm/realtime_api/main.py b/litellm/realtime_api/main.py index 7d27ccb68c1..e4c8f648190 100644 --- a/litellm/realtime_api/main.py +++ b/litellm/realtime_api/main.py @@ -310,6 +310,33 @@ async def _realtime_health_check( url = xai_realtime._construct_url( api_base=api_base or "https://api.x.ai/v1", query_params={"model": model} ) + elif custom_llm_provider == "vertex_ai": + vertex_location = litellm.vertex_location or get_secret_str("VERTEXAI_LOCATION") + resolved_location = vertex_llm_base.get_vertex_region( + vertex_region=vertex_location, model=model + ) + access_token, resolved_project = await vertex_llm_base._ensure_access_token_async( + credentials=None, + project_id=litellm.vertex_project or get_secret_str("VERTEXAI_PROJECT"), + custom_llm_provider="vertex_ai", + ) + vertex_realtime_config = VertexAIRealtimeConfig( + access_token=access_token, + project=resolved_project, + location=resolved_location, + ) + url = vertex_realtime_config.get_complete_url(api_base=api_base, model=model) + ssl_context = get_shared_realtime_ssl_context() + headers = vertex_realtime_config.validate_environment( + headers={}, model=model, api_key=None + ) + async with websockets.connect( # type: ignore + url, + additional_headers=headers, + max_size=REALTIME_WEBSOCKET_MAX_MESSAGE_SIZE_BYTES, + ssl=ssl_context, + ): + return True else: raise ValueError(f"Unsupported model: {model}") ssl_context = get_shared_realtime_ssl_context()