Hello Folks! Happy New Year!
Just one Query!
I have embeddings and text stored in local machine. I want to create VectorStoreIndex out of it.
But its not working. Here is the code. Can anyone pls look into it?
dim = 1536
doc1_index = faiss.IndexFlatL2(dim)
doc1_documents = []
for i, doc in enumerate(response):
source = doc["_source"]
doc1_index.add(np.asarray([source["content_vector"]]))
doc1_documents.append(Document(text=source["content"]))
doc1_vector_store = FaissVectorStore(faiss_index=doc1_index)
storage_context = StorageContext.from_defaults(vector_store=doc1_vector_store)
doc1_llama_index = VectorStoreIndex.from_vector_store(doc1_documents, storage_context=storage_context)
##### Output
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[28], line 3
1 doc1_vector_store = FaissVectorStore(faiss_index=doc1_index)
2 storage_context = StorageContext.from_defaults(vector_store=doc1_vector_store)
----> 3 doc1_llama_index = VectorStoreIndex.from_vector_store(doc1_documents, storage_context=storage_context)
File c:\Users\61097809\loganalytics\graph_venv\Lib\site-packages\llama_index\core\indices\vector_store\base.py:94, in VectorStoreIndex.from_vector_store(cls, vector_store, embed_model, **kwargs)
87 @classmethod
88 def from_vector_store(
89 cls,
(...)
92 **kwargs: Any,
93 ) -> "VectorStoreIndex":
---> 94 if not vector_store.stores_text:
95 raise ValueError(
96 "Cannot initialize from a vector store that does not store text."
97 )
99 kwargs.pop("storage_context", None)
AttributeError: 'list' object has no attribute 'stores_text'
Thanks !