Spaces:
Running
Running
fix another regression
Browse files(cherry picked from commit 9b528b77741b898b52560d2564fff0d1d6fada1c)
document_qa/document_qa_engine.py
CHANGED
@@ -253,14 +253,14 @@ class DocumentQAEngine:
|
|
253 |
else:
|
254 |
hash = metadata[0]['hash']
|
255 |
|
256 |
-
if hash not in self.embeddings_dict.keys()
|
257 |
-
'documents' in self.embeddings_dict[hash].get() and len(self.embeddings_dict[hash].get()['documents']) == 0):
|
258 |
self.embeddings_dict[hash] = Chroma.from_texts(texts,
|
259 |
embedding=self.embedding_function,
|
260 |
metadatas=metadata,
|
261 |
collection_name=hash)
|
262 |
else:
|
263 |
-
self.embeddings_dict[hash].
|
|
|
264 |
self.embeddings_dict[hash] = Chroma.from_texts(texts,
|
265 |
embedding=self.embedding_function,
|
266 |
metadatas=metadata,
|
|
|
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,
|
260 |
collection_name=hash)
|
261 |
else:
|
262 |
+
if 'documents' in self.embeddings_dict[hash].get() and len(self.embeddings_dict[hash].get()['documents']) == 0:
|
263 |
+
self.embeddings_dict[hash].delete(ids=self.embeddings_dict[hash].get()['ids'])
|
264 |
self.embeddings_dict[hash] = Chroma.from_texts(texts,
|
265 |
embedding=self.embedding_function,
|
266 |
metadatas=metadata,
|