cleanup
This commit is contained in:
parent
60717fd6be
commit
38dc2466da
1 changed files with 9 additions and 1 deletions
|
|
@ -1,7 +1,8 @@
|
||||||
|
import inspect
|
||||||
import os
|
import os
|
||||||
from lightrag import LightRAG
|
from lightrag import LightRAG
|
||||||
from lightrag.llm import openai_complete, openai_embed
|
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
|
from lightrag import QueryParam
|
||||||
|
|
||||||
# WorkingDir
|
# WorkingDir
|
||||||
|
|
@ -44,3 +45,10 @@ async def print_stream(stream):
|
||||||
async for chunk in stream:
|
async for chunk in stream:
|
||||||
if chunk:
|
if chunk:
|
||||||
print(chunk, end="", flush=True)
|
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)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue