Spaces:
Running
Running
fix dimensionality error when switching from one model to the other and using the same document
Browse files
document_qa/document_qa_engine.py
CHANGED
|
@@ -259,8 +259,9 @@ class DocumentQAEngine:
|
|
| 259 |
metadatas=metadata,
|
| 260 |
collection_name=hash)
|
| 261 |
else:
|
| 262 |
-
if 'documents' in self.embeddings_dict[hash].get() and len(self.embeddings_dict[hash].get()['documents']) == 0:
|
| 263 |
-
|
|
|
|
| 264 |
self.embeddings_dict[hash] = Chroma.from_texts(texts,
|
| 265 |
embedding=self.embedding_function,
|
| 266 |
metadatas=metadata,
|
|
|
|
| 259 |
metadatas=metadata,
|
| 260 |
collection_name=hash)
|
| 261 |
else:
|
| 262 |
+
# if 'documents' in self.embeddings_dict[hash].get() and len(self.embeddings_dict[hash].get()['documents']) == 0:
|
| 263 |
+
# self.embeddings_dict[hash].delete(ids=self.embeddings_dict[hash].get()['ids'])
|
| 264 |
+
self.embeddings_dict[hash].delete_collection()
|
| 265 |
self.embeddings_dict[hash] = Chroma.from_texts(texts,
|
| 266 |
embedding=self.embedding_function,
|
| 267 |
metadatas=metadata,
|