Skip to content

Commit

Permalink
fix dimensionality error when switching from one model to the other a…
Browse files Browse the repository at this point in the history
…nd using the same document
  • Loading branch information
lfoppiano committed Nov 29, 2023
1 parent 6c39cdf commit cef567f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions document_qa/document_qa_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit cef567f

Please sign in to comment.