mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
fix: drop unknown event types in Gemini transform; add vertex_ai health check
This commit is contained in:
parent
7f017f7fee
commit
836c9efea4
2 changed files with 30 additions and 2 deletions
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue