diff --git a/components/instructor-embedders/instructor_embedders/instructor_document_embedder.py b/components/instructor-embedders/instructor_embedders/instructor_document_embedder.py index 7fd369cd2..fc2d43b93 100644 --- a/components/instructor-embedders/instructor_embedders/instructor_document_embedder.py +++ b/components/instructor-embedders/instructor_embedders/instructor_document_embedder.py @@ -126,11 +126,7 @@ def run(self, documents: List[Document]): 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 - del doc_as_dict["id"] - documents_with_embeddings.append(Document.from_dict(doc_as_dict)) + doc.embedding = emb - return {"documents": documents_with_embeddings} + return {"documents": documents}