This commit is contained in:
2025-08-26 16:20:00 +08:00
parent 188b3d7679
commit a97ba17c93
2 changed files with 19 additions and 5 deletions

View File

@@ -3,12 +3,11 @@ import inspect
from Util.LightRagUtil import configure_logging, initialize_rag, print_stream
from lightrag import QueryParam
async def query():
async def query(user_prompt,rag_path):
try:
user_prompt = "简洁回复。"
rag = await initialize_rag('./Topic/HuangWanQiao')
rag = await initialize_rag(rag_path)
resp = await rag.aquery(
"文档的主要内容是什么",
user_prompt,
param=QueryParam(mode="hybrid", stream=True, user_prompt=user_prompt),
)
if inspect.isasyncgen(resp):
@@ -23,5 +22,7 @@ async def query():
if __name__ == "__main__":
rag_path='./Topic/HuangWanQiao'
user_prompt = "简洁回复。"
configure_logging()
asyncio.run(query())
asyncio.run(query(user_prompt,rag_path))