Skip to content

Commit 9e6aed8

Browse files
authored
updating hallucination test (#129)
1 parent f6ee12e commit 9e6aed8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/pytest/test_hallucination.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import json
1010
from typing import Any, Dict, List
11+
import pytest
1112

1213
import litellm
1314

@@ -29,6 +30,7 @@ def hallucination_dataset_adapter(data: List[Dict[str, Any]]) -> List[Evaluation
2930
]
3031

3132

33+
@pytest.mark.asyncio
3234
@evaluation_test(
3335
input_dataset=["tests/pytest/data/halueval_sample_dataset.jsonl"],
3436
dataset_adapter=hallucination_dataset_adapter,
@@ -40,7 +42,7 @@ def hallucination_dataset_adapter(data: List[Dict[str, Any]]) -> List[Evaluation
4042
num_runs=1,
4143
mode="pointwise",
4244
)
43-
def test_hallucination_detection(row: EvaluationRow) -> EvaluationRow:
45+
async def test_hallucination_detection(row: EvaluationRow) -> EvaluationRow:
4446
"""
4547
Test for response correctness using LLM-as-judge.
4648
"""
@@ -79,7 +81,7 @@ def test_hallucination_detection(row: EvaluationRow) -> EvaluationRow:
7981
"""
8082

8183
try:
82-
response = litellm.completion(
84+
response = await litellm.acompletion(
8385
model=JUDGE_MODEL,
8486
messages=[{"role": "system", "content": system_prompt}, {"role": "user", "content": user_prompt}],
8587
temperature=0.1,

0 commit comments

Comments
 (0)