From b3348c665ac6b89ebd50eedd7ee0b64b2b0d600c Mon Sep 17 00:00:00 2001 From: AlexsanderHamir Date: Tue, 25 Nov 2025 14:22:48 -0800 Subject: [PATCH] fix: use cached import helper for Logging in ahealth_check to preserve lazy loading - Use get_litellm_logging_class() from cached_imports instead of direct import - Preserves lazy loading benefit (only loads when function is called) - Follows existing codebase pattern for cached imports - Fixes NameError: name 'Logging' is not defined in test_ahealth_check_ocr --- litellm/main.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/litellm/main.py b/litellm/main.py index 88bf0b72a0b..4482cf5d123 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -6109,6 +6109,10 @@ async def ahealth_check( } """ from litellm.litellm_core_utils.health_check_helpers import HealthCheckHelpers + from litellm.litellm_core_utils.cached_imports import get_litellm_logging_class + + # Use cached import helper to lazy-load Logging class (only loads when function is called) + Logging = get_litellm_logging_class() # Map modes to their corresponding health check calls #########################################################