From ed9ec0eb30383dab62e8e90141d5c1c3ca58625a Mon Sep 17 00:00:00 2001 From: LucasPenido Date: Thu, 17 Oct 2019 17:09:42 -0300 Subject: [PATCH 1/9] Allowing versions 5 or below of LUIS to be trained Co-authored-by: LucasLermen --- rasa/nlu/training_data/formats/luis.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/rasa/nlu/training_data/formats/luis.py b/rasa/nlu/training_data/formats/luis.py index a8d27e9f8eac..437e82859773 100644 --- a/rasa/nlu/training_data/formats/luis.py +++ b/rasa/nlu/training_data/formats/luis.py @@ -17,13 +17,14 @@ def read_from_json(self, js: Dict[Text, Any], **kwargs: Any) -> "TrainingData": training_examples = [] regex_features = [] - # Simple check to ensure we support this luis data schema version - if not js["luis_schema_version"].startswith("2"): + version = int(js["luis_schema_version"][0]) + + if version > 5: raise Exception( "Invalid luis data schema version {}, " - "should be 2.x.x. " - "Make sure to use the latest luis version " + "should be 2.x.x or 3.x.x." + "Make sure to use one of those versions" "(e.g. by downloading your data again)." "".format(js["luis_schema_version"]) ) From a5b7da7a2714105d68fea23103f63a2bb062b24d Mon Sep 17 00:00:00 2001 From: LucasLermen Date: Thu, 24 Oct 2019 17:31:29 -0300 Subject: [PATCH 2/9] Add warn message for Luis version incompatibility. Co-authored-by: Lucas Penido --- rasa/nlu/training_data/formats/luis.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rasa/nlu/training_data/formats/luis.py b/rasa/nlu/training_data/formats/luis.py index 437e82859773..906bc3856fc2 100644 --- a/rasa/nlu/training_data/formats/luis.py +++ b/rasa/nlu/training_data/formats/luis.py @@ -1,5 +1,6 @@ import logging import typing +import warnings from typing import Any, Dict, Text from rasa.nlu.training_data.formats.readerwriter import JsonTrainingDataReader @@ -21,11 +22,10 @@ def read_from_json(self, js: Dict[Text, Any], **kwargs: Any) -> "TrainingData": version = int(js["luis_schema_version"][0]) if version > 5: - raise Exception( - "Invalid luis data schema version {}, " - "should be 2.x.x or 3.x.x." - "Make sure to use one of those versions" - "(e.g. by downloading your data again)." + warnings.warn( + "Your luis data schema version {} " + "is higher than 5.x.x. " + "Traning may not be performed correctly. " "".format(js["luis_schema_version"]) ) From 4fd396bc8c727a5800e6883e676dda18fde3b1a4 Mon Sep 17 00:00:00 2001 From: LucasPenido Date: Tue, 29 Oct 2019 13:28:21 -0300 Subject: [PATCH 3/9] Validating LUIS schema structure Co-authored-by: LucasLermen --- rasa/nlu/training_data/formats/luis.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/rasa/nlu/training_data/formats/luis.py b/rasa/nlu/training_data/formats/luis.py index 906bc3856fc2..372e110b5273 100644 --- a/rasa/nlu/training_data/formats/luis.py +++ b/rasa/nlu/training_data/formats/luis.py @@ -18,9 +18,19 @@ def read_from_json(self, js: Dict[Text, Any], **kwargs: Any) -> "TrainingData": training_examples = [] regex_features = [] - # Simple check to ensure we support this luis data schema version - version = int(js["luis_schema_version"][0]) + # Simple check to ensure we support this luis data schema + if not ("regex_features" in js + and "utterances" in js + and "text" in js["utterances"][0] + and "intent" in js["utterances"][0] + and "entities" in js["utterances"][0]): + raise Exception( + "Invalid LUIS data schema structure." + "Your file is not supported." + ) + + version = int(js["luis_schema_version"][0]) if version > 5: warnings.warn( "Your luis data schema version {} " From d03920b073b3109d6898e87622759340349512e6 Mon Sep 17 00:00:00 2001 From: LucasPenido Date: Tue, 29 Oct 2019 16:26:34 -0300 Subject: [PATCH 4/9] Aplying black. Co-authored-by: LucasLermen --- rasa/nlu/training_data/formats/luis.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/rasa/nlu/training_data/formats/luis.py b/rasa/nlu/training_data/formats/luis.py index 372e110b5273..cd3d71f7bab7 100644 --- a/rasa/nlu/training_data/formats/luis.py +++ b/rasa/nlu/training_data/formats/luis.py @@ -20,14 +20,15 @@ def read_from_json(self, js: Dict[Text, Any], **kwargs: Any) -> "TrainingData": regex_features = [] # Simple check to ensure we support this luis data schema - if not ("regex_features" in js - and "utterances" in js - and "text" in js["utterances"][0] - and "intent" in js["utterances"][0] - and "entities" in js["utterances"][0]): + if not ( + "regex_features" in js + and "utterances" in js + and "text" in js["utterances"][0] + and "intent" in js["utterances"][0] + and "entities" in js["utterances"][0] + ): raise Exception( - "Invalid LUIS data schema structure." - "Your file is not supported." + "Invalid LUIS data schema structure." "Your file is not supported." ) version = int(js["luis_schema_version"][0]) From 7522b7654dc596a26722879af78d85b0779c833c Mon Sep 17 00:00:00 2001 From: LucasPenido Date: Mon, 4 Nov 2019 11:00:43 -0300 Subject: [PATCH 5/9] Changing warnings to logging to warn user. Co-authored-by: LucasLermen --- rasa/nlu/training_data/formats/luis.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rasa/nlu/training_data/formats/luis.py b/rasa/nlu/training_data/formats/luis.py index cd3d71f7bab7..8fa29ad90aa0 100644 --- a/rasa/nlu/training_data/formats/luis.py +++ b/rasa/nlu/training_data/formats/luis.py @@ -1,6 +1,5 @@ import logging import typing -import warnings from typing import Any, Dict, Text from rasa.nlu.training_data.formats.readerwriter import JsonTrainingDataReader @@ -33,7 +32,7 @@ def read_from_json(self, js: Dict[Text, Any], **kwargs: Any) -> "TrainingData": version = int(js["luis_schema_version"][0]) if version > 5: - warnings.warn( + logger.warning( "Your luis data schema version {} " "is higher than 5.x.x. " "Traning may not be performed correctly. " From 70e8d841720f5cc8af4cb88fa745a1e6f9a6c5f5 Mon Sep 17 00:00:00 2001 From: LucasPenido Date: Mon, 4 Nov 2019 11:03:55 -0300 Subject: [PATCH 6/9] Fixing magic number. Co-authored-by: LucasLermen --- rasa/nlu/training_data/formats/luis.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rasa/nlu/training_data/formats/luis.py b/rasa/nlu/training_data/formats/luis.py index 8fa29ad90aa0..c8f661a4e35e 100644 --- a/rasa/nlu/training_data/formats/luis.py +++ b/rasa/nlu/training_data/formats/luis.py @@ -30,8 +30,9 @@ def read_from_json(self, js: Dict[Text, Any], **kwargs: Any) -> "TrainingData": "Invalid LUIS data schema structure." "Your file is not supported." ) + luisSchemaVersionChecked = 4 version = int(js["luis_schema_version"][0]) - if version > 5: + if version > luisSchemaVersionChecked: logger.warning( "Your luis data schema version {} " "is higher than 5.x.x. " From f603fc4dbf7e29001bf86f17008648d871650a5c Mon Sep 17 00:00:00 2001 From: LucasLermen Date: Tue, 12 Nov 2019 16:59:56 -0300 Subject: [PATCH 7/9] Removing unused validations. Co-authored-by: Lucas Penido --- rasa/nlu/training_data/formats/luis.py | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/rasa/nlu/training_data/formats/luis.py b/rasa/nlu/training_data/formats/luis.py index c8f661a4e35e..b5c72690b8c8 100644 --- a/rasa/nlu/training_data/formats/luis.py +++ b/rasa/nlu/training_data/formats/luis.py @@ -18,24 +18,12 @@ def read_from_json(self, js: Dict[Text, Any], **kwargs: Any) -> "TrainingData": training_examples = [] regex_features = [] - # Simple check to ensure we support this luis data schema - if not ( - "regex_features" in js - and "utterances" in js - and "text" in js["utterances"][0] - and "intent" in js["utterances"][0] - and "entities" in js["utterances"][0] - ): - raise Exception( - "Invalid LUIS data schema structure." "Your file is not supported." - ) - luisSchemaVersionChecked = 4 - version = int(js["luis_schema_version"][0]) + version = int(js["luis_schema_version"].split(".")[0]) if version > luisSchemaVersionChecked: logger.warning( "Your luis data schema version {} " - "is higher than 5.x.x. " + "is higher than 4.x.x. " "Traning may not be performed correctly. " "".format(js["luis_schema_version"]) ) From 5dd15d50b93b99bcf59b1374ad70a5390cc6bcb6 Mon Sep 17 00:00:00 2001 From: LucasLermen Date: Tue, 12 Nov 2019 17:18:23 -0300 Subject: [PATCH 8/9] Add fix to changelog. Co-authored-by: Lucas Penido --- CHANGELOG.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 387417e563d3..c014a3216564 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -33,7 +33,8 @@ Fixed - Fixed server hanging forever on leaving ``rasa shell`` before first message - Fixed rasa init showing traceback error when user does Keyboard Interrupt before choosing a project path - ``CountVectorsFeaturizer`` featurizes intents only if its analyzer is set to ``word`` -- fixed bug where facebooks generic template was not rendered when buttons were None +- fixed bug where facebooks generic template was not rendered when buttons were None +- Training Luis data with ``luis_schema_version`` higher than 4.x.x will show a warning instead of throwing an exception [1.4.3] - 2019-10-29 From 51f8ce485857b8aa401efe76db3a661802e6787a Mon Sep 17 00:00:00 2001 From: Lucas Arthur Lermen Date: Tue, 26 Nov 2019 14:32:14 -0300 Subject: [PATCH 9/9] Update CHANGELOG.rst --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c4bcb25e8975..00eb853f2a3b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -18,6 +18,7 @@ Changed - Print info message when running Rasa X and a custom model server url was specified in ``endpoints.yml`` - If a ``wait_time_between_pulls`` is configured for the model server in ``endpoints.yml``, this will be used instead of the default one when running Rasa X +- Training Luis data with ``luis_schema_version`` higher than 4.x.x will show a warning instead of throwing an exception Removed ------- @@ -62,7 +63,6 @@ Fixed - Fixed rasa init showing traceback error when user does Keyboard Interrupt before choosing a project path - ``CountVectorsFeaturizer`` featurizes intents only if its analyzer is set to ``word`` - Fixed bug where facebooks generic template was not rendered when buttons were ``None`` -- Training Luis data with ``luis_schema_version`` higher than 4.x.x will show a warning instead of throwing an exception - Fixed default intents unnecessarily raising undefined parsing error [1.4.6] - 2019-11-22