Skip to content

Commit af57e76

Browse files
committed
Fix unit test
1 parent 7c07569 commit af57e76

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

rag_experiment_accelerator/evaluation/tests/test_llm_based_metrics.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,28 @@ def test_llm_context_precision(mock_generate_response):
4646

4747
@patch("rag_experiment_accelerator.evaluation.eval.ResponseGenerator")
4848
def test_llm_context_recall(mock_generate_response):
49-
mock_generate_response.generate_response.return_value = (
50-
'"Attributed": "1" "Attributed": "1" "Attributed": "1" "Attributed": "0"'
51-
)
49+
mock_generate_response.generate_response.return_value = [
50+
{
51+
"statement_1": "Test statement 1",
52+
"reason": "The statement is in the context",
53+
"attributed": "1",
54+
},
55+
{
56+
"statement_2": "Test statement 2",
57+
"reason": "The statement is in the context",
58+
"attributed": "1",
59+
},
60+
{
61+
"statement_3": "Test statement 3",
62+
"reason": "The statement is in the context",
63+
"attributed": "0",
64+
},
65+
{
66+
"statement_4": "Test statement 4",
67+
"reason": "The statement is in the context",
68+
"attributed": "1",
69+
},
70+
]
5271
question = "What is the name of the largest bone in the human body?"
5372
context = 'According to the Cleveland Clinic, "The femur is the largest and strongest bone in the human body. It can support as much as 30 times the weight of your body. The average adult male femur is 48 cm (18.9 in) in length and 2.34 cm (0.92 in) in diameter. The average weight among adult males in the United States is 196 lbs (872 N). Therefore, the adult male femur can support roughly 6,000 lbs of compressive force."'
5473
answer = "The largest bone in the human body is the femur, also known as the thigh bone. It is about 19.4 inches (49.5 cm) long on average and can support up to 30 times the weight of a person’s body."

0 commit comments

Comments
 (0)