chore: Add debug logging for missing function call events

This change adds a debug log statement to output the function response IDs and the event list when a matching function call event is not found, which helps in debugging.

Co-authored-by: Hangfei Lin <hangfei@google.com>
PiperOrigin-RevId: 829059186
This commit is contained in:
Hangfei Lin
2025-11-06 12:20:36 -08:00
committed by Copybara-Service
parent dd706bdc45
commit f3d6fcf444
@@ -15,6 +15,7 @@
from __future__ import annotations
import copy
import logging
from typing import AsyncGenerator
from typing import Optional
@@ -29,6 +30,8 @@ from .functions import remove_client_function_call_id
from .functions import REQUEST_CONFIRMATION_FUNCTION_CALL_NAME
from .functions import REQUEST_EUC_FUNCTION_CALL_NAME
logger = logging.getLogger('google_adk.' + __name__)
class _ContentLlmRequestProcessor(BaseLlmRequestProcessor):
"""Builds the contents for the LLM request."""
@@ -183,6 +186,12 @@ def _rearrange_events_for_latest_function_response(
break
if function_call_event_idx == -1:
logger.debug(
'No function call event found for function responses ids: %s in'
' event list: %s',
function_responses_ids,
events,
)
raise ValueError(
'No function call event found for function responses ids:'
f' {function_responses_ids}'