fix: omit null web search options on chained calls

This commit is contained in:
tarunag10 2026-08-20 13:20:06 +05:30
parent e5ffc4f8db
commit 887d8c751d
2 changed files with 4 additions and 0 deletions

View file

@ -85,6 +85,8 @@ class LiteLLM_Proxy_MCP_Handler:
follow_up_params = dict(params) follow_up_params = dict(params)
follow_up_params.pop("litellm_logging_obj", None) follow_up_params.pop("litellm_logging_obj", None)
follow_up_params.pop("litellm_call_id", None) follow_up_params.pop("litellm_call_id", None)
if follow_up_params.get("web_search_options") is None:
follow_up_params.pop("web_search_options", None)
nested_params = follow_up_params.get("litellm_params") nested_params = follow_up_params.get("litellm_params")
if isinstance(nested_params, dict): if isinstance(nested_params, dict):

View file

@ -451,6 +451,7 @@ def test_prepare_follow_up_call_params_resets_per_call_logging_state():
"litellm_logging_obj": object(), "litellm_logging_obj": object(),
"litellm_trace_id": "trace-1", "litellm_trace_id": "trace-1",
"tool_choice": "auto", "tool_choice": "auto",
"web_search_options": None,
"litellm_params": { "litellm_params": {
"litellm_call_id": "nested-parent-call", "litellm_call_id": "nested-parent-call",
"litellm_logging_obj": object(), "litellm_logging_obj": object(),
@ -467,6 +468,7 @@ def test_prepare_follow_up_call_params_resets_per_call_logging_state():
assert follow_up["litellm_trace_id"] == "trace-1" assert follow_up["litellm_trace_id"] == "trace-1"
assert follow_up["stream"] is True assert follow_up["stream"] is True
assert "tool_choice" not in follow_up assert "tool_choice" not in follow_up
assert "web_search_options" not in follow_up
assert follow_up["litellm_params"]["metadata"] == {"team": "legal"} assert follow_up["litellm_params"]["metadata"] == {"team": "legal"}
assert original["litellm_call_id"] == "parent-call" assert original["litellm_call_id"] == "parent-call"