diff --git a/argilla/src/argilla/responses.py b/argilla/src/argilla/responses.py index d27c1c0f5b..92dce51285 100644 --- a/argilla/src/argilla/responses.py +++ b/argilla/src/argilla/responses.py @@ -19,6 +19,7 @@ from argilla._models import UserResponseModel, ResponseStatus as ResponseStatusModel from argilla._resource import Resource from argilla.settings import RankingQuestion +from argilla.users import DELETED_USER if TYPE_CHECKING: from argilla import Argilla, Dataset, Record @@ -143,7 +144,7 @@ def status(self, status: ResponseStatus) -> None: self._model.status = status @property - def user_id(self) -> UUID: + def user_id(self) -> Optional[UUID]: """Returns the user_id of the UserResponse""" return self._model.user_id @@ -160,6 +161,10 @@ def answers(self) -> List[Response]: @classmethod def from_model(cls, model: UserResponseModel, dataset: "Dataset") -> "UserResponse": """Creates a UserResponse from a ResponseModel""" + + if model.user_id is None: + model.user_id = DELETED_USER.id + answers = cls.__model_as_response_list(model) for answer in answers: question = dataset.settings.question_by_name(answer.question_name)