cleanup
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import inspect
|
||||
import os
|
||||
from lightrag import LightRAG
|
||||
from lightrag.llm import openai_complete, openai_embed
|
||||
from lightrag.utils import EmbeddingFunc
|
||||
from lightrag.utils import EmbeddingFunc, always_get_an_event_loop
|
||||
from lightrag import QueryParam
|
||||
|
||||
# WorkingDir
|
||||
@@ -44,3 +45,10 @@ async def print_stream(stream):
|
||||
async for chunk in stream:
|
||||
if chunk:
|
||||
print(chunk, end="", flush=True)
|
||||
|
||||
|
||||
loop = always_get_an_event_loop()
|
||||
if inspect.isasyncgen(resp):
|
||||
loop.run_until_complete(print_stream(resp))
|
||||
else:
|
||||
print(resp)
|
||||
|
Reference in New Issue
Block a user