From a136c59524cfb0c1f11f7fafd16116cffebdd0c5 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 11 May 2026 23:22:34 +0000 Subject: [PATCH] fix(types): demote TypedDict floating string to a # comment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A string literal placed after a field declaration in a TypedDict body is not a per-field docstring — it's an orphaned string expression Python discards. Tools like mypy / pyright that inspect TypedDict fields won't surface that text either. Move the documentation for error_rate_limit_category to a real comment so the intent is visible to readers and type-checker tooling without the misleading docstring framing. Greptile P2 review feedback on PR #27687. LIT-2968 Co-authored-by: Mateo Wang --- litellm/types/utils.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/litellm/types/utils.py b/litellm/types/utils.py index 832ed12236c..a00f5f982e3 100644 --- a/litellm/types/utils.py +++ b/litellm/types/utils.py @@ -2697,16 +2697,14 @@ class StandardLoggingPayloadErrorInformation(TypedDict, total=False): llm_provider: Optional[str] traceback: Optional[str] error_message: Optional[str] + # error_rate_limit_category: + # For 429 / rate-limit errors, the source of the rate limit. One of the + # string values defined by `litellm.exceptions.RateLimitErrorCategory` + # (vendor_rate_limit, vendor_batch_rate_limit, litellm_rate_limit, + # litellm_batch_rate_limit). None for non-rate-limit exceptions. + # Surfaced here so custom callbacks / metrics consumers can switch on + # the rate-limit source without reaching for the raw exception. error_rate_limit_category: Optional[str] - """ - For 429 / rate-limit errors, the source of the rate limit. One of the - string values defined by :class:`litellm.exceptions.RateLimitErrorCategory` - (``vendor_rate_limit``, ``vendor_batch_rate_limit``, ``litellm_rate_limit``, - ``litellm_batch_rate_limit``). ``None`` for non-rate-limit exceptions. - - Surfaced here so custom callbacks / metrics consumers can switch on the - rate-limit source without reaching for the raw exception. - """ class GuardrailMode(TypedDict, total=False):