From 4a1d7c2d645242721c81e689d46cf0a86582a507 Mon Sep 17 00:00:00 2001 From: sasha0552 Date: Thu, 17 Oct 2024 08:23:47 +0000 Subject: [PATCH] Fix exceptions when constructing an exception messages --- src/mistral_common/protocol/instruct/validator.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mistral_common/protocol/instruct/validator.py b/src/mistral_common/protocol/instruct/validator.py index 8f9a7cb..58d7acc 100644 --- a/src/mistral_common/protocol/instruct/validator.py +++ b/src/mistral_common/protocol/instruct/validator.py @@ -217,7 +217,7 @@ def _validate_message_order(self, messages: List[UATS]) -> None: if current_role not in expected_roles: raise InvalidMessageStructureException( - f"Unexpected role '{current_role.value}' after role '{previous_role.value}'" + f"Unexpected role '{current_role}' after role '{previous_role}'" ) previous_role = current_role @@ -228,7 +228,7 @@ def _validate_last_message(self, message: UATS) -> None: if self._mode == ValidationMode.finetuning: if last_message_role != Roles.assistant: raise InvalidMessageStructureException( - f"Expected last role Assistant for finetuning but got {last_message_role.value}" + f"Expected last role Assistant for finetuning but got {last_message_role}" ) else: bad_assistant = isinstance(message, AssistantMessage) and not message.prefix @@ -236,7 +236,7 @@ def _validate_last_message(self, message: UATS) -> None: if bad_assistant and bad_role: raise InvalidMessageStructureException( f"Expected last role User or Tool (or Assistant with prefix True) for serving" - f" but got {last_message_role.value}" + f" but got {last_message_role}" ) def _validate_message_list_structure(self, messages: List[UATS]) -> None: