Skip to content

Commit

Permalink
Update sparse+dense hybrid search example (#2005)
Browse files Browse the repository at this point in the history
use IP as the BGE-M3 dense embeddings relevance example

Signed-off-by: Buqian Zheng <[email protected]>
  • Loading branch information
zhengbuqian authored Apr 9, 2024
1 parent 722d2b5 commit d5de5ff
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/hello_hybrid_sparse_dense.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def random_embedding(texts):
# into memory for efficient search.
sparse_index = {"index_type": "SPARSE_INVERTED_INDEX", "metric_type": "IP"}
col.create_index("sparse_vector", sparse_index)
dense_index = {"index_type": "FLAT", "metric_type": "L2"}
dense_index = {"index_type": "FLAT", "metric_type": "IP"}
col.create_index("dense_vector", dense_index)
col.load()

Expand All @@ -102,7 +102,7 @@ def random_embedding(texts):
sparse_search_params = {"metric_type": "IP"}
sparse_req = AnnSearchRequest(query_embeddings["sparse"],
"sparse_vector", sparse_search_params, limit=k)
dense_search_params = {"metric_type": "L2"}
dense_search_params = {"metric_type": "IP"}
dense_req = AnnSearchRequest(query_embeddings["dense"],
"dense_vector", dense_search_params, limit=k)

Expand Down

0 comments on commit d5de5ff

Please sign in to comment.