Explorar el Código

feat: Show new chunk count when adding a dataset (#207)

cachho hace 2 años
padre
commit
13bac72e25
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  1. 3 1
      embedchain/embedchain.py

+ 3 - 1
embedchain/embedchain.py

@@ -102,12 +102,14 @@ class EmbedChain:
             ids = list(data_dict.keys())
             documents, metadatas = zip(*data_dict.values())
 
+        chunks_before_addition = self.count()
+
         self.collection.add(
             documents=documents,
             metadatas=list(metadatas),
             ids=ids
         )
-        print(f"Successfully saved {src}. Total chunks count: {self.collection.count()}")
+        print(f"Successfully saved {src}. New chunks count: {self.count() - chunks_before_addition}")
 
     def _format_result(self, results):
         return [