Skip to content

Commit

Permalink
Improved reranking test
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Aug 30, 2024
1 parent 2a1837e commit 9789d33
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test/pipeline_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,15 @@ def test_embedding
end

def test_reranking
ranker = Informers.pipeline("reranking")
result = ranker.("Who created Ruby?", ["Matz created Ruby", "Another doc"])
query = "How many people live in London?"
docs = ["Around 9 Million people live in London", "London is known for its financial district"]
rerank = Informers.pipeline("reranking")
result = rerank.(query, docs)
assert_equal 2, result.size
assert_equal 0, result[0][:doc_id]
assert_in_delta 0.984, result[0][:score]
assert_equal 1, result[1][:doc_id]
assert_in_delta 0.139, result[1][:score]
end

def test_progress_callback
Expand Down

0 comments on commit 9789d33

Please sign in to comment.