Update ingest.py
Browse files
ingest.py
CHANGED
|
@@ -42,9 +42,10 @@ def process_file(subdomain, file_path, model):
|
|
| 42 |
os.makedirs(persist_directory, exist_ok=True)
|
| 43 |
print(f"📁 Dossier vectoriel: {persist_directory}")
|
| 44 |
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
)
|
|
|
|
| 48 |
|
| 49 |
collection_name = f"{DOMAIN}_{subdomain}"
|
| 50 |
|
|
@@ -52,8 +53,8 @@ def process_file(subdomain, file_path, model):
|
|
| 52 |
try:
|
| 53 |
client.delete_collection(name=collection_name)
|
| 54 |
print("🗑️ Collection existante supprimée.")
|
| 55 |
-
except Exception:
|
| 56 |
-
|
| 57 |
|
| 58 |
collection = client.create_collection(name=collection_name)
|
| 59 |
|
|
@@ -86,4 +87,4 @@ def main():
|
|
| 86 |
print("\n🏁 Ingestion terminée pour tous les fichiers.")
|
| 87 |
|
| 88 |
if __name__ == "__main__":
|
| 89 |
-
main()
|
|
|
|
| 42 |
os.makedirs(persist_directory, exist_ok=True)
|
| 43 |
print(f"📁 Dossier vectoriel: {persist_directory}")
|
| 44 |
|
| 45 |
+
print(f"📌 persist_directory transmis à ChromaDB : {persist_directory}")
|
| 46 |
+
settings = Settings(persist_directory=persist_directory)
|
| 47 |
+
#client = chromadb.PersistentClient(settings=settings)
|
| 48 |
+
client = chromadb.PersistentClient(path=persist_directory)
|
| 49 |
|
| 50 |
collection_name = f"{DOMAIN}_{subdomain}"
|
| 51 |
|
|
|
|
| 53 |
try:
|
| 54 |
client.delete_collection(name=collection_name)
|
| 55 |
print("🗑️ Collection existante supprimée.")
|
| 56 |
+
except Exception as e:
|
| 57 |
+
print(f"ℹ️ Pas de collection précédente à supprimer ou autre info : {e}")
|
| 58 |
|
| 59 |
collection = client.create_collection(name=collection_name)
|
| 60 |
|
|
|
|
| 87 |
print("\n🏁 Ingestion terminée pour tous les fichiers.")
|
| 88 |
|
| 89 |
if __name__ == "__main__":
|
| 90 |
+
main()
|