Skip to content

Commit cd8afce

Browse files
committed
feat: add retrieval eval
1 parent ca1d86e commit cd8afce

19 files changed

Lines changed: 1593 additions & 5 deletions

README.md

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,10 @@ pip install dingo-python
133133
# With HHEM hallucination detection model (requires transformers + torch)
134134
pip install "dingo-python[hhem]"
135135

136-
# With all features (HHEM + Agent)
136+
# With retrieval benchmark evaluation (MTEB + pytrec_eval)
137+
pip install "dingo-python[retrieval]"
138+
139+
# With all features (HHEM + Agent + Retrieval)
137140
pip install "dingo-python[all]"
138141
```
139142

@@ -657,6 +660,48 @@ result = executor.execute()
657660

658661
**Best For**: Production pipelines, distributed processing, datasets > 1M rows
659662

663+
### Retrieval Benchmark Executor
664+
665+
Evaluate search APIs against MTEB standard retrieval benchmarks (SciFact, SCIDOCS, etc.) with metrics like NDCG, Recall, and MRR.
666+
667+
**CLI:**
668+
669+
```bash
670+
pip install dingo-python[retrieval]
671+
672+
dingo eval-retrieval --backend agentic --tasks SciFact \
673+
--api-url https://api.sciverse.space \
674+
--api-token YOUR_TOKEN --limit 100 --max-workers 8
675+
```
676+
677+
**SDK:**
678+
679+
```python
680+
from dingo.config import InputArgs
681+
from dingo.exec import Executor
682+
683+
input_data = {
684+
"input_path": "SciFact",
685+
"output_path": "outputs/retrieval_eval",
686+
"executor": {
687+
"retrieval": {
688+
"backend": "agentic",
689+
"api_url": "https://api.sciverse.space",
690+
"api_token": "YOUR_TOKEN",
691+
"limit": 100,
692+
"max_workers": 8,
693+
}
694+
},
695+
}
696+
697+
input_args = InputArgs(**input_data)
698+
executor = Executor.exec_map["retrieval"](input_args)
699+
result = executor.execute()
700+
print(result)
701+
```
702+
703+
**Best For**: Evaluating search/retrieval APIs against academic benchmarks, comparing retrieval backends
704+
660705
## Evaluation Reports
661706

662707
After evaluation, Dingo generates:

README_ja.md

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,10 @@ pip install dingo-python
132132
# HHEM 幻覚検出モデル(transformers + torch が必要)
133133
pip install "dingo-python[hhem]"
134134

135-
# 全機能をインストール(HHEM + Agent)
135+
# 検索プラットフォームベンチマーク評価(MTEB + pytrec_eval)
136+
pip install "dingo-python[retrieval]"
137+
138+
# 全機能をインストール(HHEM + Agent + Retrieval)
136139
pip install "dingo-python[all]"
137140
```
138141

@@ -661,6 +664,52 @@ executor = Executor.exec_map["spark"](input_args, spark_session=spark, spark_rdd
661664
result = executor.execute()
662665
```
663666

667+
### 検索ベンチマーク評価
668+
669+
検索 API を MTEB 標準検索ベンチマーク(SciFact、SCIDOCS など)で評価し、NDCG、Recall、MRR などの指標を算出します。
670+
671+
**CLI:**
672+
673+
```bash
674+
pip install dingo-python[retrieval]
675+
676+
dingo eval-retrieval --backend agentic --tasks SciFact \
677+
--api-url https://api.sciverse.space \
678+
--api-token YOUR_TOKEN --limit 100 --max-workers 8
679+
```
680+
681+
**SDK:**
682+
683+
```python
684+
from dingo.config import InputArgs
685+
from dingo.exec import Executor
686+
687+
input_data = {
688+
"input_path": "SciFact",
689+
"output_path": "outputs/retrieval_eval",
690+
"executor": {
691+
"retrieval": {
692+
"backend": "agentic",
693+
"api_url": "https://api.sciverse.space",
694+
"api_token": "YOUR_TOKEN",
695+
"limit": 100,
696+
"max_workers": 8,
697+
}
698+
},
699+
}
700+
701+
input_args = InputArgs(**input_data)
702+
executor = Executor.exec_map["retrieval"](input_args)
703+
result = executor.execute()
704+
print(result)
705+
```
706+
707+
サポートされるパラメータ:
708+
- `--tasks`: MTEB タスク名(カンマ区切りで複数指定可能、例:`SciFact,SCIDOCS`
709+
- `--max-queries`: クエリ数の制限(テスト用)
710+
- `--max-workers`: 並行スレッド数(デフォルト:4)
711+
- `--retrieval-mode`: 検索モード(`hybrid`/`milvus`
712+
664713
## 評価レポート
665714

666715
評価後、Dingoは以下を生成します:

README_zh-CN.md

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,10 @@ pip install dingo-python
133133
# 安装 HHEM 幻觉检测模型(需要 transformers + torch)
134134
pip install "dingo-python[hhem]"
135135

136-
# 安装全部功能(HHEM + Agent)
136+
# 安装检索平台评测(MTEB + pytrec_eval)
137+
pip install "dingo-python[retrieval]"
138+
139+
# 安装全部功能(HHEM + Agent + Retrieval)
137140
pip install "dingo-python[all]"
138141
```
139142

@@ -662,6 +665,52 @@ executor = Executor.exec_map["spark"](input_args, spark_session=spark, spark_rdd
662665
result = executor.execute()
663666
```
664667

668+
### 检索平台评测
669+
670+
评估搜索 API 在 MTEB 标准检索基准(SciFact、SCIDOCS 等)上的表现,支持 NDCG、Recall、MRR 等指标。
671+
672+
**CLI 方式:**
673+
674+
```bash
675+
pip install dingo-python[retrieval]
676+
677+
dingo eval-retrieval --backend agentic --tasks SciFact \
678+
--api-url https://api.sciverse.space \
679+
--api-token YOUR_TOKEN --limit 100 --max-workers 8
680+
```
681+
682+
**SDK 方式:**
683+
684+
```python
685+
from dingo.config import InputArgs
686+
from dingo.exec import Executor
687+
688+
input_data = {
689+
"input_path": "SciFact",
690+
"output_path": "outputs/retrieval_eval",
691+
"executor": {
692+
"retrieval": {
693+
"backend": "agentic",
694+
"api_url": "https://api.sciverse.space",
695+
"api_token": "YOUR_TOKEN",
696+
"limit": 100,
697+
"max_workers": 8,
698+
}
699+
},
700+
}
701+
702+
input_args = InputArgs(**input_data)
703+
executor = Executor.exec_map["retrieval"](input_args)
704+
result = executor.execute()
705+
print(result)
706+
```
707+
708+
支持的参数:
709+
- `--tasks`: MTEB 任务名,支持逗号分隔多任务(如 `SciFact,SCIDOCS`
710+
- `--max-queries`: 限制查询数量(用于快速测试)
711+
- `--max-workers`: 并发线程数(默认 4)
712+
- `--retrieval-mode`: 检索模式(`hybrid`/`milvus`
713+
665714
## 评估报告
666715

667716
评估后,Dingo生成:

dingo/config/input_args.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,20 @@ class ExecutorResultSaveArgs(BaseModel):
8282
full_field_sample_count: int = 0 # 保留完整字段样本条数,0表示关闭
8383

8484

85+
class RetrievalArgs(BaseModel):
86+
backend: str = "agentic"
87+
api_url: str = ""
88+
api_token: Optional[str] = None
89+
limit: int = 100
90+
retrieval_mode: str = "hybrid"
91+
sub_queries: Optional[int] = None
92+
max_queries: Optional[int] = None
93+
timeout: float = 120.0
94+
rate_limit: Optional[float] = None
95+
max_retries: int = 3
96+
max_workers: int = 4
97+
98+
8599
class ExecutorArgs(BaseModel):
86100
# eval_group: str = ""
87101
# rule_list: List[str] = []
@@ -92,6 +106,7 @@ class ExecutorArgs(BaseModel):
92106
batch_size: int = 1
93107
multi_turn_mode: Optional[str] = None
94108
result_save: ExecutorResultSaveArgs = ExecutorResultSaveArgs()
109+
retrieval: Optional[RetrievalArgs] = None
95110

96111

97112
class EvaluatorRuleArgs(BaseModel):
@@ -154,7 +169,7 @@ class InputArgs(BaseModel):
154169

155170
dataset: DatasetArgs = DatasetArgs()
156171
executor: ExecutorArgs = ExecutorArgs()
157-
evaluator: List[EvalPipline]
172+
evaluator: List[EvalPipline] = []
158173

159174
def __init__(self, **kwargs):
160175
super().__init__(**kwargs)

dingo/exec/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@
77
except Exception as e:
88
log.warning("Spark Executor not imported. Open debug log for more details.")
99
log.debug(str(e))
10+
11+
try:
12+
from dingo.exec.retrieval import RetrievalExecutor # noqa E402.
13+
except Exception as e:
14+
log.debug("Retrieval Executor not imported (install extras 'retrieval'): %s", e)

0 commit comments

Comments
 (0)