From 0912f984d12b440a3a811ba0d6523adddb54f34d Mon Sep 17 00:00:00 2001 From: Oxygen56 <1391083091@qq.com> Date: Tue, 2 Jun 2026 02:03:01 +0800 Subject: [PATCH] fix(evaluation): skip invocations without user events to prevent ValidationError Change user_content initialization from Content(parts=[]) to None and skip invocations that have no user-authored events. This prevents ValidationError from semantically incorrect empty Content objects. Fixes #3760 --- src/google/adk/evaluation/evaluation_generator.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/google/adk/evaluation/evaluation_generator.py b/src/google/adk/evaluation/evaluation_generator.py index 5b0100818c..4f37d6b31e 100644 --- a/src/google/adk/evaluation/evaluation_generator.py +++ b/src/google/adk/evaluation/evaluation_generator.py @@ -627,7 +627,7 @@ def convert_events_to_eval_invocations( for invocation_id, events in events_by_invocation_id.items(): final_response = None final_event = None - user_content = Content(parts=[]) + user_content = None invocation_timestamp = 0 app_details = None if ( @@ -663,6 +663,9 @@ def convert_events_to_eval_invocations( events_to_add.append(event) break + if user_content is None: + continue + invocation_events = [ InvocationEvent(author=e.author, content=e.content) for e in events_to_add