Open jayant-yadav opened 23 hours ago
The issue you're experiencing with the MilvusVectorStore
class not updating the uri
parameter to a local Milvus path seems to be a bug. The uri
parameter should allow you to specify a different path, such as ./milvus_something.db
, but it appears to default back to ./milvus_llamaindex.db
instead.
The expected behavior is that the uri
parameter should be set to the specified path, allowing you to use a local Milvus Lite database file. This is crucial for ensuring that the vector store can be accessed consistently across different sessions.
To address this, you might want to check if there are any recent updates or patches for the MilvusVectorStore
class in the repository that could resolve this issue. If the problem persists, it may require a code change or a workaround until an official fix is provided.
To continue talking to Dosu, mention @dosu.
Looking at the latest source code, it's directly passing the uri to the milvus client https://github.com/run-llama/llama_index/blob/b452e003c2fc0684e650022a720bde193162e37b/llama-index-integrations/vector_stores/llama-index-vector-stores-milvus/llama_index/vector_stores/milvus/base.py#L273
Is there a motivation behind using self.client
at places and self._milvusclient
in other?
Although it should not matter, but just curious:
@property
def client(self) -> Any:
"""Get client."""
return self._milvusclient
https://github.com/run-llama/llama_index/blob/b452e003c2fc0684e650022a720bde193162e37b/llama-index-integrations/vector_stores/llama-index-vector-stores-milvus/llama_index/vector_stores/milvus/base.py#L273 https://github.com/run-llama/llama_index/blob/b452e003c2fc0684e650022a720bde193162e37b/llama-index-integrations/vector_stores/llama-index-vector-stores-milvus/llama_index/vector_stores/milvus/base.py#L283
I would also like to add that the bug that I encounter with a wrong uri
being returned, does not mean that the ./milvus_something.db
was not created. It was. But rather the vector_store
was pointing to a wong (./milvus_llamaindex.db
in this case) uri
instead.
If it creates the proper db, it's a pretty mild bug I guess?
Could be related to setting the field on the class directly as a string vs. A pydantic field object. Will take a look
Note that collection_name
, even though initialized the same way as uri
in the __init__
, can be overrided by the user input:
output of the test code:
stores_text=True is_embedding_query=True stores_node=True uri='./milvus_llamaindex.db' token='' collection_name='some_collection' dim=384 embedding_field='embedding' doc_id_field='doc_id' similarity_metric='IP' consistency_level='Session' overwrite=True text_key=None output_fields=[] index_config={} search_config={} collection_properties=None batch_size=100 enable_sparse=False sparse_embedding_field='sparse_embedding' sparse_embedding_function=None hybrid_ranker='RRFRanker' hybrid_ranker_params={} index_management=<IndexManagement.CREATE_IF_NOT_EXISTS: 'create_if_not_exists'> scalar_field_names=None scalar_field_types=None
Bug Description
MilvusVectorStore
takes inuri
parameter which when given as a local Milvus path (which works on MilvusLite), does not change its path and sticks to./milvus_llamaindex.db
as a default.Unable to change the
uri
has implication on other parts of the code when the vector store needs to be fetched again in a different session after all the docs have been inserted.Version
v0.12.1
Steps to Reproduce
Consider the following code from Milvus demo example, with the only change in LLM and embedding model used to be from HF instead of OpenAI.:
Relevant Logs/Tracbacks