diff --git a/litellm/main.py b/litellm/main.py index 5a5c1adcc98..cc020d523b3 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -5480,11 +5480,6 @@ def completion( ### VALIDATE Request ### if model is None: raise ValueError("model param not passed in.") - supplemental_params: Final = _supplemental_provider_params( - _REQUEST_KWARGS_ADAPTER.validate_python({**kwargs, "extra_headers": extra_headers}), model - ) - for dropped_key in supplemental_params.dropped_keys: - kwargs.pop(dropped_key) # validate messages messages = validate_and_fix_openai_messages(messages=messages) tools = validate_and_fix_openai_tools(tools=tools) @@ -5496,6 +5491,11 @@ def completion( ######### unpacking kwargs ##################### args: Final = _locals_snapshot(locals()) + supplemental_params: Final = _supplemental_provider_params( + _REQUEST_KWARGS_ADAPTER.validate_python({**kwargs, "extra_headers": extra_headers}), model + ) + for dropped_key in supplemental_params.dropped_keys: + kwargs.pop(dropped_key) # Set by the responses->completion fallback so completion() does not bridge # back to the Responses API: that round-trip mutually recurses forever for a diff --git a/tests/e2e/llm_translation/test_gemini_tool_call_id_length_e2e.py b/tests/e2e/llm_translation/test_gemini_tool_call_id_length_e2e.py index 883b6c08aa2..64fc3aa72af 100644 --- a/tests/e2e/llm_translation/test_gemini_tool_call_id_length_e2e.py +++ b/tests/e2e/llm_translation/test_gemini_tool_call_id_length_e2e.py @@ -25,7 +25,7 @@ from passthrough_client import PassthroughClient pytestmark = pytest.mark.e2e -BACKEND_MODEL: Final = "gemini/gemini-3.5-flash" +BACKEND_MODEL: Final = "gemini/gemini-3.8-flash" GEMINI_API_KEY: Final = "os.environ/GEMINI_API_KEY" # bedrock-agentcore HarnessToolUseId shape in botocore 1.43.6, read 2026-10-20 AGENTCORE_TOOL_USE_ID: Final = re.compile(r"[a-zA-Z0-9_-]{1,64}") @@ -117,7 +117,7 @@ class TestGeminiToolCallIdLength: messages=[_user_message()], tools=[WEATHER_TOOL], tool_choice="required", - max_tokens=128, + max_tokens=2048, extra_body=NO_PROXY_CACHE, ) @@ -138,7 +138,7 @@ class TestGeminiToolCallIdLength: messages=[_user_message()], tools=[WEATHER_TOOL], tool_choice="required", - max_tokens=128, + max_tokens=2048, stream=True, extra_body=NO_PROXY_CACHE, ) @@ -164,7 +164,7 @@ class TestGeminiToolCallIdLength: messages=[question], tools=[WEATHER_TOOL], tool_choice="required", - max_tokens=128, + max_tokens=2048, extra_body=NO_PROXY_CACHE, ) calls: Final = _tool_calls(first) @@ -178,7 +178,7 @@ class TestGeminiToolCallIdLength: messages=[question, assistant, *(_tool_result(call) for call in calls)], tools=[WEATHER_TOOL], tool_choice="none", - max_tokens=128, + max_tokens=2048, extra_body=NO_PROXY_CACHE, )