Skip to content

Commit

Permalink
fix cohere reranker test
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerhutcherson committed Jan 14, 2025
1 parent c76ae94 commit d6f359c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions tests/integration/test_rerankers.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ def reranker(request, skip_reranker):
return request.param(model="rerank-lite-1")


@pytest.fixture
def cohereReranker():
return CohereReranker()

@pytest.fixture
def hfCrossEncoderReranker():
return HFCrossEncoderReranker()
Expand Down Expand Up @@ -79,11 +83,10 @@ def test_bad_input_cohere(cohereReranker):
with pytest.raises(Exception):
cohereReranker.rank("valid query", "not a list") # Invalid type for documents

if isinstance(reranker, CohereReranker):
with pytest.raises(Exception):
reranker.rank(
"valid query", [{"field": "valid document"}], rank_by=["invalid_field"]
) # Invalid rank_by field
with pytest.raises(Exception):
reranker.rank(
"valid query", [{"field": "valid document"}], rank_by=["invalid_field"]
) # Invalid rank_by field


def test_rank_documents_cross_encoder(hfCrossEncoderReranker):
Expand Down

0 comments on commit d6f359c

Please sign in to comment.