rename constant to MCP_INTERNAL_REQUEST_KEYS per review (avoid all_litellm_params name echo)

This commit is contained in:
Chenglun Hu 2026-06-18 09:58:26 +08:00
parent 6c1364512b
commit 6a67fda42e
2 changed files with 9 additions and 5 deletions

View file

@ -682,7 +682,7 @@ def filter_exceptions_from_params(data: object, max_depth: int = 20) -> Any:
# filtering the full `all_litellm_params` (api_key/num_retries/...) would break
# the call, and knobs like stream_chunk_size are read downstream (converse
# streaming) so they are not internal. See #30301.
LITELLM_INTERNAL_PARAMS: set = {
MCP_INTERNAL_REQUEST_KEYS: set = {
"skip_mcp_handler",
"mcp_handler_context",
"_skip_mcp_handler",
@ -693,7 +693,7 @@ def filter_internal_params(data: dict, additional_internal_params: set | None =
"""
Filter out LiteLLM internal parameters that shouldn't be sent to provider APIs.
The base set is `LITELLM_INTERNAL_PARAMS` (pure plumbing, also registered in
The base set is `MCP_INTERNAL_REQUEST_KEYS` (pure plumbing, also registered in
`all_litellm_params`); callers may pass extra names via
`additional_internal_params` for provider-specific knobs.
@ -707,7 +707,7 @@ def filter_internal_params(data: dict, additional_internal_params: set | None =
if not isinstance(data, dict):
return data
internal_params = set(LITELLM_INTERNAL_PARAMS)
internal_params = set(MCP_INTERNAL_REQUEST_KEYS)
if additional_internal_params:
internal_params.update(additional_internal_params)

View file

@ -7,12 +7,16 @@ import pytest
from litellm.litellm_core_utils.core_helpers import (
_FINISH_REASON_MAP,
<<<<<<< HEAD
LITELLM_INTERNAL_PARAMS,
RESPONSE_COST_HEADER,
bind_budget_reservation_to_callbacks,
budget_reservation_from_metadata,
drop_params_env_flag,
drop_params_flag,
=======
MCP_INTERNAL_REQUEST_KEYS,
>>>>>>> 8957cc20e7 (rename constant to MCP_INTERNAL_REQUEST_KEYS per review (avoid all_litellm_params name echo))
filter_internal_params,
get_or_create_metadata_bucket,
get_provider_response_headers_from_hidden_params,
@ -585,9 +589,9 @@ class TestFilterInternalParams:
assert out == {"keep": 1}
def test_registry_not_mutated_by_additional_params(self):
baseline = set(LITELLM_INTERNAL_PARAMS)
baseline = set(MCP_INTERNAL_REQUEST_KEYS)
filter_internal_params({"x": 1}, additional_internal_params={"adhoc_key"})
assert LITELLM_INTERNAL_PARAMS == baseline
assert MCP_INTERNAL_REQUEST_KEYS == baseline
def test_non_dict_passes_through(self):
assert filter_internal_params("not-a-dict") == "not-a-dict"