From c230d1a28d1ffb8de43010d49e945c1dabaee257 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 8bec154f..e540e3b7 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 @@ -1771,8 +1772,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