mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-02 07:13:02 +00:00
fix(gemini): reject nonnumeric candidate counts for long decode
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
a713ed6bab
commit
6d83312d2f
2 changed files with 11 additions and 2 deletions
|
|
@ -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
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -518,7 +518,14 @@ async def test_unary_answer_cut_at_the_callers_cap_is_returned_with_its_token_in
|
|||
|
||||
@pytest.mark.parametrize(
|
||||
"choice_count_request",
|
||||
[{"max_tokens": 100_000, "n": 2}, {"extra_body": {"generationConfig": {"candidateCount": 2}}}],
|
||||
[
|
||||
{"max_tokens": 100_000, "n": 2},
|
||||
{"extra_body": {"generationConfig": {"candidateCount": 2}}},
|
||||
{"max_tokens": 100_000, "n": ""},
|
||||
{"max_tokens": 100_000, "n": []},
|
||||
{"max_tokens": 100_000, "n": {}},
|
||||
{"max_tokens": 100_000, "n": "1"},
|
||||
],
|
||||
)
|
||||
@pytest.mark.parametrize("is_async", [True, False])
|
||||
@pytest.mark.asyncio
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue