Spaces:
Runtime error
Runtime error
Update agent.py
Browse files
agent.py
CHANGED
@@ -353,7 +353,7 @@ class MyVectorStore:
|
|
353 |
|
354 |
def save_local(self, path: str):
|
355 |
# Save the FAISS index to the specified file
|
356 |
-
faiss.write_index(self.index,
|
357 |
print(f"Index saved to {path}")
|
358 |
|
359 |
@classmethod
|
@@ -397,10 +397,17 @@ vector_store = FAISS.from_documents(docs, embedding_model)
|
|
397 |
|
398 |
# Save the FAISS index
|
399 |
vector_store = MyVectorStore(index)
|
400 |
-
vector_store.save_local("/home/wt/Downloads/faiss_index.index")
|
401 |
|
402 |
-
#
|
403 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
404 |
|
405 |
|
406 |
|
|
|
353 |
|
354 |
def save_local(self, path: str):
|
355 |
# Save the FAISS index to the specified file
|
356 |
+
faiss.write_index(self.index, path)
|
357 |
print(f"Index saved to {path}")
|
358 |
|
359 |
@classmethod
|
|
|
397 |
|
398 |
# Save the FAISS index
|
399 |
vector_store = MyVectorStore(index)
|
|
|
400 |
|
401 |
+
# Assuming you already have a FAISS index
|
402 |
+
index = faiss.IndexFlatL2(768) # Or whatever dimensionality your embeddings have
|
403 |
+
vector_store = MyVectorStore(index)
|
404 |
+
|
405 |
+
# Save
|
406 |
+
vector_store.save_local("/home/wendy/Downloads/faiss_index.index")
|
407 |
+
|
408 |
+
# Load
|
409 |
+
loaded_store = MyVectorStore.load_local("/home/wendy/Downloads/faiss_index.index")
|
410 |
+
|
411 |
|
412 |
|
413 |
|