mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-30 06:43:27 +00:00
fix(main): validate routing kwargs after the locals snapshot so fallbacks and model_list calls keep working
The e2e test now uses gemini-3.8-flash with enough max_tokens to finish thinking before the tool call.
This commit is contained in:
parent
f7e8d9644b
commit
bd8a234bea
2 changed files with 10 additions and 10 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue