mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-12-25 14:08:27 +00:00
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:
parent
ae812617fd
commit
9d8979af41
@ -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}
|
||||
|
||||
@ -0,0 +1,4 @@
|
||||
---
|
||||
preview:
|
||||
- |
|
||||
Refactor SentenceTransformersDocumentEmbedder to enrich documents with embeddings instead of recreating them.
|
||||
Loading…
x
Reference in New Issue
Block a user