Replace asyncio.iscoroutine with inspect.isawaitable for better detection
This commit is contained in:
parent
297e460740
commit
c230d1a28d
1 changed files with 3 additions and 2 deletions
|
|
@ -3,6 +3,7 @@ from __future__ import annotations
|
||||||
import traceback
|
import traceback
|
||||||
import asyncio
|
import asyncio
|
||||||
import configparser
|
import configparser
|
||||||
|
import inspect
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import warnings
|
import warnings
|
||||||
|
|
@ -1771,8 +1772,8 @@ class LightRAG:
|
||||||
self.chunk_token_size,
|
self.chunk_token_size,
|
||||||
)
|
)
|
||||||
|
|
||||||
# If result is a coroutine, await to get actual result
|
# If result is awaitable, await to get actual result
|
||||||
if asyncio.iscoroutine(chunking_result):
|
if inspect.isawaitable(chunking_result):
|
||||||
chunking_result = await chunking_result
|
chunking_result = await chunking_result
|
||||||
|
|
||||||
# Validate return type
|
# Validate return type
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue