From 7d394fb0a4a93e4176236f7e9f731d949ccb0c89 Mon Sep 17 00:00:00 2001 From: yangdx Date: Thu, 13 Nov 2025 12:56:01 +0800 Subject: [PATCH] Replace asyncio.iscoroutine with inspect.isawaitable for better detection --- lightrag/lightrag.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lightrag/lightrag.py b/lightrag/lightrag.py index 96320afc..277eaf85 100644 --- a/lightrag/lightrag.py +++ b/lightrag/lightrag.py @@ -3,6 +3,7 @@ from __future__ import annotations import traceback import asyncio import configparser +import inspect import os import time import warnings @@ -1793,8 +1794,8 @@ class LightRAG: self.chunk_token_size, ) - # If result is a coroutine, await to get actual result - if asyncio.iscoroutine(chunking_result): + # If result is awaitable, await to get actual result + if inspect.isawaitable(chunking_result): chunking_result = await chunking_result # Validate return type