refactor: Update data.py to use a copy of the data dictionary in the to_lc_message method

This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-06-20 18:00:33 -03:00
commit 7e92f74f28

View file

@ -106,8 +106,9 @@ class Data(BaseModel):
Returns:
Document: The converted Document.
"""
text = self.data.pop(self.text_key, self.default_value)
return Document(page_content=text, metadata=self.data)
data_copy = self.data.copy()
text = data_copy.pop(self.text_key, self.default_value)
return Document(page_content=text, metadata=data_copy)
def to_lc_message(
self,