feat: Refactor SentenceTransformersDocumentEmbedder.py (#6143)

* changed sentense_transformers

* added release note

* updated release notes

* Corrected release notes

---------

Co-authored-by: Stefano Fiorucci <44616784+anakin87@users.noreply.github.com>
This commit is contained in:
Shaurya Agrawal 2023-10-23 17:32:35 +05:30 committed by GitHub
parent ae812617fd
commit 9d8979af41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -125,10 +125,7 @@ class SentenceTransformersDocumentEmbedder:
normalize_embeddings=self.normalize_embeddings,
)
documents_with_embeddings = []
for doc, emb in zip(documents, embeddings):
doc_as_dict = doc.to_dict()
doc_as_dict["embedding"] = emb
documents_with_embeddings.append(Document.from_dict(doc_as_dict))
doc.embedding = emb
return {"documents": documents_with_embeddings}
return {"documents": documents}

View File

@ -0,0 +1,4 @@
---
preview:
- |
Refactor SentenceTransformersDocumentEmbedder to enrich documents with embeddings instead of recreating them.