From 0d72e03c788b8573aa200d0fc78cbab7f391ae1b Mon Sep 17 00:00:00 2001 From: Alexsander Hamir Date: Mon, 5 Jan 2026 09:50:57 -0800 Subject: [PATCH] Fix lazy loading for get_coroutine_checker in function_setup and check_coroutine - Add lazy loading for get_coroutine_checker at start of function_setup to ensure all calls use lazy-loaded version - Fix check_coroutine function to use lazy loading pattern via getattr - All direct calls to get_coroutine_checker() now properly use lazy import mechanism --- litellm/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/litellm/utils.py b/litellm/utils.py index f7f6bfa653c..6b9aeca0934 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -764,6 +764,9 @@ def function_setup( # noqa: PLR0915 ## LOGGING SETUP function_id: Optional[str] = kwargs["id"] if "id" in kwargs else None + ## LAZY LOAD COROUTINE CHECKER ## + get_coroutine_checker = getattr(sys.modules[__name__], 'get_coroutine_checker') + ## DYNAMIC CALLBACKS ## dynamic_callbacks: Optional[List[Union[str, Callable, "CustomLogger"]]] = ( kwargs.pop("callbacks", None)