unstructured
40523061 - fix: _add_embeddings_to_elements bug resulting in duplicated elements (#1719)

Commit
2 years ago
fix: _add_embeddings_to_elements bug resulting in duplicated elements (#1719) Currently when the OpenAIEmbeddingEncoder adds embeddings to Elements in `_add_embeddings_to_elements` it overwrites each Element's `to_dict` method, mistakenly resulting in each Element having identical values with the exception of the actual embedding value. This was due to the way it leverages a nested `new_to_dict` method to overwrite. Instead, this updates the original definition of Element itself to accommodate the `embeddings` field when available. This also adds a test to validate that values are not duplicated.
Parents
Loading