From 8fc0f8b49d2337ea6e2e7c17b365e839749285e3 Mon Sep 17 00:00:00 2001 From: codingjaguar Date: Thu, 21 Mar 2024 07:12:03 +0800 Subject: [PATCH] Add friendly setup instructions to hello_hybrid_sparse_dense.py Signed-off-by: codingjaguar --- examples/hello_hybrid_sparse_dense.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/examples/hello_hybrid_sparse_dense.py b/examples/hello_hybrid_sparse_dense.py index 3c30d03d1..98541c521 100644 --- a/examples/hello_hybrid_sparse_dense.py +++ b/examples/hello_hybrid_sparse_dense.py @@ -1,9 +1,18 @@ # A demo showing hybrid semantic search with dense and sparse vectors using Milvus. # You can optionally choose to use the BGE-M3 model to embed the text as dense -# and sparse vectors, or simply use random generated vectors as the example. - -# To use BGE-M3 model, you need to install the optional `model` module in pymilvus: +# and sparse vectors, or simply use random generated vectors as an example. +# Note that the sparse vector search feature is only available in Milvus 2.4.0 or +# higher version. Make sure you follow https://milvus.io/docs/install_standalone-docker.md +# to set up the latest version of Milvus in your local environment. + +# To connect to Milvus server, you need the python client library called pymilvus. +# To use BGE-M3 model, you need to install the optional `model` module in pymilvus. +# You can get them by simply running the following commands: +# pip install pymilvus # pip install pymilvus[model] + +# If true, use BGE-M3 model to generate dense and sparse vectors. +# If false, use random numbers to compose dense and sparse vectors. use_bge_m3 = True # The overall steps are as follows: @@ -112,4 +121,4 @@ def random_embedding(texts): # text: Artificial intelligence was founded as an academic discipline in 1956. distance 0.016129031777381897 # Drop the collection to clean up the data. -utility.drop_collection(col_name) \ No newline at end of file +utility.drop_collection(col_name)