Find answers from the community

Updated 6 months ago

Hello, I am integrating Milvus Database

At a glance

The community member is integrating Milvus Database with Zillz cloud for storing collections. They are trying to create an index from the persisted database, but their current approach involves reading documents from a directory, which is not the correct approach. A community member suggests that the correct way to create the index is to use VectorStoreIndex.from_vector_store() instead of VectorStoreIndex.from_documents(). The community member also asks how to determine the type of embeddings (sparse or dense) used for querying and how to change it, but this question is not explicitly answered.

Hello, I am integrating Milvus Database. with using zillz cloud for storing collections. How can I create index from persisted database. My current approach is

Plain Text
milvus_uri = "Public End Point for Project"
access_token = "Access Token for Database"
vector_store = MilvusVectorStore(uri = milvus_uri, 
                                 token = access_token , 
                                 overwrite=False ,
                                 enable_sparse= True ,
                                 sparse_embedding_function=EmbeddingFunction(),
                                 collection_name = "llama" ,
                                 hybrid_ranker="RRFRanker", 
                                 hybrid_ranker_params={"k": 60} )

storage_context = StorageContext.from_defaults(vector_store=vector_store)


documents = SimpleDirectoryReader("more_data").load_data()

index = VectorStoreIndex.from_documents(
    documents , storage_context=storage_context , embed_model = embed_model
)


As you can see I am reading documents for creating index. which should not be the case If I have data on milvus cloud. index should be built directly from persisted database.

Also How to know which type embeddings are used to query. (Sparse Embeddings OR Dense ) And how can change it? In picture attached you can see the data is been persisted on milvus cloud.
Attachment
Screenshot_2024-08-20_193447.png
W
H
Y
3 comments
The way you are connecting and creating index is the root cause here.

if you want to just connect, try doing it this way:
Plain Text
index = VectorStoreIndex.from_vector_store(
    vector_store=vector_store , storage_context=storage_context , embed_model = embed_model
)
thankyou so much It worked. Do you have idea about my other question?
@HardikCurious from where are you using "EmbeddingFunction()"?
Add a reply
Sign up and join the conversation on Discord