This commit is contained in:
ayush chaurasia
2024-02-22 16:28:17 +05:30
parent bd4e8341fe
commit 64db2393f7

View File

@@ -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"