chore: ruff format core_helpers + test

This commit is contained in:
Chenglun Hu 2026-07-15 22:37:29 +08:00
parent 6a67fda42e
commit 2f74a51360
2 changed files with 9 additions and 13 deletions

View file

@ -682,11 +682,13 @@ 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.
MCP_INTERNAL_REQUEST_KEYS: set = {
"skip_mcp_handler",
"mcp_handler_context",
"_skip_mcp_handler",
}
MCP_INTERNAL_REQUEST_KEYS: Final = frozenset(
(
"skip_mcp_handler",
"mcp_handler_context",
"_skip_mcp_handler",
)
)
def filter_internal_params(data: dict, additional_internal_params: set | None = None) -> dict:
@ -707,9 +709,7 @@ def filter_internal_params(data: dict, additional_internal_params: set | None =
if not isinstance(data, dict):
return data
internal_params = set(MCP_INTERNAL_REQUEST_KEYS)
if additional_internal_params:
internal_params.update(additional_internal_params)
internal_params: Final = MCP_INTERNAL_REQUEST_KEYS | frozenset(additional_internal_params or ())
return {k: v for k, v in data.items() if k not in internal_params}

View file

@ -7,16 +7,12 @@ import pytest
from litellm.litellm_core_utils.core_helpers import (
_FINISH_REASON_MAP,
<<<<<<< HEAD
LITELLM_INTERNAL_PARAMS,
MCP_INTERNAL_REQUEST_KEYS,
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,