Преглед изворни кода

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

cachho пре 2 година
родитељ
комит
13bac72e25
1 измењених фајлова са 3 додато и 1 уклоњено
  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 [