lfoppiano commited on
Commit
cbf04c6
·
1 Parent(s): 4152778

fix condition to establish when we need to cleanup the storage

Browse files
Files changed (1) hide show
  1. document_qa/document_qa_engine.py +2 -1
document_qa/document_qa_engine.py CHANGED
@@ -253,7 +253,8 @@ class DocumentQAEngine:
253
  else:
254
  hash = metadata[0]['hash']
255
 
256
- if hash not in self.embeddings_dict.keys():
 
257
  self.embeddings_dict[hash] = Chroma.from_texts(texts,
258
  embedding=self.embedding_function,
259
  metadatas=metadata,
 
253
  else:
254
  hash = metadata[0]['hash']
255
 
256
+ if hash not in self.embeddings_dict.keys() and (
257
+ 'documents' in self.embeddings_dict.get() and len(self.embeddings_dict.get()['documents']) == 0):
258
  self.embeddings_dict[hash] = Chroma.from_texts(texts,
259
  embedding=self.embedding_function,
260
  metadatas=metadata,