yangdx commited on
Commit
e48aadd
·
1 Parent(s): c01d639

去掉流式查询和输出

Browse files
Files changed (1) hide show
  1. examples/lightrag_yangdx.py +14 -14
examples/lightrag_yangdx.py CHANGED
@@ -1,6 +1,6 @@
1
- import asyncio
2
  import os
3
- import inspect
 
4
  import logging
5
  from dotenv import load_dotenv
6
  from lightrag import LightRAG, QueryParam
@@ -64,19 +64,19 @@ print(
64
  rag.query("What are the top themes in this story?", param=QueryParam(mode="hybrid"))
65
  )
66
 
67
- # stream response
68
- resp = rag.query(
69
- "What are the top themes in this story?",
70
- param=QueryParam(mode="hybrid", stream=True),
71
- )
72
 
73
 
74
- async def print_stream(stream):
75
- async for chunk in stream:
76
- print(chunk, end="", flush=True)
77
 
78
 
79
- if inspect.isasyncgen(resp):
80
- asyncio.run(print_stream(resp))
81
- else:
82
- print(resp)
 
 
1
  import os
2
+ # import asyncio
3
+ # import inspect
4
  import logging
5
  from dotenv import load_dotenv
6
  from lightrag import LightRAG, QueryParam
 
64
  rag.query("What are the top themes in this story?", param=QueryParam(mode="hybrid"))
65
  )
66
 
67
+ # # stream response
68
+ # resp = rag.query(
69
+ # "What are the top themes in this story?",
70
+ # param=QueryParam(mode="hybrid", stream=True),
71
+ # )
72
 
73
 
74
+ # async def print_stream(stream):
75
+ # async for chunk in stream:
76
+ # print(chunk, end="", flush=True)
77
 
78
 
79
+ # if inspect.isasyncgen(resp):
80
+ # asyncio.run(print_stream(resp))
81
+ # else:
82
+ # print(resp)