Skip to content

Commit

Permalink
add claimnum claimfaithfulness repetitiveness
Browse files Browse the repository at this point in the history
  • Loading branch information
Wenshansilvia committed Nov 15, 2024
1 parent 798f57c commit 4a69e34
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
4 changes: 1 addition & 3 deletions rageval/metrics/answer_groundedness/_claim_faithfulness.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
"""
Expand Down
4 changes: 1 addition & 3 deletions rageval/metrics/answer_informativeness/_claim_num.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
"""
Expand Down
8 changes: 3 additions & 5 deletions tests/units/test_repetitiveness.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import rageval as rl


#@pytest.fixture(scope='module')
@pytest.fixture(scope='module')
def sample():
test_case = {
"answers": [
Expand All @@ -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()))

0 comments on commit 4a69e34

Please sign in to comment.