fix: replace asyncio.iscoroutinefunction with inspect.iscoroutinefunction

- asyncio.iscoroutinefunction() is deprecated in Python 3.16
- Use inspect.iscoroutinefunction() instead (standard library function)
- Removes deprecation warning in track_llm_api_timing decorator

This is part of the broader effort to remove Python 3.16 deprecation warnings.
This commit is contained in:
Julio Quinteros Pro 2026-02-17 17:11:34 -03:00
parent e37befd5b4
commit 6678b2bd1d

View file

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