diff --git a/document_qa/document_qa_engine.py b/document_qa/document_qa_engine.py index ac9eba2..2c6cf70 100644 --- a/document_qa/document_qa_engine.py +++ b/document_qa/document_qa_engine.py @@ -251,7 +251,8 @@ 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(): + if hash not in self.embeddings_dict.keys() and ( + 'documents' in self.embeddings_dict.get() and len(self.embeddings_dict.get()['documents']) == 0): self.embeddings_dict[hash] = Chroma.from_texts(texts, embedding=self.embedding_function, metadatas=metadata,