Spaces:
Running
Running
fix condition to establish when we need to cleanup the storage
Browse files
document_qa/document_qa_engine.py
CHANGED
@@ -251,7 +251,8 @@ class DocumentQAEngine:
|
|
251 |
else:
|
252 |
hash = metadata[0]['hash']
|
253 |
|
254 |
-
if hash not in self.embeddings_dict.keys()
|
|
|
255 |
self.embeddings_dict[hash] = Chroma.from_texts(texts,
|
256 |
embedding=self.embedding_function,
|
257 |
metadatas=metadata,
|
|
|
251 |
else:
|
252 |
hash = metadata[0]['hash']
|
253 |
|
254 |
+
if hash not in self.embeddings_dict.keys() and (
|
255 |
+
'documents' in self.embeddings_dict.get() and len(self.embeddings_dict.get()['documents']) == 0):
|
256 |
self.embeddings_dict[hash] = Chroma.from_texts(texts,
|
257 |
embedding=self.embedding_function,
|
258 |
metadatas=metadata,
|