Skip to content

Conversation

@dkristak
Copy link

Fixes ValueError when using RealtimeModel with Vertex AI where function calls execute successfully but sending responses back to the model fails with: scheduling parameter is not supported in Vertex AI.

Error traceback:
  File "livekit/plugins/google/realtime/realtime_api.py", line 732
    await session.send_tool_response(function_responses=msg.function_responses)
  File "google/genai/live.py", line 407, in send_tool_response
    tool_response_dict = live_converters._LiveClientToolResponse_to_vertex(...)
  File "google/genai/_live_converters.py", line 2203
    raise ValueError('scheduling parameter is not supported in Vertex AI.')

Root cause: get_tool_results_for_realtime() was setting the scheduling parameter to WHEN_IDLE by default for all FunctionResponse objects, including when vertexai=True. Vertex AI's converter explicitly rejects any scheduling parameter in function responses.

Impact: Functions would execute successfully but Gemini never received the results, causing conversation flow to break, repeated function calls, or the model to get stuck.

Fix: Conditionally construct FunctionResponse objects - only include scheduling and id parameters when vertexai=False, matching the pattern already used for the id parameter.

Related: Similar to how id is excluded for Vertex AI per:
https://github.com/googleapis/python-genai/blob/85e00bc/google/genai/_live_converters.py#L1435

Fixes ValueError when using RealtimeModel with Vertex AI where function
calls execute successfully but sending responses back to the model fails
with: 'scheduling parameter is not supported in Vertex AI.'

Error traceback:
  File "livekit/plugins/google/realtime/realtime_api.py", line 732
    await session.send_tool_response(function_responses=msg.function_responses)
  File "google/genai/live.py", line 407, in send_tool_response
    tool_response_dict = live_converters._LiveClientToolResponse_to_vertex(...)
  File "google/genai/_live_converters.py", line 2203
    raise ValueError('scheduling parameter is not supported in Vertex AI.')

Root cause: get_tool_results_for_realtime() was setting the 'scheduling'
parameter to WHEN_IDLE by default for all FunctionResponse objects,
including when vertexai=True. Vertex AI's converter explicitly rejects
any scheduling parameter in function responses.

Impact: Functions would execute successfully but Gemini never received
the results, causing conversation flow to break, repeated function calls,
or the model to get stuck.

Fix: Conditionally construct FunctionResponse objects - only include
'scheduling' and 'id' parameters when vertexai=False, matching the
pattern already used for the 'id' parameter.

Related: Similar to how 'id' is excluded for Vertex AI per:
https://github.com/googleapis/python-genai/blob/85e00bc/google/genai/_live_converters.py#L1435
@CLAassistant
Copy link

CLAassistant commented Oct 21, 2025

CLA assistant check
All committers have signed the CLA.

@davidzhao
Copy link
Member

issue is fixed in #3781

@davidzhao davidzhao closed this Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants