lfoppiano commited on
Commit
9b528b7
1 Parent(s): 8c1f07c

fix another regression

Browse files
Files changed (1) hide show
  1. document_qa/document_qa_engine.py +3 -3
document_qa/document_qa_engine.py CHANGED
@@ -251,14 +251,14 @@ class DocumentQAEngine:
251
  else:
252
  hash = metadata[0]['hash']
253
 
254
- if hash not in self.embeddings_dict.keys() and (
255
- 'documents' in self.embeddings_dict[hash].get() and len(self.embeddings_dict[hash].get()['documents']) == 0):
256
  self.embeddings_dict[hash] = Chroma.from_texts(texts,
257
  embedding=self.embedding_function,
258
  metadatas=metadata,
259
  collection_name=hash)
260
  else:
261
- self.embeddings_dict[hash].delete(ids=self.embeddings_dict[hash].get()['ids'])
 
262
  self.embeddings_dict[hash] = Chroma.from_texts(texts,
263
  embedding=self.embedding_function,
264
  metadatas=metadata,
 
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,
258
  collection_name=hash)
259
  else:
260
+ if 'documents' in self.embeddings_dict[hash].get() and len(self.embeddings_dict[hash].get()['documents']) == 0:
261
+ self.embeddings_dict[hash].delete(ids=self.embeddings_dict[hash].get()['ids'])
262
  self.embeddings_dict[hash] = Chroma.from_texts(texts,
263
  embedding=self.embedding_function,
264
  metadatas=metadata,