feat: LLM/Embedding 重试次数纳入 system.yaml 统一配置
- system.yaml: llm.max_retries(死配置) 改为 llm.max_attempts;embedding 段新增 max_attempts - llm/client.py: LLMConfig 新增 max_attempts(默认 3 兜底),load_llm_config 读取配置 - llm/extractor.py: translate_and_extract(_async) max_attempts=None 时取 config.max_attempts - embedding/client.py: load_embedding_config 读取 embedding.max_attempts - scheduler/reporter.py: _call_llm_simple max_retries=None 时取 max_attempts-1 - 新增 2 个配置读取测试;已同步 pi5 验证
This commit is contained in:
@@ -457,6 +457,12 @@ class TestLoadLLMConfig:
|
||||
with pytest.raises(ValueError, match="API key 未配置"):
|
||||
load_llm_config(provider="deepseek")
|
||||
|
||||
def test_max_attempts_from_system_yaml(self, monkeypatch):
|
||||
"""重试次数取自 system.yaml llm.max_attempts(当前 3)。"""
|
||||
monkeypatch.setenv("DEEPSEEK_API_KEY", "sk-deepseek-test-key")
|
||||
config = load_llm_config(provider="deepseek")
|
||||
assert config.max_attempts == 3
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------- #
|
||||
# translate_and_extract(mock LLM)
|
||||
|
||||
Reference in New Issue
Block a user