浏览代码

Refactor: support config strong test (#9198)

### What problem does this PR solve?


https://github.com/infiniflow/ragflow/issues/9189#issuecomment-3148920950

### Type of change
- [x] Refactoring

Co-authored-by: Kevin Hu <kevinhu.sh@gmail.com>
tags/v0.20.1
Stephen Hu 3 个月前
父节点
当前提交
45bf294117
没有帐户链接到提交者的电子邮件
共有 2 个文件被更改,包括 8 次插入1 次删除
  1. 1
    0
      api/settings.py
  2. 7
    1
      api/utils/api_utils.py

+ 1
- 0
api/settings.py 查看文件

# sandbox-executor-manager # sandbox-executor-manager
SANDBOX_ENABLED = 0 SANDBOX_ENABLED = 0
SANDBOX_HOST = None SANDBOX_HOST = None
STRONG_TEST_COUNT = int(os.environ.get("STRONG_TEST_COUNT", "32"))


BUILTIN_EMBEDDING_MODELS = ["BAAI/bge-large-zh-v1.5@BAAI", "maidalun1020/bce-embedding-base_v1@Youdao"] BUILTIN_EMBEDDING_MODELS = ["BAAI/bge-large-zh-v1.5@BAAI", "maidalun1020/bce-embedding-base_v1@Youdao"]



+ 7
- 1
api/utils/api_utils.py 查看文件





async def is_strong_enough(chat_model, embedding_model): async def is_strong_enough(chat_model, embedding_model):
count = settings.STRONG_TEST_COUNT
if not chat_model or not embedding_model:
return
if isinstance(count, int) and count <= 0:
return

@timeout(60, 2) @timeout(60, 2)
async def _is_strong_enough(): async def _is_strong_enough():
nonlocal chat_model, embedding_model nonlocal chat_model, embedding_model


# Pressure test for GraphRAG task # Pressure test for GraphRAG task
async with trio.open_nursery() as nursery: async with trio.open_nursery() as nursery:
for _ in range(32):
for _ in range(count):
nursery.start_soon(_is_strong_enough) nursery.start_soon(_is_strong_enough)

正在加载...
取消
保存