fix interactions SSE ids for function calls #5177
fix interactions SSE ids for function calls #5177kshirajahere wants to merge 2 commits intogoogle:mainfrom
Conversation
Fixes google#5169 by reading interaction IDs from the actual GenAI SDK SSE event fields and carrying them through streaming function-call responses. Also adds regression coverage for interaction.complete events and streaming interaction.start chaining.
Rename the thought-content temporary variable so the repo's mypy new-errors workflow does not treat a shifted baseline no-redef diagnostic as a newly introduced error.
|
Local validation is green on this branch:\n\n- pytest tests/unittests/models/test_interactions_utils.py tests/unittests/flows/llm_flows/test_interactions_processor.py tests/unittests/models/test_google_llm.py -q\n- pyink --check --config pyproject.toml src/google/adk/models/interactions_utils.py tests/unittests/models/test_interactions_utils.py\n- isort --check-only src/google/adk/models/interactions_utils.py tests/unittests/models/test_interactions_utils.py\n- pylint --rcfile=pylintrc src/google/adk/models/interactions_utils.py\n- local check-file-contents verification against origin/main\n- no new mypy error lines relative to origin/main for src/google/adk/models/interactions_utils.py\n\nThe remaining GitHub Actions jobs are currently in �ction_required because this is a forked PR and upstream workflow approval is needed before they can actually run. |
What changed
interaction.id,interaction_id,event_id) instead of onlyevent.idinteraction.completeas the final full interaction event during streaming conversioninteraction.completehandling and for SSE function-call streams that must retain the interaction ID before the tool round-tripWhy
Issue #5169 reports that
StreamingMode.SSEbreaks Interactions API function calling because the second model call cannot find the previousinteraction_idin session history.The root cause is that ADK's SSE adapter was keyed to older/generic event shapes (
event.idandevent_type == "interaction"), whilegoogle-genai1.70.0 emitsinteraction.start,interaction.complete, andinteraction.status_updateevents with IDs stored oninteraction.id,interaction_id, andevent_id.That mismatch meant streamed function-call events were persisted without an
interaction_id, so the next round of the ReAct loop could not chain the interaction and failed withinvalid_request.Impact
Gemini(use_interactions_api=True)when SSE streaming is enabledValidation
.venv\\Scripts\\pytest tests\\unittests\\models\\test_interactions_utils.py tests\\unittests\\flows\\llm_flows\\test_interactions_processor.py tests\\unittests\\models\\test_google_llm.py -q.venv\\Scripts\\pyink --check --config pyproject.toml src\\google\\adk\\models\\interactions_utils.py tests\\unittests\\models\\test_interactions_utils.py.venv\\Scripts\\isort --check-only src\\google\\adk\\models\\interactions_utils.py tests\\unittests\\models\\test_interactions_utils.py.venv\\Scripts\\pylint --rcfile=pylintrc src\\google\\adk\\models\\interactions_utils.py