Skip to content

Commit b725071

Browse files
committed
将llm config设置在测评脚本中
1 parent 26a33d3 commit b725071

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

examples/multi_extractor_compare.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
from webmainbench import DataLoader, Evaluator, ExtractorFactory, DataSaver
22
from pathlib import Path
33

4+
# 全局LLM配置
5+
LLM_CONFIG = {
6+
'llm_base_url': '',
7+
'llm_api_key': '',
8+
'llm_model': '',
9+
'use_llm': True # 🤖使用时改为True
10+
}
411

512
def all_extractor_comparison():
613
"""演示多抽取器对比"""

webmainbench/metrics/base.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -196,22 +196,16 @@ def _extract_from_markdown(text: str, field_name: str = None) -> Dict[str, str]:
196196
if not text:
197197
return {'code': '', 'formula': '', 'table': '', 'text': ''}
198198

199-
# 创建提取器配置
200-
config = {
201-
'llm_base_url': 'http://35.220.164.252:3888/v1/',
202-
'llm_api_key': 'sk-PZgDr7sZdt77805Cg8s5ZB9QnGMGke61ovYnHYcHKIYVGHNA',
203-
'llm_model': 'deepseek-chat',
204-
'use_llm': True # 使用时改为True
205-
}
206-
199+
# 加载 llm 配置
200+
from examples.multi_extractor_compare import LLM_CONFIG
207201
# 直接创建具体的提取器实例
208202
from .code_extractor import CodeSplitter
209203
from .formula_extractor import FormulaSplitter
210204
from .table_extractor import TableSplitter
211205

212-
code_extractor = CodeSplitter(config)
213-
formula_extractor = FormulaSplitter(config)
214-
table_extractor = TableSplitter(config)
206+
code_extractor = CodeSplitter(LLM_CONFIG)
207+
formula_extractor = FormulaSplitter(LLM_CONFIG)
208+
table_extractor = TableSplitter(LLM_CONFIG)
215209

216210
# 提取各类内容
217211
code_content = code_extractor.extract(text, field_name)

0 commit comments

Comments
 (0)