From 64db2393f7ed808810f0a34cf953e02f8a872531 Mon Sep 17 00:00:00 2001 From: ayush chaurasia Date: Thu, 22 Feb 2024 16:28:17 +0530 Subject: [PATCH] update --- python/tests/test_rerankers.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/python/tests/test_rerankers.py b/python/tests/test_rerankers.py index 28f422a6..aabba994 100644 --- a/python/tests/test_rerankers.py +++ b/python/tests/test_rerankers.py @@ -102,7 +102,7 @@ def test_linear_combination(tmp_path): query = "Our father who art in heaven" query_vector = table.to_pandas()["vector"][0] result = ( - table.search(vector=query_vector, text=query, query_type="vector") + table.search(vector=query_vector, text=query, query_type="hybrid") .limit(30) .rerank(normalize="score") .to_arrow() @@ -116,6 +116,7 @@ def test_linear_combination(tmp_path): "be descending." ) + # automatically deduce the query type result = ( table.search(vector=query_vector, text=query) .limit(30) @@ -123,6 +124,12 @@ def test_linear_combination(tmp_path): .to_arrow() ) + # wrong query type raises an error + with pytest.raises(ValueError): + table.search(vector=query_vector, text=query, query_type="vector").rerank( + normalize="score" + ) + @pytest.mark.skipif( os.environ.get("COHERE_API_KEY") is None, reason="COHERE_API_KEY not set"