Update ingest.py
Browse files
ingest.py
CHANGED
@@ -11,9 +11,6 @@ logging.basicConfig(level=logging.INFO)
|
|
11 |
logger = logging.getLogger(__name__)
|
12 |
|
13 |
def create_faiss_index():
|
14 |
-
"""
|
15 |
-
Create a FAISS index from documents in the 'docs' directory.
|
16 |
-
"""
|
17 |
documents = []
|
18 |
docs_dir = "docs"
|
19 |
if not os.path.exists(docs_dir):
|
@@ -58,7 +55,8 @@ def create_faiss_index():
|
|
58 |
return
|
59 |
|
60 |
try:
|
61 |
-
faiss_index = FAISS.from_documents(texts, embeddings
|
|
|
62 |
logger.info(f"Created FAISS index with {len(texts)} vectors.")
|
63 |
except Exception as e:
|
64 |
logger.error(f"Failed to create FAISS index: {e}")
|
|
|
11 |
logger = logging.getLogger(__name__)
|
12 |
|
13 |
def create_faiss_index():
|
|
|
|
|
|
|
14 |
documents = []
|
15 |
docs_dir = "docs"
|
16 |
if not os.path.exists(docs_dir):
|
|
|
55 |
return
|
56 |
|
57 |
try:
|
58 |
+
faiss_index = FAISS.from_documents(texts, embeddings)
|
59 |
+
faiss_index.save_local("faiss_index")
|
60 |
logger.info(f"Created FAISS index with {len(texts)} vectors.")
|
61 |
except Exception as e:
|
62 |
logger.error(f"Failed to create FAISS index: {e}")
|