From 02babced24be65631c2dd2e2385bdc9e54a00eb8 Mon Sep 17 00:00:00 2001 From: yucheng Date: Sun, 20 Sep 2026 00:13:49 +0000 Subject: [PATCH] refactor(headroom): trim the min_tokens estimator docstring Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../guardrails/guardrail_hooks/headroom/headroom.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/litellm/proxy/guardrails/guardrail_hooks/headroom/headroom.py b/litellm/proxy/guardrails/guardrail_hooks/headroom/headroom.py index f58b2fcb868..fdbfac792a7 100644 --- a/litellm/proxy/guardrails/guardrail_hooks/headroom/headroom.py +++ b/litellm/proxy/guardrails/guardrail_hooks/headroom/headroom.py @@ -104,14 +104,7 @@ def _flatten_messages_for_compression(messages: list[dict[str, object]]) -> list async def _estimate_compressible_tokens(model: object, messages: list[dict[str, object]]) -> int | None: - """Token estimate for the min_tokens gate, or None when no trustworthy count exists. - - Only rows whose flattened content is a plain string count: the service - passes list-of-parts rows through untouched, so their tokens can never - turn into savings. None keeps the request on the compression path: a - disabled global counter reports 0 for everything, and a row shape the - counter rejects must not turn into a failed request. - """ + """Tokens in the plain-string rows the service can compress, or None to always compress.""" if litellm.disable_token_counter: return None string_rows: Final = [m for m in messages if isinstance(m.get("content"), str)]