This commit is contained in:
yujonglee 2026-10-30 14:35:15 +00:00 • committed by GitHub
commit 724eb83d5a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View file

@ -87,7 +87,9 @@ def _int_or_none(value: object) -> int | None:
def _asks_for_one_candidate(generation_config: Mapping[str, object]) -> bool:
return all(
_int_or_none(generation_config[key] or 1) == 1 for key in _CANDIDATE_COUNT_KEYS if key in generation_config
generation_config[key] is None or _int_or_none(generation_config[key]) in (0, 1)
for key in _CANDIDATE_COUNT_KEYS
if key in generation_config
)

View file

@ -170,7 +170,7 @@ async def test_unary_long_decode_answers_under_the_first_requests_response_id(is
@pytest.mark.parametrize("stream", [True, False])
@pytest.mark.parametrize("sent_as_a_string", [{"n": "1"}, {"max_tokens": "100000"}])
@pytest.mark.parametrize("sent_as_a_string", [{"n": "1"}, {"n": ""}, {"max_tokens": "100000"}])
@pytest.mark.asyncio
async def test_request_whose_n_or_max_tokens_is_a_string_is_sent_once_and_never_continued(
stream: bool, sent_as_a_string: Mapping[str, str]