fix(types): demote TypedDict floating string to a # comment

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 <mateo-berri@users.noreply.github.com>
This commit is contained in:
Cursor Agent 2026-05-11 23:22:34 +00:00
parent 2074848185
commit a136c59524
No known key found for this signature in database

View file

@ -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):