From b4ac30fc1ffad094c51a6da15eb27b3efc0bce36 Mon Sep 17 00:00:00 2001 From: saileshwar-skyflow Date: Tue, 3 Dec 2024 01:16:03 +0530 Subject: [PATCH] SK-1731: Updated tokenize validations --- skyflow/utils/_skyflow_messages.py | 12 ++++++------ skyflow/utils/validations/_validations.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/skyflow/utils/_skyflow_messages.py b/skyflow/utils/_skyflow_messages.py index b12401f..c757fa4 100644 --- a/skyflow/utils/_skyflow_messages.py +++ b/skyflow/utils/_skyflow_messages.py @@ -120,12 +120,12 @@ class Error(Enum): INVALID_TOKENS_LIST_VALUE = f"{error_prefix} Validation error. The 'tokens' key has a value of type {{}}. Specify 'tokens' as a list." EMPTY_TOKENS_LIST_VALUE = f"{error_prefix} Validation error. Tokens are empty in detokenize payload. Specify at lease one token" - INVALID_TOKENIZE_PARAMETERS = f"{error_prefix} Validation error. The 'tokenize_parameters' key has a value of type {{}}. Specify 'tokenize_parameters' as a list." - EMPTY_TOKENIZE_PARAMETERS = f"{error_prefix} Validation error. Tokenize parameters are empty in tokenize payload. Specify at least one parameter." - INVALID_TOKENIZE_PARAMETER = f"{error_prefix} Validation error. Tokenize parameter at index {{}} has a value of type {{}}. Specify as a dictionary." - EMPTY_TOKENIZE_PARAMETER_VALUE = f"{error_prefix} Validation error. Tokenize parameter value at index {{}} is empty. Specify a valid value." - EMPTY_TOKENIZE_PARAMETER_COLUMN_GROUP = f"{error_prefix} Validation error. Tokenize parameter column group at index {{}} is empty. Specify a valid column group." - INVALID_TOKENIZE_PARAMETER_KEY = f"{error_prefix} Validation error. Tokenize parameter key at index {{}} is invalid. Specify a valid key value." + INVALID_TOKENIZE_PARAMETERS = f"{error_prefix} Validation error. The 'values' key has a value of type {{}}. Specify 'tokenize_parameters' as a list." + EMPTY_TOKENIZE_PARAMETERS = f"{error_prefix} Validation error. Tokenize values are empty in tokenize payload. Specify at least one parameter." + INVALID_TOKENIZE_PARAMETER = f"{error_prefix} Validation error. Tokenize value at index {{}} has a value of type {{}}. Specify as a dictionary." + EMPTY_TOKENIZE_PARAMETER_VALUE = f"{error_prefix} Validation error. Tokenize value at index {{}} is empty. Specify a valid value." + EMPTY_TOKENIZE_PARAMETER_COLUMN_GROUP = f"{error_prefix} Validation error. Tokenize column group at index {{}} is empty. Specify a valid column group." + INVALID_TOKENIZE_PARAMETER_KEY = f"{error_prefix} Validation error. Tokenize value key at index {{}} is invalid. Specify a valid key value." INVALID_REQUEST_BODY = f"{error_prefix} Validation error. Invalid request body. Specify the request body as an object." INVALID_REQUEST_HEADERS = f"{error_prefix} Validation error. Invalid request headers. Specify the request as an object." diff --git a/skyflow/utils/validations/_validations.py b/skyflow/utils/validations/_validations.py index 3e5c182..ee569f2 100644 --- a/skyflow/utils/validations/_validations.py +++ b/skyflow/utils/validations/_validations.py @@ -515,7 +515,7 @@ def validate_detokenize_request(logger, request): raise SkyflowError(SkyflowMessages.Error.INVALID_TOKENS_LIST_VALUE.value(type(request.tokens)), invalid_input_error_code) def validate_tokenize_request(logger, request): - parameters = request.tokenize_parameters + parameters = request.values if not isinstance(parameters, list): raise SkyflowError(SkyflowMessages.Error.INVALID_TOKENIZE_PARAMETERS.value.format(type(parameters)), invalid_input_error_code)