Skip to content

Commit 974d492

Browse files
authored
docs: update README (#299)
1 parent 9e5f3a5 commit 974d492

File tree

3 files changed

+71
-29
lines changed

3 files changed

+71
-29
lines changed

README.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,19 @@ Clean plugin architecture for custom rules, prompts, and models:
263263
class MyCustomRule(BaseRule):
264264
@classmethod
265265
def eval(cls, input_data: Data) -> EvalDetail:
266-
# Your logic here
267-
return EvalDetail(status=False, label=['QUALITY_GOOD'])
266+
# Example: check if content is empty
267+
if not input_data.content:
268+
return EvalDetail(
269+
metric=cls.__name__,
270+
status=True, # Found an issue
271+
label=[f'{cls.metric_type}.{cls.__name__}'],
272+
reason=["Content is empty"]
273+
)
274+
return EvalDetail(
275+
metric=cls.__name__,
276+
status=False, # No issue found
277+
label=['QUALITY_GOOD']
278+
)
268279
```
269280
**Why It Matters**: Adapt to domain-specific requirements without forking the codebase.
270281

@@ -287,9 +298,9 @@ Dingo provides **70+ evaluation metrics** across multiple dimensions, combining
287298
| **Security** | PII detection, Perspective API toxicity | Privacy and safety |
288299

289300
📊 **[View Complete Metrics Documentation →](docs/metrics.md)**
290-
📖 **[RAG Evaluation Guide →](docs/rag_evaluation_metrics_zh.md)**
291-
🔍 **[Hallucination Detection Guide →](docs/hallucination_guide.md)**
292-
**[Factuality Assessment Guide →](docs/factcheck_guide.md)**
301+
📖 **[RAG Evaluation Guide (中文) ](docs/rag_evaluation_metrics_zh.md)**
302+
🔍 **[Hallucination Detection Guide (中文) ](docs/hallucination_guide.md)**
303+
**[Factuality Assessment Guide (中文) ](docs/factcheck_guide.md)**
293304

294305
Most metrics are backed by academic research to ensure scientific rigor.
295306

@@ -451,6 +462,7 @@ class DomainSpecificRule(BaseRule):
451462
is_valid = your_validation_logic(text)
452463

453464
return EvalDetail(
465+
metric=cls.__name__,
454466
status=not is_valid, # False = good, True = bad
455467
label=['QUALITY_GOOD' if is_valid else 'QUALITY_BAD_CUSTOM'],
456468
reason=["Validation details..."]

README_ja.md

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,19 @@ outputs/
260260
class MyCustomRule(BaseRule):
261261
@classmethod
262262
def eval(cls, input_data: Data) -> EvalDetail:
263-
# あなたのロジック
264-
return EvalDetail(status=False, label=['QUALITY_GOOD'])
263+
# 例:コンテンツが空かチェック
264+
if not input_data.content:
265+
return EvalDetail(
266+
metric=cls.__name__,
267+
status=True, # 問題を発見
268+
label=[f'{cls.metric_type}.{cls.__name__}'],
269+
reason=["コンテンツが空です"]
270+
)
271+
return EvalDetail(
272+
metric=cls.__name__,
273+
status=False, # 問題なし
274+
label=['QUALITY_GOOD']
275+
)
265276
```
266277
**重要性**:コードベースをフォークせずにドメイン固有のニーズに適応。
267278

@@ -435,22 +446,26 @@ Dingo はドメイン固有のニーズに対応する柔軟な拡張メカニ
435446
```python
436447
from dingo.model import Model
437448
from dingo.model.rule.base import BaseRule
438-
from dingo.config.input_args import EvaluatorRuleArgs
439449
from dingo.io import Data
440450
from dingo.io.output.eval_detail import EvalDetail
441451

442-
443-
@Model.rule_register('QUALITY_BAD_RELEVANCE', ['default'])
444-
class MyCustomRule(BaseRule):
445-
"""テキスト内のカスタムパターンをチェック"""
446-
447-
dynamic_config = EvaluatorRuleArgs(pattern=r'your_pattern_here')
452+
@Model.rule_register('QUALITY_BAD_CUSTOM', ['default'])
453+
class DomainSpecificRule(BaseRule):
454+
"""ドメイン固有のパターンをチェック"""
448455

449456
@classmethod
450457
def eval(cls, input_data: Data) -> EvalDetail:
451-
res = EvalDetail()
452-
# ここにルール実装
453-
return res
458+
text = input_data.content
459+
460+
# あなたのカスタムロジック
461+
is_valid = your_validation_logic(text)
462+
463+
return EvalDetail(
464+
metric=cls.__name__,
465+
status=not is_valid, # False = 良好, True = 問題あり
466+
label=['QUALITY_GOOD' if is_valid else 'QUALITY_BAD_CUSTOM'],
467+
reason=["検証の詳細..."]
468+
)
454469
```
455470

456471
### カスタムLLM統合

README_zh-CN.md

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,19 @@ outputs/
262262
class MyCustomRule(BaseRule):
263263
@classmethod
264264
def eval(cls, input_data: Data) -> EvalDetail:
265-
# 你的逻辑
266-
return EvalDetail(status=False, label=['QUALITY_GOOD'])
265+
# 示例:检查内容是否为空
266+
if not input_data.content:
267+
return EvalDetail(
268+
metric=cls.__name__,
269+
status=True, # 发现问题
270+
label=[f'{cls.metric_type}.{cls.__name__}'],
271+
reason=["内容为空"]
272+
)
273+
return EvalDetail(
274+
metric=cls.__name__,
275+
status=False, # 未发现问题
276+
label=['QUALITY_GOOD']
277+
)
267278
```
268279
**为什么重要**:适应特定领域需求而无需分叉代码库。
269280

@@ -437,22 +448,26 @@ Dingo 提供灵活的扩展机制来满足特定领域需求。
437448
```python
438449
from dingo.model import Model
439450
from dingo.model.rule.base import BaseRule
440-
from dingo.config.input_args import EvaluatorRuleArgs
441451
from dingo.io import Data
442452
from dingo.io.output.eval_detail import EvalDetail
443453

444-
445-
@Model.rule_register('QUALITY_BAD_RELEVANCE', ['default'])
446-
class MyCustomRule(BaseRule):
447-
"""检查文本中的自定义模式"""
448-
449-
dynamic_config = EvaluatorRuleArgs(pattern=r'your_pattern_here')
454+
@Model.rule_register('QUALITY_BAD_CUSTOM', ['default'])
455+
class DomainSpecificRule(BaseRule):
456+
"""检查特定领域的模式"""
450457

451458
@classmethod
452459
def eval(cls, input_data: Data) -> EvalDetail:
453-
res = EvalDetail()
454-
# 您的规则实现
455-
return res
460+
text = input_data.content
461+
462+
# 你的自定义逻辑
463+
is_valid = your_validation_logic(text)
464+
465+
return EvalDetail(
466+
metric=cls.__name__,
467+
status=not is_valid, # False = 良好, True = 有问题
468+
label=['QUALITY_GOOD' if is_valid else 'QUALITY_BAD_CUSTOM'],
469+
reason=["验证详情..."]
470+
)
456471
```
457472

458473
### 自定义LLM集成

0 commit comments

Comments
 (0)