Return stripped value from get_embeddable_data if its string

This commit is contained in:
Leon Luithlen 2024-11-14 09:43:56 +01:00
parent adc8a0b09c
commit e794bb8834

View file

@ -20,5 +20,8 @@ class DataPoint(BaseModel):
def get_embeddable_data(self):
if self._metadata and len(self._metadata["index_fields"]) > 0 \
and hasattr(self, self._metadata["index_fields"][0]):
return getattr(self, self._metadata["index_fields"][0])
attribute = getattr(self, self._metadata["index_fields"][0])
if isinstance(attribute, str):
return(attribute.strip())
else:
return (attribute)