diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/luis_runtime_client.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/luis_runtime_client.py index d4448bbe781b..1949b5de857e 100644 --- a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/luis_runtime_client.py +++ b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/luis_runtime_client.py @@ -36,7 +36,7 @@ def __init__( raise ValueError("Parameter 'endpoint' must not be None.") if credentials is None: raise ValueError("Parameter 'credentials' must not be None.") - base_url = '{Endpoint}/luis/v2.0' + base_url = '{Endpoint}/luis/v3.0-preview' super(LUISRuntimeClientConfiguration, self).__init__(base_url) @@ -70,7 +70,7 @@ def __init__( super(LUISRuntimeClient, self).__init__(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2.0' + self.api_version = '3.0-preview' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/__init__.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/__init__.py index a17c1378159c..93a0df2ea405 100644 --- a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/__init__.py +++ b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/__init__.py @@ -10,34 +10,40 @@ # -------------------------------------------------------------------------- try: - from .intent_model_py3 import IntentModel - from .entity_model_py3 import EntityModel - from .composite_child_model_py3 import CompositeChildModel - from .composite_entity_model_py3 import CompositeEntityModel + from .prediction_request_options_py3 import PredictionRequestOptions + from .external_entity_py3 import ExternalEntity + from .request_list_py3 import RequestList + from .dynamic_list_py3 import DynamicList + from .prediction_request_py3 import PredictionRequest + from .intent_py3 import Intent from .sentiment_py3 import Sentiment - from .luis_result_py3 import LuisResult - from .entity_with_score_py3 import EntityWithScore - from .entity_with_resolution_py3 import EntityWithResolution - from .api_error_py3 import APIError, APIErrorException + from .prediction_py3 import Prediction + from .prediction_response_py3 import PredictionResponse + from .error_body_py3 import ErrorBody + from .error_py3 import Error, ErrorException except (SyntaxError, ImportError): - from .intent_model import IntentModel - from .entity_model import EntityModel - from .composite_child_model import CompositeChildModel - from .composite_entity_model import CompositeEntityModel + from .prediction_request_options import PredictionRequestOptions + from .external_entity import ExternalEntity + from .request_list import RequestList + from .dynamic_list import DynamicList + from .prediction_request import PredictionRequest + from .intent import Intent from .sentiment import Sentiment - from .luis_result import LuisResult - from .entity_with_score import EntityWithScore - from .entity_with_resolution import EntityWithResolution - from .api_error import APIError, APIErrorException + from .prediction import Prediction + from .prediction_response import PredictionResponse + from .error_body import ErrorBody + from .error import Error, ErrorException __all__ = [ - 'IntentModel', - 'EntityModel', - 'CompositeChildModel', - 'CompositeEntityModel', + 'PredictionRequestOptions', + 'ExternalEntity', + 'RequestList', + 'DynamicList', + 'PredictionRequest', + 'Intent', 'Sentiment', - 'LuisResult', - 'EntityWithScore', - 'EntityWithResolution', - 'APIError', 'APIErrorException', + 'Prediction', + 'PredictionResponse', + 'ErrorBody', + 'Error', 'ErrorException', ] diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/composite_entity_model.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/composite_entity_model.py deleted file mode 100644 index a41140ae6d3d..000000000000 --- a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/composite_entity_model.py +++ /dev/null @@ -1,45 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class CompositeEntityModel(Model): - """LUIS Composite Entity. - - All required parameters must be populated in order to send to Azure. - - :param parent_type: Required. Type/name of parent entity. - :type parent_type: str - :param value: Required. Value for composite entity extracted by LUIS. - :type value: str - :param children: Required. Child entities. - :type children: - list[~azure.cognitiveservices.language.luis.runtime.models.CompositeChildModel] - """ - - _validation = { - 'parent_type': {'required': True}, - 'value': {'required': True}, - 'children': {'required': True}, - } - - _attribute_map = { - 'parent_type': {'key': 'parentType', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'children': {'key': 'children', 'type': '[CompositeChildModel]'}, - } - - def __init__(self, **kwargs): - super(CompositeEntityModel, self).__init__(**kwargs) - self.parent_type = kwargs.get('parent_type', None) - self.value = kwargs.get('value', None) - self.children = kwargs.get('children', None) diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/composite_entity_model_py3.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/composite_entity_model_py3.py deleted file mode 100644 index 45ac985fffc4..000000000000 --- a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/composite_entity_model_py3.py +++ /dev/null @@ -1,45 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class CompositeEntityModel(Model): - """LUIS Composite Entity. - - All required parameters must be populated in order to send to Azure. - - :param parent_type: Required. Type/name of parent entity. - :type parent_type: str - :param value: Required. Value for composite entity extracted by LUIS. - :type value: str - :param children: Required. Child entities. - :type children: - list[~azure.cognitiveservices.language.luis.runtime.models.CompositeChildModel] - """ - - _validation = { - 'parent_type': {'required': True}, - 'value': {'required': True}, - 'children': {'required': True}, - } - - _attribute_map = { - 'parent_type': {'key': 'parentType', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'children': {'key': 'children', 'type': '[CompositeChildModel]'}, - } - - def __init__(self, *, parent_type: str, value: str, children, **kwargs) -> None: - super(CompositeEntityModel, self).__init__(**kwargs) - self.parent_type = parent_type - self.value = value - self.children = children diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/dynamic_list.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/dynamic_list.py new file mode 100644 index 000000000000..592ecb5142ec --- /dev/null +++ b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/dynamic_list.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class DynamicList(Model): + """Defines an extension for a list entity. + + All required parameters must be populated in order to send to Azure. + + :param list_entity_name: Required. The name of the list entity to extend. + :type list_entity_name: str + :param request_lists: Required. The lists to append on the extended list + entity. + :type request_lists: + list[~azure.cognitiveservices.language.luis.runtime.models.RequestList] + """ + + _validation = { + 'list_entity_name': {'required': True}, + 'request_lists': {'required': True}, + } + + _attribute_map = { + 'list_entity_name': {'key': 'listEntityName', 'type': 'str'}, + 'request_lists': {'key': 'requestLists', 'type': '[RequestList]'}, + } + + def __init__(self, **kwargs): + super(DynamicList, self).__init__(**kwargs) + self.list_entity_name = kwargs.get('list_entity_name', None) + self.request_lists = kwargs.get('request_lists', None) diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/dynamic_list_py3.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/dynamic_list_py3.py new file mode 100644 index 000000000000..521035fbb31d --- /dev/null +++ b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/dynamic_list_py3.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class DynamicList(Model): + """Defines an extension for a list entity. + + All required parameters must be populated in order to send to Azure. + + :param list_entity_name: Required. The name of the list entity to extend. + :type list_entity_name: str + :param request_lists: Required. The lists to append on the extended list + entity. + :type request_lists: + list[~azure.cognitiveservices.language.luis.runtime.models.RequestList] + """ + + _validation = { + 'list_entity_name': {'required': True}, + 'request_lists': {'required': True}, + } + + _attribute_map = { + 'list_entity_name': {'key': 'listEntityName', 'type': 'str'}, + 'request_lists': {'key': 'requestLists', 'type': '[RequestList]'}, + } + + def __init__(self, *, list_entity_name: str, request_lists, **kwargs) -> None: + super(DynamicList, self).__init__(**kwargs) + self.list_entity_name = list_entity_name + self.request_lists = request_lists diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/entity_model.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/entity_model.py deleted file mode 100644 index 3c9ab0bea6bc..000000000000 --- a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/entity_model.py +++ /dev/null @@ -1,56 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class EntityModel(Model): - """An entity extracted from the utterance. - - All required parameters must be populated in order to send to Azure. - - :param additional_properties: Unmatched properties from the message are - deserialized this collection - :type additional_properties: dict[str, object] - :param entity: Required. Name of the entity, as defined in LUIS. - :type entity: str - :param type: Required. Type of the entity, as defined in LUIS. - :type type: str - :param start_index: Required. The position of the first character of the - matched entity within the utterance. - :type start_index: int - :param end_index: Required. The position of the last character of the - matched entity within the utterance. - :type end_index: int - """ - - _validation = { - 'entity': {'required': True}, - 'type': {'required': True}, - 'start_index': {'required': True}, - 'end_index': {'required': True}, - } - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'entity': {'key': 'entity', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'start_index': {'key': 'startIndex', 'type': 'int'}, - 'end_index': {'key': 'endIndex', 'type': 'int'}, - } - - def __init__(self, **kwargs): - super(EntityModel, self).__init__(**kwargs) - self.additional_properties = kwargs.get('additional_properties', None) - self.entity = kwargs.get('entity', None) - self.type = kwargs.get('type', None) - self.start_index = kwargs.get('start_index', None) - self.end_index = kwargs.get('end_index', None) diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/entity_model_py3.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/entity_model_py3.py deleted file mode 100644 index d66eda908ac1..000000000000 --- a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/entity_model_py3.py +++ /dev/null @@ -1,56 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class EntityModel(Model): - """An entity extracted from the utterance. - - All required parameters must be populated in order to send to Azure. - - :param additional_properties: Unmatched properties from the message are - deserialized this collection - :type additional_properties: dict[str, object] - :param entity: Required. Name of the entity, as defined in LUIS. - :type entity: str - :param type: Required. Type of the entity, as defined in LUIS. - :type type: str - :param start_index: Required. The position of the first character of the - matched entity within the utterance. - :type start_index: int - :param end_index: Required. The position of the last character of the - matched entity within the utterance. - :type end_index: int - """ - - _validation = { - 'entity': {'required': True}, - 'type': {'required': True}, - 'start_index': {'required': True}, - 'end_index': {'required': True}, - } - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'entity': {'key': 'entity', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'start_index': {'key': 'startIndex', 'type': 'int'}, - 'end_index': {'key': 'endIndex', 'type': 'int'}, - } - - def __init__(self, *, entity: str, type: str, start_index: int, end_index: int, additional_properties=None, **kwargs) -> None: - super(EntityModel, self).__init__(**kwargs) - self.additional_properties = additional_properties - self.entity = entity - self.type = type - self.start_index = start_index - self.end_index = end_index diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/entity_with_resolution.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/entity_with_resolution.py deleted file mode 100644 index 6218f437891d..000000000000 --- a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/entity_with_resolution.py +++ /dev/null @@ -1,57 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .entity_model import EntityModel - - -class EntityWithResolution(EntityModel): - """EntityWithResolution. - - All required parameters must be populated in order to send to Azure. - - :param additional_properties: Unmatched properties from the message are - deserialized this collection - :type additional_properties: dict[str, object] - :param entity: Required. Name of the entity, as defined in LUIS. - :type entity: str - :param type: Required. Type of the entity, as defined in LUIS. - :type type: str - :param start_index: Required. The position of the first character of the - matched entity within the utterance. - :type start_index: int - :param end_index: Required. The position of the last character of the - matched entity within the utterance. - :type end_index: int - :param resolution: Required. Resolution values for pre-built LUIS - entities. - :type resolution: object - """ - - _validation = { - 'entity': {'required': True}, - 'type': {'required': True}, - 'start_index': {'required': True}, - 'end_index': {'required': True}, - 'resolution': {'required': True}, - } - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'entity': {'key': 'entity', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'start_index': {'key': 'startIndex', 'type': 'int'}, - 'end_index': {'key': 'endIndex', 'type': 'int'}, - 'resolution': {'key': 'resolution', 'type': 'object'}, - } - - def __init__(self, **kwargs): - super(EntityWithResolution, self).__init__(**kwargs) - self.resolution = kwargs.get('resolution', None) diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/entity_with_resolution_py3.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/entity_with_resolution_py3.py deleted file mode 100644 index a78adecd6d35..000000000000 --- a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/entity_with_resolution_py3.py +++ /dev/null @@ -1,57 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .entity_model_py3 import EntityModel - - -class EntityWithResolution(EntityModel): - """EntityWithResolution. - - All required parameters must be populated in order to send to Azure. - - :param additional_properties: Unmatched properties from the message are - deserialized this collection - :type additional_properties: dict[str, object] - :param entity: Required. Name of the entity, as defined in LUIS. - :type entity: str - :param type: Required. Type of the entity, as defined in LUIS. - :type type: str - :param start_index: Required. The position of the first character of the - matched entity within the utterance. - :type start_index: int - :param end_index: Required. The position of the last character of the - matched entity within the utterance. - :type end_index: int - :param resolution: Required. Resolution values for pre-built LUIS - entities. - :type resolution: object - """ - - _validation = { - 'entity': {'required': True}, - 'type': {'required': True}, - 'start_index': {'required': True}, - 'end_index': {'required': True}, - 'resolution': {'required': True}, - } - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'entity': {'key': 'entity', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'start_index': {'key': 'startIndex', 'type': 'int'}, - 'end_index': {'key': 'endIndex', 'type': 'int'}, - 'resolution': {'key': 'resolution', 'type': 'object'}, - } - - def __init__(self, *, entity: str, type: str, start_index: int, end_index: int, resolution, additional_properties=None, **kwargs) -> None: - super(EntityWithResolution, self).__init__(additional_properties=additional_properties, entity=entity, type=type, start_index=start_index, end_index=end_index, **kwargs) - self.resolution = resolution diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/entity_with_score.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/entity_with_score.py deleted file mode 100644 index a31e75109740..000000000000 --- a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/entity_with_score.py +++ /dev/null @@ -1,57 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .entity_model import EntityModel - - -class EntityWithScore(EntityModel): - """EntityWithScore. - - All required parameters must be populated in order to send to Azure. - - :param additional_properties: Unmatched properties from the message are - deserialized this collection - :type additional_properties: dict[str, object] - :param entity: Required. Name of the entity, as defined in LUIS. - :type entity: str - :param type: Required. Type of the entity, as defined in LUIS. - :type type: str - :param start_index: Required. The position of the first character of the - matched entity within the utterance. - :type start_index: int - :param end_index: Required. The position of the last character of the - matched entity within the utterance. - :type end_index: int - :param score: Required. Associated prediction score for the intent - (float). - :type score: float - """ - - _validation = { - 'entity': {'required': True}, - 'type': {'required': True}, - 'start_index': {'required': True}, - 'end_index': {'required': True}, - 'score': {'required': True, 'maximum': 1, 'minimum': 0}, - } - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'entity': {'key': 'entity', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'start_index': {'key': 'startIndex', 'type': 'int'}, - 'end_index': {'key': 'endIndex', 'type': 'int'}, - 'score': {'key': 'score', 'type': 'float'}, - } - - def __init__(self, **kwargs): - super(EntityWithScore, self).__init__(**kwargs) - self.score = kwargs.get('score', None) diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/entity_with_score_py3.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/entity_with_score_py3.py deleted file mode 100644 index 5193300a0938..000000000000 --- a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/entity_with_score_py3.py +++ /dev/null @@ -1,57 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .entity_model_py3 import EntityModel - - -class EntityWithScore(EntityModel): - """EntityWithScore. - - All required parameters must be populated in order to send to Azure. - - :param additional_properties: Unmatched properties from the message are - deserialized this collection - :type additional_properties: dict[str, object] - :param entity: Required. Name of the entity, as defined in LUIS. - :type entity: str - :param type: Required. Type of the entity, as defined in LUIS. - :type type: str - :param start_index: Required. The position of the first character of the - matched entity within the utterance. - :type start_index: int - :param end_index: Required. The position of the last character of the - matched entity within the utterance. - :type end_index: int - :param score: Required. Associated prediction score for the intent - (float). - :type score: float - """ - - _validation = { - 'entity': {'required': True}, - 'type': {'required': True}, - 'start_index': {'required': True}, - 'end_index': {'required': True}, - 'score': {'required': True, 'maximum': 1, 'minimum': 0}, - } - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'entity': {'key': 'entity', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'start_index': {'key': 'startIndex', 'type': 'int'}, - 'end_index': {'key': 'endIndex', 'type': 'int'}, - 'score': {'key': 'score', 'type': 'float'}, - } - - def __init__(self, *, entity: str, type: str, start_index: int, end_index: int, score: float, additional_properties=None, **kwargs) -> None: - super(EntityWithScore, self).__init__(additional_properties=additional_properties, entity=entity, type=type, start_index=start_index, end_index=end_index, **kwargs) - self.score = score diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/api_error.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/error.py similarity index 54% rename from azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/api_error.py rename to azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/error.py index 13f85dd56829..ac4781e0f551 100644 --- a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/api_error.py +++ b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/error.py @@ -13,28 +13,31 @@ from msrest.exceptions import HttpOperationError -class APIError(Model): - """Error information returned by the API. +class Error(Model): + """Represents the error that occurred. - :param status_code: HTTP Status code - :type status_code: str - :param message: Cause of the error. - :type message: str + All required parameters must be populated in order to send to Azure. + + :param error: Required. + :type error: + ~azure.cognitiveservices.language.luis.runtime.models.ErrorBody """ + _validation = { + 'error': {'required': True}, + } + _attribute_map = { - 'status_code': {'key': 'statusCode', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ErrorBody'}, } def __init__(self, **kwargs): - super(APIError, self).__init__(**kwargs) - self.status_code = kwargs.get('status_code', None) - self.message = kwargs.get('message', None) + super(Error, self).__init__(**kwargs) + self.error = kwargs.get('error', None) -class APIErrorException(HttpOperationError): - """Server responsed with exception of type: 'APIError'. +class ErrorException(HttpOperationError): + """Server responsed with exception of type: 'Error'. :param deserialize: A deserializer :param response: Server response to be deserialized. @@ -42,4 +45,4 @@ class APIErrorException(HttpOperationError): def __init__(self, deserialize, response, *args): - super(APIErrorException, self).__init__(deserialize, response, 'APIError', *args) + super(ErrorException, self).__init__(deserialize, response, 'Error', *args) diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/composite_child_model.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/error_body.py similarity index 55% rename from azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/composite_child_model.py rename to azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/error_body.py index 5ebd233ebcfd..3b26dddde644 100644 --- a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/composite_child_model.py +++ b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/error_body.py @@ -12,28 +12,28 @@ from msrest.serialization import Model -class CompositeChildModel(Model): - """Child entity in a LUIS Composite Entity. +class ErrorBody(Model): + """Represents the definition of the error that occurred. All required parameters must be populated in order to send to Azure. - :param type: Required. Type of child entity. - :type type: str - :param value: Required. Value extracted by LUIS. - :type value: str + :param code: Required. The error code. + :type code: str + :param message: Required. The error message. + :type message: str """ _validation = { - 'type': {'required': True}, - 'value': {'required': True}, + 'code': {'required': True}, + 'message': {'required': True}, } _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, } def __init__(self, **kwargs): - super(CompositeChildModel, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.value = kwargs.get('value', None) + super(ErrorBody, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/composite_child_model_py3.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/error_body_py3.py similarity index 53% rename from azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/composite_child_model_py3.py rename to azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/error_body_py3.py index e02d60121c03..7bac7d139f70 100644 --- a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/composite_child_model_py3.py +++ b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/error_body_py3.py @@ -12,28 +12,28 @@ from msrest.serialization import Model -class CompositeChildModel(Model): - """Child entity in a LUIS Composite Entity. +class ErrorBody(Model): + """Represents the definition of the error that occurred. All required parameters must be populated in order to send to Azure. - :param type: Required. Type of child entity. - :type type: str - :param value: Required. Value extracted by LUIS. - :type value: str + :param code: Required. The error code. + :type code: str + :param message: Required. The error message. + :type message: str """ _validation = { - 'type': {'required': True}, - 'value': {'required': True}, + 'code': {'required': True}, + 'message': {'required': True}, } _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, type: str, value: str, **kwargs) -> None: - super(CompositeChildModel, self).__init__(**kwargs) - self.type = type - self.value = value + def __init__(self, *, code: str, message: str, **kwargs) -> None: + super(ErrorBody, self).__init__(**kwargs) + self.code = code + self.message = message diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/api_error_py3.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/error_py3.py similarity index 51% rename from azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/api_error_py3.py rename to azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/error_py3.py index cfde35f5288f..fd4a71437c06 100644 --- a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/api_error_py3.py +++ b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/error_py3.py @@ -13,28 +13,31 @@ from msrest.exceptions import HttpOperationError -class APIError(Model): - """Error information returned by the API. +class Error(Model): + """Represents the error that occurred. - :param status_code: HTTP Status code - :type status_code: str - :param message: Cause of the error. - :type message: str + All required parameters must be populated in order to send to Azure. + + :param error: Required. + :type error: + ~azure.cognitiveservices.language.luis.runtime.models.ErrorBody """ + _validation = { + 'error': {'required': True}, + } + _attribute_map = { - 'status_code': {'key': 'statusCode', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ErrorBody'}, } - def __init__(self, *, status_code: str=None, message: str=None, **kwargs) -> None: - super(APIError, self).__init__(**kwargs) - self.status_code = status_code - self.message = message + def __init__(self, *, error, **kwargs) -> None: + super(Error, self).__init__(**kwargs) + self.error = error -class APIErrorException(HttpOperationError): - """Server responsed with exception of type: 'APIError'. +class ErrorException(HttpOperationError): + """Server responsed with exception of type: 'Error'. :param deserialize: A deserializer :param response: Server response to be deserialized. @@ -42,4 +45,4 @@ class APIErrorException(HttpOperationError): def __init__(self, deserialize, response, *args): - super(APIErrorException, self).__init__(deserialize, response, 'APIError', *args) + super(ErrorException, self).__init__(deserialize, response, 'Error', *args) diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/external_entity.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/external_entity.py new file mode 100644 index 000000000000..0f168025d34f --- /dev/null +++ b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/external_entity.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ExternalEntity(Model): + """Defines a user perdicted entity that extends an already existing one. + + All required parameters must be populated in order to send to Azure. + + :param entity_name: Required. The name of the entity to extend. + :type entity_name: str + :param start_index: Required. The start character index of the predicted + entity. + :type start_index: int + :param entity_length: Required. The length of the predicted entity. + :type entity_length: int + :param resolution: A user supplied custom resolution to return as the + entity's prediction. + :type resolution: object + """ + + _validation = { + 'entity_name': {'required': True}, + 'start_index': {'required': True}, + 'entity_length': {'required': True}, + } + + _attribute_map = { + 'entity_name': {'key': 'entityName', 'type': 'str'}, + 'start_index': {'key': 'startIndex', 'type': 'int'}, + 'entity_length': {'key': 'entityLength', 'type': 'int'}, + 'resolution': {'key': 'resolution', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(ExternalEntity, self).__init__(**kwargs) + self.entity_name = kwargs.get('entity_name', None) + self.start_index = kwargs.get('start_index', None) + self.entity_length = kwargs.get('entity_length', None) + self.resolution = kwargs.get('resolution', None) diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/external_entity_py3.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/external_entity_py3.py new file mode 100644 index 000000000000..8e2f7115b2b4 --- /dev/null +++ b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/external_entity_py3.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ExternalEntity(Model): + """Defines a user perdicted entity that extends an already existing one. + + All required parameters must be populated in order to send to Azure. + + :param entity_name: Required. The name of the entity to extend. + :type entity_name: str + :param start_index: Required. The start character index of the predicted + entity. + :type start_index: int + :param entity_length: Required. The length of the predicted entity. + :type entity_length: int + :param resolution: A user supplied custom resolution to return as the + entity's prediction. + :type resolution: object + """ + + _validation = { + 'entity_name': {'required': True}, + 'start_index': {'required': True}, + 'entity_length': {'required': True}, + } + + _attribute_map = { + 'entity_name': {'key': 'entityName', 'type': 'str'}, + 'start_index': {'key': 'startIndex', 'type': 'int'}, + 'entity_length': {'key': 'entityLength', 'type': 'int'}, + 'resolution': {'key': 'resolution', 'type': 'object'}, + } + + def __init__(self, *, entity_name: str, start_index: int, entity_length: int, resolution=None, **kwargs) -> None: + super(ExternalEntity, self).__init__(**kwargs) + self.entity_name = entity_name + self.start_index = start_index + self.entity_length = entity_length + self.resolution = resolution diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/intent_model.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/intent.py similarity index 61% rename from azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/intent_model.py rename to azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/intent.py index dc2dc7e526b7..de906474a92b 100644 --- a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/intent_model.py +++ b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/intent.py @@ -12,25 +12,22 @@ from msrest.serialization import Model -class IntentModel(Model): - """An intent detected from the utterance. +class Intent(Model): + """Represents an intent prediction. - :param intent: Name of the intent, as defined in LUIS. - :type intent: str - :param score: Associated prediction score for the intent (float). + :param score: The score of the fired intent. :type score: float + :param child_app: The prediction of the dispatched application. + :type child_app: + ~azure.cognitiveservices.language.luis.runtime.models.Prediction """ - _validation = { - 'score': {'maximum': 1, 'minimum': 0}, - } - _attribute_map = { - 'intent': {'key': 'intent', 'type': 'str'}, 'score': {'key': 'score', 'type': 'float'}, + 'child_app': {'key': 'childApp', 'type': 'Prediction'}, } def __init__(self, **kwargs): - super(IntentModel, self).__init__(**kwargs) - self.intent = kwargs.get('intent', None) + super(Intent, self).__init__(**kwargs) self.score = kwargs.get('score', None) + self.child_app = kwargs.get('child_app', None) diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/intent_model_py3.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/intent_py3.py similarity index 56% rename from azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/intent_model_py3.py rename to azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/intent_py3.py index 48e48ec42a0e..81956a95f313 100644 --- a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/intent_model_py3.py +++ b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/intent_py3.py @@ -12,25 +12,22 @@ from msrest.serialization import Model -class IntentModel(Model): - """An intent detected from the utterance. +class Intent(Model): + """Represents an intent prediction. - :param intent: Name of the intent, as defined in LUIS. - :type intent: str - :param score: Associated prediction score for the intent (float). + :param score: The score of the fired intent. :type score: float + :param child_app: The prediction of the dispatched application. + :type child_app: + ~azure.cognitiveservices.language.luis.runtime.models.Prediction """ - _validation = { - 'score': {'maximum': 1, 'minimum': 0}, - } - _attribute_map = { - 'intent': {'key': 'intent', 'type': 'str'}, 'score': {'key': 'score', 'type': 'float'}, + 'child_app': {'key': 'childApp', 'type': 'Prediction'}, } - def __init__(self, *, intent: str=None, score: float=None, **kwargs) -> None: - super(IntentModel, self).__init__(**kwargs) - self.intent = intent + def __init__(self, *, score: float=None, child_app=None, **kwargs) -> None: + super(Intent, self).__init__(**kwargs) self.score = score + self.child_app = child_app diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/luis_result.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/luis_result.py deleted file mode 100644 index 7dfd35e8aa1f..000000000000 --- a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/luis_result.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class LuisResult(Model): - """Prediction, based on the input query, containing intent(s) and entities. - - :param query: The input utterance that was analyzed. - :type query: str - :param altered_query: The corrected utterance (when spell checking was - enabled). - :type altered_query: str - :param top_scoring_intent: - :type top_scoring_intent: - ~azure.cognitiveservices.language.luis.runtime.models.IntentModel - :param intents: All the intents (and their score) that were detected from - utterance. - :type intents: - list[~azure.cognitiveservices.language.luis.runtime.models.IntentModel] - :param entities: The entities extracted from the utterance. - :type entities: - list[~azure.cognitiveservices.language.luis.runtime.models.EntityModel] - :param composite_entities: The composite entities extracted from the - utterance. - :type composite_entities: - list[~azure.cognitiveservices.language.luis.runtime.models.CompositeEntityModel] - :param sentiment_analysis: - :type sentiment_analysis: - ~azure.cognitiveservices.language.luis.runtime.models.Sentiment - :param connected_service_result: - :type connected_service_result: - ~azure.cognitiveservices.language.luis.runtime.models.LuisResult - """ - - _attribute_map = { - 'query': {'key': 'query', 'type': 'str'}, - 'altered_query': {'key': 'alteredQuery', 'type': 'str'}, - 'top_scoring_intent': {'key': 'topScoringIntent', 'type': 'IntentModel'}, - 'intents': {'key': 'intents', 'type': '[IntentModel]'}, - 'entities': {'key': 'entities', 'type': '[EntityModel]'}, - 'composite_entities': {'key': 'compositeEntities', 'type': '[CompositeEntityModel]'}, - 'sentiment_analysis': {'key': 'sentimentAnalysis', 'type': 'Sentiment'}, - 'connected_service_result': {'key': 'connectedServiceResult', 'type': 'LuisResult'}, - } - - def __init__(self, **kwargs): - super(LuisResult, self).__init__(**kwargs) - self.query = kwargs.get('query', None) - self.altered_query = kwargs.get('altered_query', None) - self.top_scoring_intent = kwargs.get('top_scoring_intent', None) - self.intents = kwargs.get('intents', None) - self.entities = kwargs.get('entities', None) - self.composite_entities = kwargs.get('composite_entities', None) - self.sentiment_analysis = kwargs.get('sentiment_analysis', None) - self.connected_service_result = kwargs.get('connected_service_result', None) diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/luis_result_py3.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/luis_result_py3.py deleted file mode 100644 index 6c14b42dc8d3..000000000000 --- a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/luis_result_py3.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class LuisResult(Model): - """Prediction, based on the input query, containing intent(s) and entities. - - :param query: The input utterance that was analyzed. - :type query: str - :param altered_query: The corrected utterance (when spell checking was - enabled). - :type altered_query: str - :param top_scoring_intent: - :type top_scoring_intent: - ~azure.cognitiveservices.language.luis.runtime.models.IntentModel - :param intents: All the intents (and their score) that were detected from - utterance. - :type intents: - list[~azure.cognitiveservices.language.luis.runtime.models.IntentModel] - :param entities: The entities extracted from the utterance. - :type entities: - list[~azure.cognitiveservices.language.luis.runtime.models.EntityModel] - :param composite_entities: The composite entities extracted from the - utterance. - :type composite_entities: - list[~azure.cognitiveservices.language.luis.runtime.models.CompositeEntityModel] - :param sentiment_analysis: - :type sentiment_analysis: - ~azure.cognitiveservices.language.luis.runtime.models.Sentiment - :param connected_service_result: - :type connected_service_result: - ~azure.cognitiveservices.language.luis.runtime.models.LuisResult - """ - - _attribute_map = { - 'query': {'key': 'query', 'type': 'str'}, - 'altered_query': {'key': 'alteredQuery', 'type': 'str'}, - 'top_scoring_intent': {'key': 'topScoringIntent', 'type': 'IntentModel'}, - 'intents': {'key': 'intents', 'type': '[IntentModel]'}, - 'entities': {'key': 'entities', 'type': '[EntityModel]'}, - 'composite_entities': {'key': 'compositeEntities', 'type': '[CompositeEntityModel]'}, - 'sentiment_analysis': {'key': 'sentimentAnalysis', 'type': 'Sentiment'}, - 'connected_service_result': {'key': 'connectedServiceResult', 'type': 'LuisResult'}, - } - - def __init__(self, *, query: str=None, altered_query: str=None, top_scoring_intent=None, intents=None, entities=None, composite_entities=None, sentiment_analysis=None, connected_service_result=None, **kwargs) -> None: - super(LuisResult, self).__init__(**kwargs) - self.query = query - self.altered_query = altered_query - self.top_scoring_intent = top_scoring_intent - self.intents = intents - self.entities = entities - self.composite_entities = composite_entities - self.sentiment_analysis = sentiment_analysis - self.connected_service_result = connected_service_result diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/prediction.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/prediction.py new file mode 100644 index 000000000000..d879dad25850 --- /dev/null +++ b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/prediction.py @@ -0,0 +1,63 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class Prediction(Model): + """Represents the prediction of a query. + + All required parameters must be populated in order to send to Azure. + + :param normalized_query: Required. The query after pre-processing and + normalization. + :type normalized_query: str + :param altered_query: The query after spell checking. Only set if spell + check was enabled and a spelling mistake was found. + :type altered_query: str + :param top_intent: Required. The name of the top scoring intent. + :type top_intent: str + :param intents: Required. A dictionary representing the intents that + fired. + :type intents: dict[str, + ~azure.cognitiveservices.language.luis.runtime.models.Intent] + :param entities: Required. The dictionary representing the entities that + fired. + :type entities: dict[str, object] + :param sentiment: The result of the sentiment analysis. + :type sentiment: + ~azure.cognitiveservices.language.luis.runtime.models.Sentiment + """ + + _validation = { + 'normalized_query': {'required': True}, + 'top_intent': {'required': True}, + 'intents': {'required': True}, + 'entities': {'required': True}, + } + + _attribute_map = { + 'normalized_query': {'key': 'normalizedQuery', 'type': 'str'}, + 'altered_query': {'key': 'alteredQuery', 'type': 'str'}, + 'top_intent': {'key': 'topIntent', 'type': 'str'}, + 'intents': {'key': 'intents', 'type': '{Intent}'}, + 'entities': {'key': 'entities', 'type': '{object}'}, + 'sentiment': {'key': 'sentiment', 'type': 'Sentiment'}, + } + + def __init__(self, **kwargs): + super(Prediction, self).__init__(**kwargs) + self.normalized_query = kwargs.get('normalized_query', None) + self.altered_query = kwargs.get('altered_query', None) + self.top_intent = kwargs.get('top_intent', None) + self.intents = kwargs.get('intents', None) + self.entities = kwargs.get('entities', None) + self.sentiment = kwargs.get('sentiment', None) diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/prediction_py3.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/prediction_py3.py new file mode 100644 index 000000000000..f059d747e93c --- /dev/null +++ b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/prediction_py3.py @@ -0,0 +1,63 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class Prediction(Model): + """Represents the prediction of a query. + + All required parameters must be populated in order to send to Azure. + + :param normalized_query: Required. The query after pre-processing and + normalization. + :type normalized_query: str + :param altered_query: The query after spell checking. Only set if spell + check was enabled and a spelling mistake was found. + :type altered_query: str + :param top_intent: Required. The name of the top scoring intent. + :type top_intent: str + :param intents: Required. A dictionary representing the intents that + fired. + :type intents: dict[str, + ~azure.cognitiveservices.language.luis.runtime.models.Intent] + :param entities: Required. The dictionary representing the entities that + fired. + :type entities: dict[str, object] + :param sentiment: The result of the sentiment analysis. + :type sentiment: + ~azure.cognitiveservices.language.luis.runtime.models.Sentiment + """ + + _validation = { + 'normalized_query': {'required': True}, + 'top_intent': {'required': True}, + 'intents': {'required': True}, + 'entities': {'required': True}, + } + + _attribute_map = { + 'normalized_query': {'key': 'normalizedQuery', 'type': 'str'}, + 'altered_query': {'key': 'alteredQuery', 'type': 'str'}, + 'top_intent': {'key': 'topIntent', 'type': 'str'}, + 'intents': {'key': 'intents', 'type': '{Intent}'}, + 'entities': {'key': 'entities', 'type': '{object}'}, + 'sentiment': {'key': 'sentiment', 'type': 'Sentiment'}, + } + + def __init__(self, *, normalized_query: str, top_intent: str, intents, entities, altered_query: str=None, sentiment=None, **kwargs) -> None: + super(Prediction, self).__init__(**kwargs) + self.normalized_query = normalized_query + self.altered_query = altered_query + self.top_intent = top_intent + self.intents = intents + self.entities = entities + self.sentiment = sentiment diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/prediction_request.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/prediction_request.py new file mode 100644 index 000000000000..0e8e2ee8cf5b --- /dev/null +++ b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/prediction_request.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class PredictionRequest(Model): + """Represents the prediction request parameters. + + All required parameters must be populated in order to send to Azure. + + :param query: Required. The query to predict + :type query: str + :param options: The custom options defined for this request. + :type options: + ~azure.cognitiveservices.language.luis.runtime.models.PredictionRequestOptions + :param external_entities: The externally predicted entities for this + request + :type external_entities: + list[~azure.cognitiveservices.language.luis.runtime.models.ExternalEntity] + :param dynamic_lists: The dynamically created list entities for this + request + :type dynamic_lists: + list[~azure.cognitiveservices.language.luis.runtime.models.DynamicList] + """ + + _validation = { + 'query': {'required': True}, + } + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + 'options': {'key': 'options', 'type': 'PredictionRequestOptions'}, + 'external_entities': {'key': 'externalEntities', 'type': '[ExternalEntity]'}, + 'dynamic_lists': {'key': 'dynamicLists', 'type': '[DynamicList]'}, + } + + def __init__(self, **kwargs): + super(PredictionRequest, self).__init__(**kwargs) + self.query = kwargs.get('query', None) + self.options = kwargs.get('options', None) + self.external_entities = kwargs.get('external_entities', None) + self.dynamic_lists = kwargs.get('dynamic_lists', None) diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/prediction_request_options.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/prediction_request_options.py new file mode 100644 index 000000000000..4a13869f8675 --- /dev/null +++ b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/prediction_request_options.py @@ -0,0 +1,34 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class PredictionRequestOptions(Model): + """The custom options for the prediction request. + + :param datetime_reference: The reference DateTime used for predicting + datetime entities. + :type datetime_reference: datetime + :param override_predictions: Whether to make the external entities + resolution override the predictions if an overlap occurs. + :type override_predictions: bool + """ + + _attribute_map = { + 'datetime_reference': {'key': 'datetimeReference', 'type': 'iso-8601'}, + 'override_predictions': {'key': 'overridePredictions', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(PredictionRequestOptions, self).__init__(**kwargs) + self.datetime_reference = kwargs.get('datetime_reference', None) + self.override_predictions = kwargs.get('override_predictions', None) diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/prediction_request_options_py3.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/prediction_request_options_py3.py new file mode 100644 index 000000000000..447559364859 --- /dev/null +++ b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/prediction_request_options_py3.py @@ -0,0 +1,34 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class PredictionRequestOptions(Model): + """The custom options for the prediction request. + + :param datetime_reference: The reference DateTime used for predicting + datetime entities. + :type datetime_reference: datetime + :param override_predictions: Whether to make the external entities + resolution override the predictions if an overlap occurs. + :type override_predictions: bool + """ + + _attribute_map = { + 'datetime_reference': {'key': 'datetimeReference', 'type': 'iso-8601'}, + 'override_predictions': {'key': 'overridePredictions', 'type': 'bool'}, + } + + def __init__(self, *, datetime_reference=None, override_predictions: bool=None, **kwargs) -> None: + super(PredictionRequestOptions, self).__init__(**kwargs) + self.datetime_reference = datetime_reference + self.override_predictions = override_predictions diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/prediction_request_py3.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/prediction_request_py3.py new file mode 100644 index 000000000000..bd12f0aea8a3 --- /dev/null +++ b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/prediction_request_py3.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class PredictionRequest(Model): + """Represents the prediction request parameters. + + All required parameters must be populated in order to send to Azure. + + :param query: Required. The query to predict + :type query: str + :param options: The custom options defined for this request. + :type options: + ~azure.cognitiveservices.language.luis.runtime.models.PredictionRequestOptions + :param external_entities: The externally predicted entities for this + request + :type external_entities: + list[~azure.cognitiveservices.language.luis.runtime.models.ExternalEntity] + :param dynamic_lists: The dynamically created list entities for this + request + :type dynamic_lists: + list[~azure.cognitiveservices.language.luis.runtime.models.DynamicList] + """ + + _validation = { + 'query': {'required': True}, + } + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + 'options': {'key': 'options', 'type': 'PredictionRequestOptions'}, + 'external_entities': {'key': 'externalEntities', 'type': '[ExternalEntity]'}, + 'dynamic_lists': {'key': 'dynamicLists', 'type': '[DynamicList]'}, + } + + def __init__(self, *, query: str, options=None, external_entities=None, dynamic_lists=None, **kwargs) -> None: + super(PredictionRequest, self).__init__(**kwargs) + self.query = query + self.options = options + self.external_entities = external_entities + self.dynamic_lists = dynamic_lists diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/prediction_response.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/prediction_response.py new file mode 100644 index 000000000000..878472a716dd --- /dev/null +++ b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/prediction_response.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class PredictionResponse(Model): + """Represents the prediction response. + + All required parameters must be populated in order to send to Azure. + + :param query: Required. The query used in the prediction. + :type query: str + :param prediction: Required. The prediction of the requested query. + :type prediction: + ~azure.cognitiveservices.language.luis.runtime.models.Prediction + """ + + _validation = { + 'query': {'required': True}, + 'prediction': {'required': True}, + } + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + 'prediction': {'key': 'prediction', 'type': 'Prediction'}, + } + + def __init__(self, **kwargs): + super(PredictionResponse, self).__init__(**kwargs) + self.query = kwargs.get('query', None) + self.prediction = kwargs.get('prediction', None) diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/prediction_response_py3.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/prediction_response_py3.py new file mode 100644 index 000000000000..2d4b99ed4a13 --- /dev/null +++ b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/prediction_response_py3.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class PredictionResponse(Model): + """Represents the prediction response. + + All required parameters must be populated in order to send to Azure. + + :param query: Required. The query used in the prediction. + :type query: str + :param prediction: Required. The prediction of the requested query. + :type prediction: + ~azure.cognitiveservices.language.luis.runtime.models.Prediction + """ + + _validation = { + 'query': {'required': True}, + 'prediction': {'required': True}, + } + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + 'prediction': {'key': 'prediction', 'type': 'Prediction'}, + } + + def __init__(self, *, query: str, prediction, **kwargs) -> None: + super(PredictionResponse, self).__init__(**kwargs) + self.query = query + self.prediction = prediction diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/request_list.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/request_list.py new file mode 100644 index 000000000000..f5d7743d4e8f --- /dev/null +++ b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/request_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RequestList(Model): + """Defines a sub-list to append to an existing list entity. + + All required parameters must be populated in order to send to Azure. + + :param name: The name of the sub-list. + :type name: str + :param canonical_form: Required. The canonical form of the sub-list. + :type canonical_form: str + :param synonyms: The synonyms of the canonical form. + :type synonyms: list[str] + """ + + _validation = { + 'canonical_form': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'canonical_form': {'key': 'canonicalForm', 'type': 'str'}, + 'synonyms': {'key': 'synonyms', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(RequestList, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.canonical_form = kwargs.get('canonical_form', None) + self.synonyms = kwargs.get('synonyms', None) diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/request_list_py3.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/request_list_py3.py new file mode 100644 index 000000000000..3d976da4adfc --- /dev/null +++ b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/request_list_py3.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RequestList(Model): + """Defines a sub-list to append to an existing list entity. + + All required parameters must be populated in order to send to Azure. + + :param name: The name of the sub-list. + :type name: str + :param canonical_form: Required. The canonical form of the sub-list. + :type canonical_form: str + :param synonyms: The synonyms of the canonical form. + :type synonyms: list[str] + """ + + _validation = { + 'canonical_form': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'canonical_form': {'key': 'canonicalForm', 'type': 'str'}, + 'synonyms': {'key': 'synonyms', 'type': '[str]'}, + } + + def __init__(self, *, canonical_form: str, name: str=None, synonyms=None, **kwargs) -> None: + super(RequestList, self).__init__(**kwargs) + self.name = name + self.canonical_form = canonical_form + self.synonyms = synonyms diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/sentiment.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/sentiment.py index 55c1442e35fa..2e8d35c073d8 100644 --- a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/sentiment.py +++ b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/sentiment.py @@ -13,22 +13,26 @@ class Sentiment(Model): - """Sentiment of the input utterance. + """The result of the sentiment analaysis. - :param label: The polarity of the sentiment, can be positive, neutral or - negative. - :type label: str - :param score: Score of the sentiment, ranges from 0 (most negative) to 1 - (most positive). + All required parameters must be populated in order to send to Azure. + + :param score: Required. The sentiment score of the query. :type score: float + :param label: The label of the sentiment analysis result. + :type label: str """ + _validation = { + 'score': {'required': True}, + } + _attribute_map = { - 'label': {'key': 'label', 'type': 'str'}, 'score': {'key': 'score', 'type': 'float'}, + 'label': {'key': 'label', 'type': 'str'}, } def __init__(self, **kwargs): super(Sentiment, self).__init__(**kwargs) - self.label = kwargs.get('label', None) self.score = kwargs.get('score', None) + self.label = kwargs.get('label', None) diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/sentiment_py3.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/sentiment_py3.py index fd92f4706e71..c3c8a9028bbb 100644 --- a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/sentiment_py3.py +++ b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/sentiment_py3.py @@ -13,22 +13,26 @@ class Sentiment(Model): - """Sentiment of the input utterance. + """The result of the sentiment analaysis. - :param label: The polarity of the sentiment, can be positive, neutral or - negative. - :type label: str - :param score: Score of the sentiment, ranges from 0 (most negative) to 1 - (most positive). + All required parameters must be populated in order to send to Azure. + + :param score: Required. The sentiment score of the query. :type score: float + :param label: The label of the sentiment analysis result. + :type label: str """ + _validation = { + 'score': {'required': True}, + } + _attribute_map = { - 'label': {'key': 'label', 'type': 'str'}, 'score': {'key': 'score', 'type': 'float'}, + 'label': {'key': 'label', 'type': 'str'}, } - def __init__(self, *, label: str=None, score: float=None, **kwargs) -> None: + def __init__(self, *, score: float, label: str=None, **kwargs) -> None: super(Sentiment, self).__init__(**kwargs) - self.label = label self.score = score + self.label = label diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/operations/prediction_operations.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/operations/prediction_operations.py index 77912c1616a8..5c608ae70264 100644 --- a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/operations/prediction_operations.py +++ b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/operations/prediction_operations.py @@ -33,62 +33,52 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def resolve( - self, app_id, query, timezone_offset=None, verbose=None, staging=None, spell_check=None, bing_spell_check_subscription_key=None, log=None, custom_headers=None, raw=False, **operation_config): - """Gets predictions for a given utterance, in the form of intents and - entities. The current maximum query size is 500 characters. + def get_version_prediction( + self, app_id, version_id, prediction_request, verbose=None, show_all_intents=None, log=None, custom_headers=None, raw=False, **operation_config): + """Gets the predictions for an application version. - :param app_id: The LUIS application ID (Guid). + :param app_id: The application ID. :type app_id: str - :param query: The utterance to predict. - :type query: str - :param timezone_offset: The timezone offset for the location of the - request. - :type timezone_offset: float - :param verbose: If true, return all intents instead of just the top - scoring intent. + :param version_id: The application version ID. + :type version_id: str + :param prediction_request: The prediction request parameters. + :type prediction_request: + ~azure.cognitiveservices.language.luis.runtime.models.PredictionRequest + :param verbose: Indicates whether to get extra metadata for the + entities predictions or not. :type verbose: bool - :param staging: Use the staging endpoint slot. - :type staging: bool - :param spell_check: Enable spell checking. - :type spell_check: bool - :param bing_spell_check_subscription_key: The subscription key to use - when enabling Bing spell check - :type bing_spell_check_subscription_key: str - :param log: Log query (default is true) + :param show_all_intents: Indicates whether to return all the intents + in the response or just the top intent. + :type show_all_intents: bool + :param log: Indicates whether to log the endpoint query or not. :type log: bool :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: LuisResult or ClientRawResponse if raw=true + :return: PredictionResponse or ClientRawResponse if raw=true :rtype: - ~azure.cognitiveservices.language.luis.runtime.models.LuisResult or - ~msrest.pipeline.ClientRawResponse + ~azure.cognitiveservices.language.luis.runtime.models.PredictionResponse + or ~msrest.pipeline.ClientRawResponse :raises: - :class:`APIErrorException` + :class:`ErrorException` """ # Construct URL - url = self.resolve.metadata['url'] + url = self.get_version_prediction.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), - 'appId': self._serialize.url("app_id", app_id, 'str') + 'appId': self._serialize.url("app_id", app_id, 'str'), + 'versionId': self._serialize.url("version_id", version_id, 'str') } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} - if timezone_offset is not None: - query_parameters['timezoneOffset'] = self._serialize.query("timezone_offset", timezone_offset, 'float') if verbose is not None: query_parameters['verbose'] = self._serialize.query("verbose", verbose, 'bool') - if staging is not None: - query_parameters['staging'] = self._serialize.query("staging", staging, 'bool') - if spell_check is not None: - query_parameters['spellCheck'] = self._serialize.query("spell_check", spell_check, 'bool') - if bing_spell_check_subscription_key is not None: - query_parameters['bing-spell-check-subscription-key'] = self._serialize.query("bing_spell_check_subscription_key", bing_spell_check_subscription_key, 'str') + if show_all_intents is not None: + query_parameters['show-all-intents'] = self._serialize.query("show_all_intents", show_all_intents, 'bool') if log is not None: query_parameters['log'] = self._serialize.query("log", log, 'bool') @@ -100,23 +90,101 @@ def resolve( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(query, 'str') + body_content = self._serialize.body(prediction_request, 'PredictionRequest') # Construct and send request request = self._client.post(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - raise models.APIErrorException(self._deserialize, response) + raise models.ErrorException(self._deserialize, response) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('LuisResult', response) + deserialized = self._deserialize('PredictionResponse', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - resolve.metadata = {'url': '/apps/{appId}'} + get_version_prediction.metadata = {'url': '/apps/{appId}/versions/{versionId}/predict'} + + def get_slot_prediction( + self, app_id, slot_name, prediction_request, verbose=None, show_all_intents=None, log=None, custom_headers=None, raw=False, **operation_config): + """Gets the predictions for an application slot. + + :param app_id: The application ID. + :type app_id: str + :param slot_name: The application slot name. + :type slot_name: str + :param prediction_request: The prediction request parameters. + :type prediction_request: + ~azure.cognitiveservices.language.luis.runtime.models.PredictionRequest + :param verbose: Indicates whether to get extra metadata for the + entities predictions or not. + :type verbose: bool + :param show_all_intents: Indicates whether to return all the intents + in the response or just the top intent. + :type show_all_intents: bool + :param log: Indicates whether to log the endpoint query or not. + :type log: bool + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: PredictionResponse or ClientRawResponse if raw=true + :rtype: + ~azure.cognitiveservices.language.luis.runtime.models.PredictionResponse + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorException` + """ + # Construct URL + url = self.get_slot_prediction.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'appId': self._serialize.url("app_id", app_id, 'str'), + 'slotName': self._serialize.url("slot_name", slot_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if verbose is not None: + query_parameters['verbose'] = self._serialize.query("verbose", verbose, 'bool') + if show_all_intents is not None: + query_parameters['show-all-intents'] = self._serialize.query("show_all_intents", show_all_intents, 'bool') + if log is not None: + query_parameters['log'] = self._serialize.query("log", log, 'bool') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._serialize.body(prediction_request, 'PredictionRequest') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('PredictionResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_slot_prediction.metadata = {'url': '/apps/{appId}/slots/{slotName}/predict'} diff --git a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/version.py b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/version.py index 63f83465c874..23f1b0e4d4af 100644 --- a/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/version.py +++ b/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0" +VERSION = "3.0-preview"