Update ingest.py
Browse files
ingest.py
CHANGED
@@ -59,7 +59,8 @@ def create_faiss_index():
|
|
59 |
try:
|
60 |
faiss_index = faiss.IndexFlatL2(dimension)
|
61 |
faiss_index.add(embedding_vectors)
|
62 |
-
|
|
|
63 |
logger.info(f"Created FAISS index with {len(texts)} vectors.")
|
64 |
except Exception as e:
|
65 |
logger.error(f"Failed to create FAISS index: {e}")
|
|
|
59 |
try:
|
60 |
faiss_index = faiss.IndexFlatL2(dimension)
|
61 |
faiss_index.add(embedding_vectors)
|
62 |
+
os.makedirs("faiss_index", exist_ok=True) # Create directory if it doesn't exist
|
63 |
+
faiss.write_index(faiss_index, "faiss_index/index.faiss")
|
64 |
logger.info(f"Created FAISS index with {len(texts)} vectors.")
|
65 |
except Exception as e:
|
66 |
logger.error(f"Failed to create FAISS index: {e}")
|