style: apply black formatting to health-check files

CI lint job (black 24.10.0) flagged 2 files as would-be-reformatted; this
commit applies the formatting verbatim with no logic changes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
xianren 2026-04-29 12:21:03 +08:00
parent 1dee0d0750
commit a8b9a6923f
3 changed files with 4 additions and 12 deletions

View file

@ -157,9 +157,7 @@ class HealthCheckHelpers:
**model_params,
),
"completion": lambda: litellm.atext_completion(
**_filter_model_params(
model_params=model_params, keep_max_tokens=True
),
**_filter_model_params(model_params=model_params, keep_max_tokens=True),
prompt=prompt or "test",
),
"embedding": lambda: litellm.aembedding(

View file

@ -13,14 +13,10 @@ _COMPLETION_HEALTH_CHECK_STRIP_KEYS = {"messages"}
#: ``400 Unknown parameter: 'max_tokens'``. ``atext_completion`` does accept
#: ``max_tokens``, so the ``completion`` mode keeps it (preserves the
#: ``BACKGROUND_HEALTH_CHECK_MAX_TOKENS`` cost cap).
_NON_CHAT_HEALTH_CHECK_STRIP_KEYS = _COMPLETION_HEALTH_CHECK_STRIP_KEYS | {
"max_tokens"
}
_NON_CHAT_HEALTH_CHECK_STRIP_KEYS = _COMPLETION_HEALTH_CHECK_STRIP_KEYS | {"max_tokens"}
def _filter_model_params(
model_params: dict, *, keep_max_tokens: bool = False
) -> dict:
def _filter_model_params(model_params: dict, *, keep_max_tokens: bool = False) -> dict:
"""Strip chat-only params before invoking a non-chat health check handler.
``litellm.acompletion`` is the only mode handler that consumes

View file

@ -43,9 +43,7 @@ def test_filter_keeps_max_tokens_for_completion_mode():
``litellm.atext_completion`` accepts ``max_tokens``; stripping it would
silently remove the ``BACKGROUND_HEALTH_CHECK_MAX_TOKENS`` cost cap.
"""
filtered = _filter_model_params(
model_params=_sample_params(), keep_max_tokens=True
)
filtered = _filter_model_params(model_params=_sample_params(), keep_max_tokens=True)
assert "messages" not in filtered
assert filtered.get("max_tokens") == 5