Closed osafaimal closed 4 months ago
The MilvusVectorStore
fails to connect to the database when enable_sparse
is set to True
because hybrid retrieval, which involves sparse embeddings, is only supported in Milvus 2.4.0 or later. If your Milvus instance is older than version 2.4.0, the connection will fail [1].
Additionally, ensure that your network and firewall configurations allow traffic on the specified host and port, as the connection process involves extracting the host and port from the URI and connecting to the Milvus instance [1].
To resolve this issue, verify that your Milvus instance is version 2.4.0 or later and check your network and firewall settings.
To continue the conversation, mention @dosu.
in the docker-compose: image: milvusdb/milvus:v2.4.14.1
llama-index-vector-stores-milvus Version: 0.1.14 pymilvus Version: 2.4.3
@dosu
To resolve the issue with MilvusVectorStore
failing to connect to the database when enable_sparse
is set to True
, ensure that you provide the token
parameter correctly when initializing the MilvusVectorStore
. The error message "missing authorization in header" indicates that the token might not be properly included in the request.
Here is an example of how to properly initialize the MilvusVectorStore
with the token
parameter:
from llama_index.vector_stores.milvus import MilvusVectorStore
# Setup MilvusVectorStore with token for authorization
vector_store = MilvusVectorStore(
dim=1024,
collection_name="llamacollection_hybrid",
uri="http://localhost:19530",
token="root:Milvus", # Ensure you provide the token here
overwrite=True,
enable_sparse=True, # Enable sparse embeddings
sparse_embedding_function=your_sparse_embedding_function # Provide your sparse embedding function
)
Make sure to replace "your_sparse_embedding_function"
with the actual sparse embedding function you are using. This should resolve the "missing authorization in header" error [1][2].
To continue the conversation, mention @dosu.
The crux of the problem is that token
is not included when making the connection:
To my understanding, there should be no difference in the handling regardless of whether enable_sparse
is true or false. I'll try to submit a PR to fix this.
Bug Description
The MilvusVectorStore failed to connect when enable_sparse is True. when i set it to false it can connect.
Version
0.10.38
Steps to Reproduce
you have just to do:
Relevant Logs/Tracbacks