Update ingest.py
Browse files
ingest.py
CHANGED
@@ -10,9 +10,11 @@ logging.basicConfig(level=logging.INFO)
|
|
10 |
logger = logging.getLogger(__name__)
|
11 |
|
12 |
def create_vector_store():
|
|
|
13 |
persist_directory = "./chroma_db"
|
14 |
-
os.
|
15 |
-
|
|
|
16 |
|
17 |
documents = []
|
18 |
docs_dir = "docs"
|
@@ -64,11 +66,5 @@ def create_vector_store():
|
|
64 |
except Exception as e:
|
65 |
logger.error(f"Failed to create Chroma vector store: {e}")
|
66 |
|
67 |
-
# Verify creation of chroma_db directory
|
68 |
-
if os.path.exists(persist_directory):
|
69 |
-
logger.info(f"Verified that '{persist_directory}' exists.")
|
70 |
-
else:
|
71 |
-
logger.error(f"'{persist_directory}' was not created. Please check for errors.")
|
72 |
-
|
73 |
if __name__ == "__main__":
|
74 |
create_vector_store()
|
|
|
10 |
logger = logging.getLogger(__name__)
|
11 |
|
12 |
def create_vector_store():
|
13 |
+
# Ensure the directory exists
|
14 |
persist_directory = "./chroma_db"
|
15 |
+
if not os.path.exists(persist_directory):
|
16 |
+
os.makedirs(persist_directory)
|
17 |
+
logger.info(f"Created directory '{persist_directory}'")
|
18 |
|
19 |
documents = []
|
20 |
docs_dir = "docs"
|
|
|
66 |
except Exception as e:
|
67 |
logger.error(f"Failed to create Chroma vector store: {e}")
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
if __name__ == "__main__":
|
70 |
create_vector_store()
|