From e9929d2798ac1cfc81b9a485c540c163f2184488 Mon Sep 17 00:00:00 2001 From: Julio Quinteros Pro Date: Tue, 17 Feb 2026 15:48:09 -0300 Subject: [PATCH] fix: replace deprecated asyncio.iscoroutinefunction with inspect.iscoroutinefunction - Replace asyncio.iscoroutinefunction() with inspect.iscoroutinefunction() - Add inspect import - Fixes deprecation warning in Python 3.16 The asyncio.iscoroutinefunction is deprecated and will be removed in Python 3.16. Using inspect.iscoroutinefunction is the recommended approach. Co-Authored-By: Claude Sonnet 4.5 --- litellm/litellm_core_utils/logging_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/litellm/litellm_core_utils/logging_utils.py b/litellm/litellm_core_utils/logging_utils.py index bf43519afc6..8cde8ccef1c 100644 --- a/litellm/litellm_core_utils/logging_utils.py +++ b/litellm/litellm_core_utils/logging_utils.py @@ -1,5 +1,6 @@ import asyncio import functools +import inspect import time from datetime import datetime from typing import TYPE_CHECKING, Any, List, Optional, Union @@ -270,7 +271,7 @@ def track_llm_api_timing(): verbose_logger.debug(f"Error in service logging: {str(e)}") # Check if the function is async or sync - if asyncio.iscoroutinefunction(func): + if inspect.iscoroutinefunction(func): return async_wrapper return sync_wrapper