Skip to content

Commit d6f359c

Browse files
fix cohere reranker test
1 parent c76ae94 commit d6f359c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tests/integration/test_rerankers.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ def reranker(request, skip_reranker):
3333
return request.param(model="rerank-lite-1")
3434

3535

36+
@pytest.fixture
37+
def cohereReranker():
38+
return CohereReranker()
39+
3640
@pytest.fixture
3741
def hfCrossEncoderReranker():
3842
return HFCrossEncoderReranker()
@@ -79,11 +83,10 @@ def test_bad_input_cohere(cohereReranker):
7983
with pytest.raises(Exception):
8084
cohereReranker.rank("valid query", "not a list") # Invalid type for documents
8185

82-
if isinstance(reranker, CohereReranker):
83-
with pytest.raises(Exception):
84-
reranker.rank(
85-
"valid query", [{"field": "valid document"}], rank_by=["invalid_field"]
86-
) # Invalid rank_by field
86+
with pytest.raises(Exception):
87+
reranker.rank(
88+
"valid query", [{"field": "valid document"}], rank_by=["invalid_field"]
89+
) # Invalid rank_by field
8790

8891

8992
def test_rank_documents_cross_encoder(hfCrossEncoderReranker):

0 commit comments

Comments
 (0)