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
1 change: 1 addition & 0 deletions src/google/adk/evaluation/eval_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class JudgeModelOptions(EvalBaseModel):

num_samples: int = Field(
default=5,
ge=1,
description=(
"The number of times to sample the model for each invocation"
" evaluation. Given that models tend to have certain degree of"
Expand Down
11 changes: 11 additions & 0 deletions tests/unittests/evaluation/test_eval_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,17 @@ def test_eval_metric_criterion_survives_json_round_trip():
assert criterion.judge_model_options.judge_model == "my-judge"


def test_judge_model_options_rejects_zero_num_samples():
"""num_samples=0 must be rejected, matching parallelism_limit's own ge=1.

A zero-sample judge configuration is never a legitimate value -- it causes
LlmAsJudge.evaluate_invocations to silently drop the invocation from the
aggregated result with no error and no NOT_EVALUATED marker.
"""
with pytest.raises(ValidationError):
JudgeModelOptions(num_samples=0)


def test_eval_config_dump_preserves_concrete_criterion_fields():
"""Criteria values keep their subclass fields, and plain thresholds survive."""
eval_config = EvalConfig(
Expand Down