Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/google/adk/models/gemini_llm_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,23 @@ async def receive(self) -> AsyncGenerator[LlmResponse, None]:
types.Part(function_call=function_call)
for function_call in message.tool_call.function_calls
])
# Gemini 3.1 does not emit turn_complete until it receives the
# tool response, so yield tool calls immediately to avoid
# deadlocking the conversation. Other models (e.g. 2.5-pro,
# native-audio) send turn_complete after tool calls, so buffer
# and merge them into a single response at turn_complete.
if model_name_utils.is_gemini_3_1_flash_live(
self._model_version
) and tool_call_parts:
logger.debug(
'Yielding tool_call_parts immediately for Gemini 3.1 live tool call'
)
yield LlmResponse(
content=types.Content(role='model', parts=tool_call_parts),
model_version=self._model_version,
live_session_id=live_session_id,
)
tool_call_parts = []
if message.session_resumption_update:
logger.debug('Received session resumption message: %s', message)
yield (
Expand Down