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))

View File

@@ -50,5 +50,18 @@
"create_time": 1756195954,
"update_time": 1756195954,
"_id": "default:extract:66842cd8466b98a780c319608a8083b1"
},
"hybrid:keywords:071f224e4117a8c20e9db67c6065c076": {
"return": "{\"high_level_keywords\": [\"\\u7b80\\u6d01\\u56de\\u590d\"], \"low_level_keywords\": []}",
"cache_type": "keywords",
"chunk_id": null,
"embedding": null,
"embedding_shape": null,
"embedding_min": null,
"embedding_max": null,
"original_prompt": "简洁回复。",
"create_time": 1756196373,
"update_time": 1756196373,
"_id": "hybrid:keywords:071f224e4117a8c20e9db67c6065c076"
}
}