From 4a69e345327cecd3dbe2bd6363f55fb297f3331e Mon Sep 17 00:00:00 2001 From: Wenshansilvia Date: Fri, 15 Nov 2024 18:14:40 +0800 Subject: [PATCH] add claimnum claimfaithfulness repetitiveness --- .../metrics/answer_groundedness/_claim_faithfulness.py | 4 +--- rageval/metrics/answer_informativeness/_claim_num.py | 4 +--- tests/units/test_repetitiveness.py | 8 +++----- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/rageval/metrics/answer_groundedness/_claim_faithfulness.py b/rageval/metrics/answer_groundedness/_claim_faithfulness.py index 06937a8..2bdde4e 100644 --- a/rageval/metrics/answer_groundedness/_claim_faithfulness.py +++ b/rageval/metrics/answer_groundedness/_claim_faithfulness.py @@ -36,9 +36,7 @@ ... ] ... } >>> dataset = Dataset.from_dict(sample) - >>> metric = ClaimFaithfulness(model = "openai//home/gomall/models/Qwen2-7B-Instruct", - api_base = "http://localhost:5000/v1", - api_key = "sk-123456789") + >>> metric = ClaimFaithfulness(model = "openai//home/gomall/models/Qwen2-7B-Instruct", api_base = "http://project.gomall.ac.cn:30590/notebook/tensorboard/wangwenshan/1161/v1", api_key = "sk-123456789") >>> metric.mtype 'answer_informativeness' """ diff --git a/rageval/metrics/answer_informativeness/_claim_num.py b/rageval/metrics/answer_informativeness/_claim_num.py index 188465d..adc5c6f 100644 --- a/rageval/metrics/answer_informativeness/_claim_num.py +++ b/rageval/metrics/answer_informativeness/_claim_num.py @@ -33,9 +33,7 @@ ... ] ... } >>> dataset = Dataset.from_dict(sample) - >>> metric = ClaimNum(model = "openai//home/gomall/models/Qwen2-7B-Instruct", - api_base = "http://localhost:5000/v1", - api_key = "sk-123456789") + >>> metric = ClaimNum(model = "openai//home/gomall/models/Qwen2-7B-Instruct", api_base = "http://localhost:5000/v1", api_key = "sk-123456789") >>> metric.mtype 'answer_informativeness' """ diff --git a/tests/units/test_repetitiveness.py b/tests/units/test_repetitiveness.py index 427cae5..16173eb 100644 --- a/tests/units/test_repetitiveness.py +++ b/tests/units/test_repetitiveness.py @@ -5,7 +5,7 @@ import rageval as rl -#@pytest.fixture(scope='module') +@pytest.fixture(scope='module') def sample(): test_case = { "answers": [ @@ -16,17 +16,15 @@ def sample(): return test_case -#@pytest.fixture(scope='module') +@pytest.fixture(scope='module') def testset(sample): ds = Dataset.from_dict(sample) return ds -#@pytest.mark.slow +@pytest.mark.slow def test_case_on_text_length(testset): metric = Repetitiveness() assert metric.name == "repetitiveness" score, results = metric.compute(testset["answers"]) assert round(score, 2) == 0.16 - -test_case_on_text_length(testset(sample()))