Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions src/google/adk/evaluation/base_eval_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class EvaluateConfig(BaseModel):

parallelism: int = Field(
default=4,
ge=1,
description="""Number of parallel evaluations to run during an Eval. Few
factors to consider while changing this value:

Expand All @@ -71,6 +72,7 @@ class InferenceConfig(BaseModel):

parallelism: int = Field(
default=4,
ge=1,
description="""Number of parallel inferences to run during an Eval. Few
factors to consider while changing this value:

Expand Down
41 changes: 41 additions & 0 deletions tests/unittests/evaluation/test_base_eval_service.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import annotations

from google.adk.evaluation.base_eval_service import EvaluateConfig
from google.adk.evaluation.base_eval_service import InferenceConfig
from google.adk.evaluation.eval_metrics import EvalMetric
from pydantic import ValidationError
import pytest


def test_evaluate_config_rejects_zero_parallelism():
"""parallelism=0 must be rejected.

It is forwarded unclamped to asyncio.Semaphore(value=parallelism), where a
zero value hangs every acquire() indefinitely instead of raising -- a
degenerate value that fails silently rather than loudly.
"""
with pytest.raises(ValidationError):
EvaluateConfig(
eval_metrics=[EvalMetric(metric_name="response_match_score")],
parallelism=0,
)


def test_inference_config_rejects_zero_parallelism():
"""Same defect as EvaluateConfig.parallelism, on the inference side."""
with pytest.raises(ValidationError):
InferenceConfig(parallelism=0)