Skip to content

Commit

Permalink
fix another regression
Browse files Browse the repository at this point in the history
  • Loading branch information
lfoppiano committed Nov 29, 2023
1 parent 8c1f07c commit 9b528b7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions document_qa/document_qa_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,14 +251,14 @@ def create_memory_embeddings(self, pdf_path, doc_id=None, chunk_size=500, perc_o
else:
hash = metadata[0]['hash']

if hash not in self.embeddings_dict.keys() and (
'documents' in self.embeddings_dict[hash].get() and len(self.embeddings_dict[hash].get()['documents']) == 0):
if hash not in self.embeddings_dict.keys():
self.embeddings_dict[hash] = Chroma.from_texts(texts,
embedding=self.embedding_function,
metadatas=metadata,
collection_name=hash)
else:
self.embeddings_dict[hash].delete(ids=self.embeddings_dict[hash].get()['ids'])
if 'documents' in self.embeddings_dict[hash].get() and len(self.embeddings_dict[hash].get()['documents']) == 0:
self.embeddings_dict[hash].delete(ids=self.embeddings_dict[hash].get()['ids'])
self.embeddings_dict[hash] = Chroma.from_texts(texts,
embedding=self.embedding_function,
metadatas=metadata,
Expand Down

0 comments on commit 9b528b7

Please sign in to comment.