d = 1024
faiss_index = faiss.IndexFlatL2(d)
nodes = []
vector_store = FaissVectorStore(faiss_index=faiss_index)
storage_context = StorageContext.from_defaults(vector_store=vector_store)
for index, row in data.iterrows():
text_embedding = json.loads(row["list_embedding"])
text = row["text"]
node = TextNode(text=text, metadata={"id":row["id"]}, embedding=text_embedding)
nodes.append(node)
vector_index = VectorStoreIndex(nodes=nodes, storage_context=storage_context)
# save index to disk
vector_index.storage_context.persist(persist_dir="./vector_store__faiss_index_50000")
# load index from disk
vector_store = FaissVectorStore.from_persist_dir("./vector_store__faiss_index_50000")
storage_context = StorageContext.from_defaults(
vector_store=vector_store, persist_dir="./vector_store__faiss_index_50000"
)
newwindex = load_index_from_storage(storage_context=storage_context)
query_engine = newwindex.as_query_engine()
response = query_engine.query("Can you show me all the products related to bikes?")
**AssertionError: **