From 8090b29a4b9e4c56c1fe79b591a439938623aca3 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Fri, 24 Apr 2026 16:01:54 -0700 Subject: [PATCH] fix(litellm_logging): declare _defer_async_logging and _enqueue_deferred_logging on Logging class for mypy --- litellm/litellm_core_utils/litellm_logging.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/litellm/litellm_core_utils/litellm_logging.py b/litellm/litellm_core_utils/litellm_logging.py index 625cb83724b..9e333441c3a 100644 --- a/litellm/litellm_core_utils/litellm_logging.py +++ b/litellm/litellm_core_utils/litellm_logging.py @@ -416,6 +416,12 @@ class Logging(LiteLLMLoggingBaseClass): "model": model, } + # Set by proxy request handlers to defer spend-log fire until after + # post_call guardrails have run; the @client decorator then stores the + # enqueue closure here instead of firing it immediately. + self._defer_async_logging: bool = False + self._enqueue_deferred_logging: Optional[Callable[[], None]] = None + def process_dynamic_callbacks(self): """ Initializes CustomLogger compatible callbacks in self.dynamic_* callbacks