From f81435936c7829db6b046cbb9c07c292ca2dfe20 Mon Sep 17 00:00:00 2001 From: pragnyanramtha Date: Sun, 17 May 2026 00:11:15 +0000 Subject: [PATCH 1/2] fix(eval): handle no evaluated final response v2 results --- .../adk/evaluation/final_response_match_v2.py | 8 +++++ .../test_final_response_match_v2.py | 31 +++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/src/google/adk/evaluation/final_response_match_v2.py b/src/google/adk/evaluation/final_response_match_v2.py index 713b421e3d..9417fffb19 100644 --- a/src/google/adk/evaluation/final_response_match_v2.py +++ b/src/google/adk/evaluation/final_response_match_v2.py @@ -228,6 +228,14 @@ def aggregate_invocation_results( continue num_evaluated += 1 num_valid += result.score + + if num_evaluated == 0: + return EvaluationResult( + overall_score=None, + overall_eval_status=EvalStatus.NOT_EVALUATED, + per_invocation_results=per_invocation_results, + ) + overall_score = num_valid / num_evaluated return EvaluationResult( overall_score=overall_score, diff --git a/tests/unittests/evaluation/test_final_response_match_v2.py b/tests/unittests/evaluation/test_final_response_match_v2.py index ce44901ab5..57927339b3 100644 --- a/tests/unittests/evaluation/test_final_response_match_v2.py +++ b/tests/unittests/evaluation/test_final_response_match_v2.py @@ -486,3 +486,34 @@ def test_aggregate_invocation_results(): # Only 4 / 8 invocations are evaluated, and 2 / 4 are valid. assert aggregated_result.overall_score == 0.5 assert aggregated_result.overall_eval_status == EvalStatus.PASSED + + +def test_aggregate_invocation_results_none_evaluated(): + evaluator = _create_test_evaluator_gemini(threshold=0.5) + + actual_invocation, expected_invocation = _create_test_invocations( + "candidate text", "reference text" + ) + + per_invocation_results = [ + PerInvocationResult( + actual_invocation=actual_invocation, + expected_invocation=expected_invocation, + score=None, + eval_status=EvalStatus.NOT_EVALUATED, + ), + PerInvocationResult( + actual_invocation=actual_invocation, + expected_invocation=expected_invocation, + score=1.0, + eval_status=EvalStatus.NOT_EVALUATED, + ), + ] + + aggregated_result = evaluator.aggregate_invocation_results( + per_invocation_results + ) + + assert aggregated_result.overall_score is None + assert aggregated_result.overall_eval_status == EvalStatus.NOT_EVALUATED + assert aggregated_result.per_invocation_results == per_invocation_results From 430f312dca94c8a2fe6744cb95adcbf0fa694103 Mon Sep 17 00:00:00 2001 From: pragnyanramtha Date: Wed, 20 May 2026 23:26:51 +0000 Subject: [PATCH 2/2] chore: satisfy repository pre-commit hooks --- .../adk/cli/browser/assets/config/runtime-config.json | 2 +- tests/unittests/cli/utils/test_gcp_utils.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/google/adk/cli/browser/assets/config/runtime-config.json b/src/google/adk/cli/browser/assets/config/runtime-config.json index c8f49d882d..e2628ca7cd 100644 --- a/src/google/adk/cli/browser/assets/config/runtime-config.json +++ b/src/google/adk/cli/browser/assets/config/runtime-config.json @@ -1,3 +1,3 @@ { "backendUrl": "" -} \ No newline at end of file +} diff --git a/tests/unittests/cli/utils/test_gcp_utils.py b/tests/unittests/cli/utils/test_gcp_utils.py index f0726bb716..18ac37b5c2 100644 --- a/tests/unittests/cli/utils/test_gcp_utils.py +++ b/tests/unittests/cli/utils/test_gcp_utils.py @@ -140,9 +140,7 @@ def test_sign_up_express(self, mock_auth_default, mock_session_cls): }, ) - @mock.patch( - "google.cloud.resourcemanager_v3.ProjectsClient" - ) + @mock.patch("google.cloud.resourcemanager_v3.ProjectsClient") def test_list_gcp_projects(self, mock_client_cls): mock_client = mock.Mock() mock_client_cls.return_value = mock_client @@ -165,7 +163,8 @@ def test_list_gcp_projects(self, mock_client_cls): @mock.patch.dict("sys.modules", {"google.cloud": None}) def test_list_gcp_projects_import_error(self): with self.assertRaisesRegex( - RuntimeError, "Listing GCP projects requires the 'gcp' optional dependency" + RuntimeError, + "Listing GCP projects requires the 'gcp' optional dependency", ): gcp_utils.list_gcp_projects()