mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Perf: test llm before RAPTOR. (#8897)
### What problem does this PR solve? ### Type of change - [x] Performance Improvement
This commit is contained in:
@ -670,3 +670,18 @@ def timeout(
|
||||
return wrapper
|
||||
return decorator
|
||||
|
||||
|
||||
async def is_strong_enough(chat_model, embedding_model):
|
||||
|
||||
@timeout(30, 2)
|
||||
async def _is_strong_enough():
|
||||
nonlocal chat_model, embedding_model
|
||||
_ = await trio.to_thread.run_sync(lambda: embedding_model.encode(["Are you strong enough!?"]))
|
||||
res = await trio.to_thread.run_sync(lambda: chat_model.chat("Nothing special.", [{"role":"user", "content": "Are you strong enough!?"}], {}))
|
||||
if res.find("**ERROR**") >= 0:
|
||||
raise Exception(res)
|
||||
|
||||
# Pressure test for GraphRAG task
|
||||
async with trio.open_nursery() as nursery:
|
||||
for _ in range(12):
|
||||
nursery.start_soon(_is_strong_enough, chat_model, embedding_model)
|
||||
Reference in New Issue
Block a user