Find answers from the community

Updated 5 months ago

Hi Team, i am using lancedb, i have

At a glance

The community member is using LanceDB and has created an index, but is encountering an error when trying to query the vector index using embeddings instead of strings. The code they provided is throwing an AttributeError: 'LanceDBVectorStore' object has no attribute 'vector_store' error on the line where they create the VectorIndexRetriever object.

Other community members have commented that the issue seems to be related to how self.db is being set, as it appears to be a VectorStoreIndex object rather than a LanceDBVectorStore object. However, there is no clear answer provided in the comments.

Hi Team, i am using lancedb, i have created a index and i want to query the vectorindex of lancedb using embedding not string, so i am using the following code, help me in resolving the error code ; ->? db = lancedb.connect(lancedb_path)


vector_store = LanceDBVectorStore(
uri=lancedb_path, table_name = self.index_name, query_type="vector",connection = db,embeddong=self.embeddings)

storage_context = StorageContext.from_defaults(vector_store=vector_store)

self.db = VectorStoreIndex.from_documents(
self.documents, storage_context=storage_context,vector_store=vector_store
)
retriever = VectorIndexRetriever(index=self.db, similarity_top_k=3)

# create QueryBundle for your query and add embeddings
embed_query = QueryBundle(query_str="unused", embedding = query)

# pass this object in your retriever to get nodes
return retriever.retrieve(embed_query) ERROR --->> AttributeError: 'LanceDBVectorStore' object has no attribute 'vector_store' and this line is where it throwing an error retriever = VectorIndexRetriever(index=self.db, similarity_top_k=3)
L
M
3 comments
mmmm somehow this looks like self.db is being set to the vector store object?

If you code is exactly as you pasted though, this doesn't seem possible lol
@Logan M yes this looks very strange, this is the output of type(self.db) <class 'llama_index.core.indices.vector_store.base.VectorStoreIndex'>
Yea that's correct πŸ€”
Add a reply
Sign up and join the conversation on Discord