From cef567f1045396de35e614dd879b3e0203cbba2a Mon Sep 17 00:00:00 2001 From: Luca Foppiano Date: Wed, 29 Nov 2023 11:20:51 +0900 Subject: [PATCH] fix dimensionality error when switching from one model to the other and using the same document --- document_qa/document_qa_engine.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/document_qa/document_qa_engine.py b/document_qa/document_qa_engine.py index 91a2648..81c0e8b 100644 --- a/document_qa/document_qa_engine.py +++ b/document_qa/document_qa_engine.py @@ -259,8 +259,9 @@ def create_memory_embeddings(self, pdf_path, doc_id=None, chunk_size=500, perc_o metadatas=metadata, collection_name=hash) else: - 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']) + # 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].delete_collection() self.embeddings_dict[hash] = Chroma.from_texts(texts, embedding=self.embedding_function, metadatas=metadata,