diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/_configuration.py b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/_configuration.py index 398cd5176478..62414bc0745b 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/_configuration.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/_configuration.py @@ -34,7 +34,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/api/v2.0' + base_url = '{Endpoint}/luis/api/v3.0-preview' super(LUISAuthoringClientConfiguration, self).__init__(base_url) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/_luis_authoring_client.py b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/_luis_authoring_client.py index f56535085591..1a4854c8b590 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/_luis_authoring_client.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/_luis_authoring_client.py @@ -69,7 +69,7 @@ def __init__( super(LUISAuthoringClient, 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/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/__init__.py index 1cf335db76a5..38bd485dcf81 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/__init__.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/__init__.py @@ -22,6 +22,7 @@ from ._models_py3 import AzureAccountInfoObject from ._models_py3 import BatchLabelExample from ._models_py3 import ChildEntity + from ._models_py3 import ChildEntityModelCreateObject from ._models_py3 import ClosedList from ._models_py3 import ClosedListEntityExtractor from ._models_py3 import ClosedListModelCreateObject @@ -38,7 +39,9 @@ from ._models_py3 import EntityExtractor from ._models_py3 import EntityLabel from ._models_py3 import EntityLabelObject + from ._models_py3 import EntityModelCreateObject from ._models_py3 import EntityModelInfo + from ._models_py3 import EntityModelUpdateObject from ._models_py3 import EntityPrediction from ._models_py3 import EntityRole from ._models_py3 import EntityRoleCreateObject @@ -51,10 +54,8 @@ from ._models_py3 import FeatureInfoObject from ._models_py3 import FeaturesResponseObject from ._models_py3 import HierarchicalChildEntity - from ._models_py3 import HierarchicalChildModelCreateObject from ._models_py3 import HierarchicalChildModelUpdateObject from ._models_py3 import HierarchicalEntityExtractor - from ._models_py3 import HierarchicalEntityModel from ._models_py3 import HierarchicalModel from ._models_py3 import IntentClassifier from ._models_py3 import IntentPrediction @@ -68,24 +69,24 @@ from ._models_py3 import LabelTextObject from ._models_py3 import LuisApp from ._models_py3 import ModelCreateObject + from ._models_py3 import ModelFeatureInformation from ._models_py3 import ModelInfo from ._models_py3 import ModelInfoResponse from ._models_py3 import ModelTrainingDetails from ._models_py3 import ModelTrainingInfo from ._models_py3 import ModelUpdateObject + from ._models_py3 import NDepthEntityExtractor from ._models_py3 import OperationError from ._models_py3 import OperationStatus from ._models_py3 import PatternAny from ._models_py3 import PatternAnyEntityExtractor from ._models_py3 import PatternAnyModelCreateObject from ._models_py3 import PatternAnyModelUpdateObject - from ._models_py3 import PatternCreateObject from ._models_py3 import PatternFeatureInfo from ._models_py3 import PatternRule from ._models_py3 import PatternRuleCreateObject from ._models_py3 import PatternRuleInfo from ._models_py3 import PatternRuleUpdateObject - from ._models_py3 import PatternUpdateObject from ._models_py3 import PersonalAssistantsResponse from ._models_py3 import PhraselistCreateObject from ._models_py3 import PhraseListFeatureInfo @@ -126,6 +127,7 @@ from ._models import AzureAccountInfoObject from ._models import BatchLabelExample from ._models import ChildEntity + from ._models import ChildEntityModelCreateObject from ._models import ClosedList from ._models import ClosedListEntityExtractor from ._models import ClosedListModelCreateObject @@ -142,7 +144,9 @@ from ._models import EntityExtractor from ._models import EntityLabel from ._models import EntityLabelObject + from ._models import EntityModelCreateObject from ._models import EntityModelInfo + from ._models import EntityModelUpdateObject from ._models import EntityPrediction from ._models import EntityRole from ._models import EntityRoleCreateObject @@ -155,10 +159,8 @@ from ._models import FeatureInfoObject from ._models import FeaturesResponseObject from ._models import HierarchicalChildEntity - from ._models import HierarchicalChildModelCreateObject from ._models import HierarchicalChildModelUpdateObject from ._models import HierarchicalEntityExtractor - from ._models import HierarchicalEntityModel from ._models import HierarchicalModel from ._models import IntentClassifier from ._models import IntentPrediction @@ -172,24 +174,24 @@ from ._models import LabelTextObject from ._models import LuisApp from ._models import ModelCreateObject + from ._models import ModelFeatureInformation from ._models import ModelInfo from ._models import ModelInfoResponse from ._models import ModelTrainingDetails from ._models import ModelTrainingInfo from ._models import ModelUpdateObject + from ._models import NDepthEntityExtractor from ._models import OperationError from ._models import OperationStatus from ._models import PatternAny from ._models import PatternAnyEntityExtractor from ._models import PatternAnyModelCreateObject from ._models import PatternAnyModelUpdateObject - from ._models import PatternCreateObject from ._models import PatternFeatureInfo from ._models import PatternRule from ._models import PatternRuleCreateObject from ._models import PatternRuleInfo from ._models import PatternRuleUpdateObject - from ._models import PatternUpdateObject from ._models import PersonalAssistantsResponse from ._models import PhraselistCreateObject from ._models import PhraseListFeatureInfo @@ -235,6 +237,7 @@ 'AzureAccountInfoObject', 'BatchLabelExample', 'ChildEntity', + 'ChildEntityModelCreateObject', 'ClosedList', 'ClosedListEntityExtractor', 'ClosedListModelCreateObject', @@ -251,7 +254,9 @@ 'EntityExtractor', 'EntityLabel', 'EntityLabelObject', + 'EntityModelCreateObject', 'EntityModelInfo', + 'EntityModelUpdateObject', 'EntityPrediction', 'EntityRole', 'EntityRoleCreateObject', @@ -264,10 +269,8 @@ 'FeatureInfoObject', 'FeaturesResponseObject', 'HierarchicalChildEntity', - 'HierarchicalChildModelCreateObject', 'HierarchicalChildModelUpdateObject', 'HierarchicalEntityExtractor', - 'HierarchicalEntityModel', 'HierarchicalModel', 'IntentClassifier', 'IntentPrediction', @@ -281,24 +284,24 @@ 'LabelTextObject', 'LuisApp', 'ModelCreateObject', + 'ModelFeatureInformation', 'ModelInfo', 'ModelInfoResponse', 'ModelTrainingDetails', 'ModelTrainingInfo', 'ModelUpdateObject', + 'NDepthEntityExtractor', 'OperationError', 'OperationStatus', 'PatternAny', 'PatternAnyEntityExtractor', 'PatternAnyModelCreateObject', 'PatternAnyModelUpdateObject', - 'PatternCreateObject', 'PatternFeatureInfo', 'PatternRule', 'PatternRuleCreateObject', 'PatternRuleInfo', 'PatternRuleUpdateObject', - 'PatternUpdateObject', 'PersonalAssistantsResponse', 'PhraselistCreateObject', 'PhraseListFeatureInfo', diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/_luis_authoring_client_enums.py b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/_luis_authoring_client_enums.py index f85ad6da8c8e..3bfeb07e7bff 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/_luis_authoring_client_enums.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/_luis_authoring_client_enums.py @@ -22,4 +22,5 @@ class TrainingStatus(str, Enum): class OperationStatusType(str, Enum): failed = "Failed" + failed = "FAILED" success = "Success" diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/_models.py b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/_models.py index 6cbdbeb5836b..63c4b31a1965 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/_models.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/_models.py @@ -336,6 +336,20 @@ class ChildEntity(Model): :type id: str :param name: The name of a child entity. :type name: str + :param instance_of: Instance of Model. + :type instance_of: str + :param type_id: The type ID of the Entity Model. + :type type_id: int + :param readable_type: Possible values include: 'Entity Extractor', 'Child + Entity Extractor', 'Hierarchical Entity Extractor', 'Hierarchical Child + Entity Extractor', 'Composite Entity Extractor', 'List Entity Extractor', + 'Prebuilt Entity Extractor', 'Intent Classifier', 'Pattern.Any Entity + Extractor', 'Closed List Entity Extractor', 'Regex Entity Extractor' + :type readable_type: str or + ~azure.cognitiveservices.language.luis.authoring.models.enum + :param children: List of children + :type children: + list[~azure.cognitiveservices.language.luis.authoring.models.ChildEntity] """ _validation = { @@ -345,12 +359,45 @@ class ChildEntity(Model): _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, + 'instance_of': {'key': 'instanceOf', 'type': 'str'}, + 'type_id': {'key': 'typeId', 'type': 'int'}, + 'readable_type': {'key': 'readableType', 'type': 'str'}, + 'children': {'key': 'children', 'type': '[ChildEntity]'}, } def __init__(self, **kwargs): super(ChildEntity, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.name = kwargs.get('name', None) + self.instance_of = kwargs.get('instance_of', None) + self.type_id = kwargs.get('type_id', None) + self.readable_type = kwargs.get('readable_type', None) + self.children = kwargs.get('children', None) + + +class ChildEntityModelCreateObject(Model): + """A child entity extractor create object. + + :param children: Child entities. + :type children: + list[~azure.cognitiveservices.language.luis.authoring.models.ChildEntityModelCreateObject] + :param name: Entity name. + :type name: str + :param instance_of: The instance of model name + :type instance_of: str + """ + + _attribute_map = { + 'children': {'key': 'children', 'type': '[ChildEntityModelCreateObject]'}, + 'name': {'key': 'name', 'type': 'str'}, + 'instance_of': {'key': 'instanceOf', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ChildEntityModelCreateObject, self).__init__(**kwargs) + self.children = kwargs.get('children', None) + self.name = kwargs.get('name', None) + self.instance_of = kwargs.get('instance_of', None) class ClosedList(Model): @@ -390,10 +437,11 @@ class ClosedListEntityExtractor(Model): :param type_id: The type ID of the Entity Model. :type type_id: int :param readable_type: Required. Possible values include: 'Entity - Extractor', 'Hierarchical Entity Extractor', 'Hierarchical Child Entity - Extractor', 'Composite Entity Extractor', 'List Entity Extractor', - 'Prebuilt Entity Extractor', 'Intent Classifier', 'Pattern.Any Entity - Extractor', 'Closed List Entity Extractor', 'Regex Entity Extractor' + Extractor', 'Child Entity Extractor', 'Hierarchical Entity Extractor', + 'Hierarchical Child Entity Extractor', 'Composite Entity Extractor', 'List + Entity Extractor', 'Prebuilt Entity Extractor', 'Intent Classifier', + 'Pattern.Any Entity Extractor', 'Closed List Entity Extractor', 'Regex + Entity Extractor' :type readable_type: str or ~azure.cognitiveservices.language.luis.authoring.models.enum :param roles: @@ -531,10 +579,11 @@ class CompositeEntityExtractor(Model): :param type_id: The type ID of the Entity Model. :type type_id: int :param readable_type: Required. Possible values include: 'Entity - Extractor', 'Hierarchical Entity Extractor', 'Hierarchical Child Entity - Extractor', 'Composite Entity Extractor', 'List Entity Extractor', - 'Prebuilt Entity Extractor', 'Intent Classifier', 'Pattern.Any Entity - Extractor', 'Closed List Entity Extractor', 'Regex Entity Extractor' + Extractor', 'Child Entity Extractor', 'Hierarchical Entity Extractor', + 'Hierarchical Child Entity Extractor', 'Composite Entity Extractor', 'List + Entity Extractor', 'Prebuilt Entity Extractor', 'Intent Classifier', + 'Pattern.Any Entity Extractor', 'Closed List Entity Extractor', 'Regex + Entity Extractor' :type readable_type: str or ~azure.cognitiveservices.language.luis.authoring.models.enum :param roles: @@ -601,10 +650,11 @@ class CustomPrebuiltModel(Model): :param type_id: The type ID of the Entity Model. :type type_id: int :param readable_type: Required. Possible values include: 'Entity - Extractor', 'Hierarchical Entity Extractor', 'Hierarchical Child Entity - Extractor', 'Composite Entity Extractor', 'List Entity Extractor', - 'Prebuilt Entity Extractor', 'Intent Classifier', 'Pattern.Any Entity - Extractor', 'Closed List Entity Extractor', 'Regex Entity Extractor' + Extractor', 'Child Entity Extractor', 'Hierarchical Entity Extractor', + 'Hierarchical Child Entity Extractor', 'Composite Entity Extractor', 'List + Entity Extractor', 'Prebuilt Entity Extractor', 'Intent Classifier', + 'Pattern.Any Entity Extractor', 'Closed List Entity Extractor', 'Regex + Entity Extractor' :type readable_type: str or ~azure.cognitiveservices.language.luis.authoring.models.enum :param custom_prebuilt_domain_name: The domain name. @@ -752,10 +802,11 @@ class EntityExtractor(Model): :param type_id: The type ID of the Entity Model. :type type_id: int :param readable_type: Required. Possible values include: 'Entity - Extractor', 'Hierarchical Entity Extractor', 'Hierarchical Child Entity - Extractor', 'Composite Entity Extractor', 'List Entity Extractor', - 'Prebuilt Entity Extractor', 'Intent Classifier', 'Pattern.Any Entity - Extractor', 'Closed List Entity Extractor', 'Regex Entity Extractor' + Extractor', 'Child Entity Extractor', 'Hierarchical Entity Extractor', + 'Hierarchical Child Entity Extractor', 'Composite Entity Extractor', 'List + Entity Extractor', 'Prebuilt Entity Extractor', 'Intent Classifier', + 'Pattern.Any Entity Extractor', 'Closed List Entity Extractor', 'Regex + Entity Extractor' :type readable_type: str or ~azure.cognitiveservices.language.luis.authoring.models.enum :param roles: @@ -807,9 +858,9 @@ class EntityLabel(Model): :param end_token_index: Required. The index within the utterance where the extracted entity ends. :type end_token_index: int - :param role: The role of the entity within the utterance. + :param role: The role of the predicted entity. :type role: str - :param role_id: The role Id. + :param role_id: The role id for the predicted entity. :type role_id: str """ @@ -850,7 +901,7 @@ class EntityLabelObject(Model): :param end_char_index: Required. The index within the utterance where the extracted entity ends. :type end_char_index: int - :param role: The role of the entity within the utterance. + :param role: The role the entity plays in the utterance. :type role: str """ @@ -875,6 +926,27 @@ def __init__(self, **kwargs): self.role = kwargs.get('role', None) +class EntityModelCreateObject(Model): + """An entity extractor create object. + + :param children: Child entities. + :type children: + list[~azure.cognitiveservices.language.luis.authoring.models.ChildEntityModelCreateObject] + :param name: Entity name. + :type name: str + """ + + _attribute_map = { + 'children': {'key': 'children', 'type': '[ChildEntityModelCreateObject]'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(EntityModelCreateObject, self).__init__(**kwargs) + self.children = kwargs.get('children', None) + self.name = kwargs.get('name', None) + + class ModelInfo(Model): """Base type used in entity types. @@ -887,10 +959,11 @@ class ModelInfo(Model): :param type_id: The type ID of the Entity Model. :type type_id: int :param readable_type: Required. Possible values include: 'Entity - Extractor', 'Hierarchical Entity Extractor', 'Hierarchical Child Entity - Extractor', 'Composite Entity Extractor', 'List Entity Extractor', - 'Prebuilt Entity Extractor', 'Intent Classifier', 'Pattern.Any Entity - Extractor', 'Closed List Entity Extractor', 'Regex Entity Extractor' + Extractor', 'Child Entity Extractor', 'Hierarchical Entity Extractor', + 'Hierarchical Child Entity Extractor', 'Composite Entity Extractor', 'List + Entity Extractor', 'Prebuilt Entity Extractor', 'Intent Classifier', + 'Pattern.Any Entity Extractor', 'Closed List Entity Extractor', 'Regex + Entity Extractor' :type readable_type: str or ~azure.cognitiveservices.language.luis.authoring.models.enum """ @@ -927,10 +1000,11 @@ class EntityModelInfo(ModelInfo): :param type_id: The type ID of the Entity Model. :type type_id: int :param readable_type: Required. Possible values include: 'Entity - Extractor', 'Hierarchical Entity Extractor', 'Hierarchical Child Entity - Extractor', 'Composite Entity Extractor', 'List Entity Extractor', - 'Prebuilt Entity Extractor', 'Intent Classifier', 'Pattern.Any Entity - Extractor', 'Closed List Entity Extractor', 'Regex Entity Extractor' + Extractor', 'Child Entity Extractor', 'Hierarchical Entity Extractor', + 'Hierarchical Child Entity Extractor', 'Composite Entity Extractor', 'List + Entity Extractor', 'Prebuilt Entity Extractor', 'Intent Classifier', + 'Pattern.Any Entity Extractor', 'Closed List Entity Extractor', 'Regex + Entity Extractor' :type readable_type: str or ~azure.cognitiveservices.language.luis.authoring.models.enum :param roles: @@ -956,6 +1030,26 @@ def __init__(self, **kwargs): self.roles = kwargs.get('roles', None) +class EntityModelUpdateObject(Model): + """An entity extractor update object. + + :param name: Entity name. + :type name: str + :param instance_of: The instance of model name + :type instance_of: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'instance_of': {'key': 'instanceOf', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(EntityModelUpdateObject, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.instance_of = kwargs.get('instance_of', None) + + class EntityPrediction(Model): """A suggested entity. @@ -1168,12 +1262,16 @@ class FeatureInfoObject(Model): :type name: str :param is_active: Indicates if the feature is enabled. :type is_active: bool + :param enabled_for_all_models: Indicates if the feature is enabled for all + models in the application. + :type enabled_for_all_models: bool """ _attribute_map = { 'id': {'key': 'id', 'type': 'int'}, 'name': {'key': 'name', 'type': 'str'}, 'is_active': {'key': 'isActive', 'type': 'bool'}, + 'enabled_for_all_models': {'key': 'enabledForAllModels', 'type': 'bool'}, } def __init__(self, **kwargs): @@ -1181,6 +1279,7 @@ def __init__(self, **kwargs): self.id = kwargs.get('id', None) self.name = kwargs.get('name', None) self.is_active = kwargs.get('is_active', None) + self.enabled_for_all_models = kwargs.get('enabled_for_all_models', None) class FeaturesResponseObject(Model): @@ -1214,15 +1313,20 @@ class HierarchicalChildEntity(ChildEntity): :type id: str :param name: The name of a child entity. :type name: str + :param instance_of: Instance of Model. + :type instance_of: str :param type_id: The type ID of the Entity Model. :type type_id: int - :param readable_type: Possible values include: 'Entity Extractor', - 'Hierarchical Entity Extractor', 'Hierarchical Child Entity Extractor', - 'Composite Entity Extractor', 'List Entity Extractor', 'Prebuilt Entity - Extractor', 'Intent Classifier', 'Pattern.Any Entity Extractor', 'Closed - List Entity Extractor', 'Regex Entity Extractor' + :param readable_type: Possible values include: 'Entity Extractor', 'Child + Entity Extractor', 'Hierarchical Entity Extractor', 'Hierarchical Child + Entity Extractor', 'Composite Entity Extractor', 'List Entity Extractor', + 'Prebuilt Entity Extractor', 'Intent Classifier', 'Pattern.Any Entity + Extractor', 'Closed List Entity Extractor', 'Regex Entity Extractor' :type readable_type: str or ~azure.cognitiveservices.language.luis.authoring.models.enum + :param children: List of children + :type children: + list[~azure.cognitiveservices.language.luis.authoring.models.ChildEntity] """ _validation = { @@ -1232,30 +1336,14 @@ class HierarchicalChildEntity(ChildEntity): _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, + 'instance_of': {'key': 'instanceOf', 'type': 'str'}, 'type_id': {'key': 'typeId', 'type': 'int'}, 'readable_type': {'key': 'readableType', 'type': 'str'}, + 'children': {'key': 'children', 'type': '[ChildEntity]'}, } def __init__(self, **kwargs): super(HierarchicalChildEntity, self).__init__(**kwargs) - self.type_id = kwargs.get('type_id', None) - self.readable_type = kwargs.get('readable_type', None) - - -class HierarchicalChildModelCreateObject(Model): - """HierarchicalChildModelCreateObject. - - :param name: - :type name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(HierarchicalChildModelCreateObject, self).__init__(**kwargs) - self.name = kwargs.get('name', None) class HierarchicalChildModelUpdateObject(Model): @@ -1286,10 +1374,11 @@ class HierarchicalEntityExtractor(Model): :param type_id: The type ID of the Entity Model. :type type_id: int :param readable_type: Required. Possible values include: 'Entity - Extractor', 'Hierarchical Entity Extractor', 'Hierarchical Child Entity - Extractor', 'Composite Entity Extractor', 'List Entity Extractor', - 'Prebuilt Entity Extractor', 'Intent Classifier', 'Pattern.Any Entity - Extractor', 'Closed List Entity Extractor', 'Regex Entity Extractor' + Extractor', 'Child Entity Extractor', 'Hierarchical Entity Extractor', + 'Hierarchical Child Entity Extractor', 'Composite Entity Extractor', 'List + Entity Extractor', 'Prebuilt Entity Extractor', 'Intent Classifier', + 'Pattern.Any Entity Extractor', 'Closed List Entity Extractor', 'Regex + Entity Extractor' :type readable_type: str or ~azure.cognitiveservices.language.luis.authoring.models.enum :param roles: @@ -1324,26 +1413,6 @@ def __init__(self, **kwargs): self.children = kwargs.get('children', None) -class HierarchicalEntityModel(Model): - """A hierarchical entity extractor. - - :param children: Child entities. - :type children: list[str] - :param name: Entity name. - :type name: str - """ - - _attribute_map = { - 'children': {'key': 'children', 'type': '[str]'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(HierarchicalEntityModel, self).__init__(**kwargs) - self.children = kwargs.get('children', None) - self.name = kwargs.get('name', None) - - class HierarchicalModel(Model): """HierarchicalModel. @@ -1385,10 +1454,11 @@ class IntentClassifier(ModelInfo): :param type_id: The type ID of the Entity Model. :type type_id: int :param readable_type: Required. Possible values include: 'Entity - Extractor', 'Hierarchical Entity Extractor', 'Hierarchical Child Entity - Extractor', 'Composite Entity Extractor', 'List Entity Extractor', - 'Prebuilt Entity Extractor', 'Intent Classifier', 'Pattern.Any Entity - Extractor', 'Closed List Entity Extractor', 'Regex Entity Extractor' + Extractor', 'Child Entity Extractor', 'Hierarchical Entity Extractor', + 'Hierarchical Child Entity Extractor', 'Composite Entity Extractor', 'List + Entity Extractor', 'Prebuilt Entity Extractor', 'Intent Classifier', + 'Pattern.Any Entity Extractor', 'Closed List Entity Extractor', 'Regex + Entity Extractor' :type readable_type: str or ~azure.cognitiveservices.language.luis.authoring.models.enum :param custom_prebuilt_domain_name: The domain name. @@ -1481,7 +1551,7 @@ class JSONEntity(Model): :type end_pos: int :param entity: Required. The entity name. :type entity: str - :param role: The role of the entity within the utterance. + :param role: The role the entity plays in the utterance. :type role: str """ @@ -1779,6 +1849,27 @@ def __init__(self, **kwargs): self.name = kwargs.get('name', None) +class ModelFeatureInformation(Model): + """An object containing the model feature information either the model name or + feature name. + + :param model_name: The name of the model used. + :type model_name: str + :param feature_name: The name of the feature used. + :type feature_name: str + """ + + _attribute_map = { + 'model_name': {'key': 'modelName', 'type': 'str'}, + 'feature_name': {'key': 'featureName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ModelFeatureInformation, self).__init__(**kwargs) + self.model_name = kwargs.get('model_name', None) + self.feature_name = kwargs.get('feature_name', None) + + class ModelInfoResponse(Model): """An application model info. @@ -1791,10 +1882,11 @@ class ModelInfoResponse(Model): :param type_id: The type ID of the Entity Model. :type type_id: int :param readable_type: Required. Possible values include: 'Entity - Extractor', 'Hierarchical Entity Extractor', 'Hierarchical Child Entity - Extractor', 'Composite Entity Extractor', 'List Entity Extractor', - 'Prebuilt Entity Extractor', 'Intent Classifier', 'Pattern.Any Entity - Extractor', 'Closed List Entity Extractor', 'Regex Entity Extractor' + Extractor', 'Child Entity Extractor', 'Hierarchical Entity Extractor', + 'Hierarchical Child Entity Extractor', 'Composite Entity Extractor', 'List + Entity Extractor', 'Prebuilt Entity Extractor', 'Intent Classifier', + 'Pattern.Any Entity Extractor', 'Closed List Entity Extractor', 'Regex + Entity Extractor' :type readable_type: str or ~azure.cognitiveservices.language.luis.authoring.models.enum :param roles: @@ -1922,6 +2014,65 @@ def __init__(self, **kwargs): self.name = kwargs.get('name', None) +class NDepthEntityExtractor(Model): + """N-Depth Entity Extractor. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The ID of the Entity Model. + :type id: str + :param name: Name of the Entity Model. + :type name: str + :param type_id: The type ID of the Entity Model. + :type type_id: int + :param readable_type: Required. Possible values include: 'Entity + Extractor', 'Child Entity Extractor', 'Hierarchical Entity Extractor', + 'Hierarchical Child Entity Extractor', 'Composite Entity Extractor', 'List + Entity Extractor', 'Prebuilt Entity Extractor', 'Intent Classifier', + 'Pattern.Any Entity Extractor', 'Closed List Entity Extractor', 'Regex + Entity Extractor' + :type readable_type: str or + ~azure.cognitiveservices.language.luis.authoring.models.enum + :param roles: + :type roles: + list[~azure.cognitiveservices.language.luis.authoring.models.EntityRole] + :param custom_prebuilt_domain_name: The domain name. + :type custom_prebuilt_domain_name: str + :param custom_prebuilt_model_name: The intent name or entity name. + :type custom_prebuilt_model_name: str + :param children: + :type children: + list[~azure.cognitiveservices.language.luis.authoring.models.ChildEntity] + """ + + _validation = { + 'id': {'required': True}, + 'readable_type': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type_id': {'key': 'typeId', 'type': 'int'}, + 'readable_type': {'key': 'readableType', 'type': 'str'}, + 'roles': {'key': 'roles', 'type': '[EntityRole]'}, + 'custom_prebuilt_domain_name': {'key': 'customPrebuiltDomainName', 'type': 'str'}, + 'custom_prebuilt_model_name': {'key': 'customPrebuiltModelName', 'type': 'str'}, + 'children': {'key': 'children', 'type': '[ChildEntity]'}, + } + + def __init__(self, **kwargs): + super(NDepthEntityExtractor, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.type_id = kwargs.get('type_id', None) + self.readable_type = kwargs.get('readable_type', None) + self.roles = kwargs.get('roles', None) + self.custom_prebuilt_domain_name = kwargs.get('custom_prebuilt_domain_name', None) + self.custom_prebuilt_model_name = kwargs.get('custom_prebuilt_model_name', None) + self.children = kwargs.get('children', None) + + class OperationError(Model): """Operation error details when invoking an operation on the API. @@ -2000,10 +2151,11 @@ class PatternAnyEntityExtractor(Model): :param type_id: The type ID of the Entity Model. :type type_id: int :param readable_type: Required. Possible values include: 'Entity - Extractor', 'Hierarchical Entity Extractor', 'Hierarchical Child Entity - Extractor', 'Composite Entity Extractor', 'List Entity Extractor', - 'Prebuilt Entity Extractor', 'Intent Classifier', 'Pattern.Any Entity - Extractor', 'Closed List Entity Extractor', 'Regex Entity Extractor' + Extractor', 'Child Entity Extractor', 'Hierarchical Entity Extractor', + 'Hierarchical Child Entity Extractor', 'Composite Entity Extractor', 'List + Entity Extractor', 'Prebuilt Entity Extractor', 'Intent Classifier', + 'Pattern.Any Entity Extractor', 'Closed List Entity Extractor', 'Regex + Entity Extractor' :type readable_type: str or ~azure.cognitiveservices.language.luis.authoring.models.enum :param roles: @@ -2078,26 +2230,6 @@ def __init__(self, **kwargs): self.explicit_list = kwargs.get('explicit_list', None) -class PatternCreateObject(Model): - """Object model for creating a Pattern feature. - - :param pattern: The Regular Expression to match. - :type pattern: str - :param name: Name of the feature. - :type name: str - """ - - _attribute_map = { - 'pattern': {'key': 'pattern', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(PatternCreateObject, self).__init__(**kwargs) - self.pattern = kwargs.get('pattern', None) - self.name = kwargs.get('name', None) - - class PatternFeatureInfo(FeatureInfoObject): """Pattern feature. @@ -2107,6 +2239,9 @@ class PatternFeatureInfo(FeatureInfoObject): :type name: str :param is_active: Indicates if the feature is enabled. :type is_active: bool + :param enabled_for_all_models: Indicates if the feature is enabled for all + models in the application. + :type enabled_for_all_models: bool :param pattern: The Regular Expression to match. :type pattern: str """ @@ -2115,6 +2250,7 @@ class PatternFeatureInfo(FeatureInfoObject): 'id': {'key': 'id', 'type': 'int'}, 'name': {'key': 'name', 'type': 'str'}, 'is_active': {'key': 'isActive', 'type': 'bool'}, + 'enabled_for_all_models': {'key': 'enabledForAllModels', 'type': 'bool'}, 'pattern': {'key': 'pattern', 'type': 'str'}, } @@ -2211,31 +2347,6 @@ def __init__(self, **kwargs): self.intent = kwargs.get('intent', None) -class PatternUpdateObject(Model): - """Object model for updating an existing Pattern feature. - - :param pattern: The Regular Expression to match. - :type pattern: str - :param name: Name of the feature. - :type name: str - :param is_active: Indicates if the Pattern feature is enabled. Default - value: True . - :type is_active: bool - """ - - _attribute_map = { - 'pattern': {'key': 'pattern', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'is_active': {'key': 'isActive', 'type': 'bool'}, - } - - def __init__(self, **kwargs): - super(PatternUpdateObject, self).__init__(**kwargs) - self.pattern = kwargs.get('pattern', None) - self.name = kwargs.get('name', None) - self.is_active = kwargs.get('is_active', True) - - class PersonalAssistantsResponse(Model): """Response containing user's endpoint keys and the endpoint URLs of the prebuilt Cortana applications. @@ -2298,6 +2409,9 @@ class PhraseListFeatureInfo(FeatureInfoObject): :type name: str :param is_active: Indicates if the feature is enabled. :type is_active: bool + :param enabled_for_all_models: Indicates if the feature is enabled for all + models in the application. + :type enabled_for_all_models: bool :param phrases: A list of comma-separated values. :type phrases: str :param is_exchangeable: An exchangeable phrase list feature are serves as @@ -2318,6 +2432,7 @@ class PhraseListFeatureInfo(FeatureInfoObject): 'id': {'key': 'id', 'type': 'int'}, 'name': {'key': 'name', 'type': 'str'}, 'is_active': {'key': 'isActive', 'type': 'bool'}, + 'enabled_for_all_models': {'key': 'enabledForAllModels', 'type': 'bool'}, 'phrases': {'key': 'phrases', 'type': 'str'}, 'is_exchangeable': {'key': 'isExchangeable', 'type': 'bool'}, } @@ -2351,6 +2466,9 @@ class PhraselistUpdateObject(Model): existing vocabulary features. Think of a non-exchangeable as set of different words. Default value is true. Default value: True . :type is_exchangeable: bool + :param enabled_for_all_models: Indicates if the Phraselist is enabled for + all models in the application. Default value: True . + :type enabled_for_all_models: bool """ _attribute_map = { @@ -2358,6 +2476,7 @@ class PhraselistUpdateObject(Model): 'name': {'key': 'name', 'type': 'str'}, 'is_active': {'key': 'isActive', 'type': 'bool'}, 'is_exchangeable': {'key': 'isExchangeable', 'type': 'bool'}, + 'enabled_for_all_models': {'key': 'enabledForAllModels', 'type': 'bool'}, } def __init__(self, **kwargs): @@ -2366,6 +2485,7 @@ def __init__(self, **kwargs): self.name = kwargs.get('name', None) self.is_active = kwargs.get('is_active', True) self.is_exchangeable = kwargs.get('is_exchangeable', True) + self.enabled_for_all_models = kwargs.get('enabled_for_all_models', True) class PrebuiltDomain(Model): @@ -2541,10 +2661,11 @@ class PrebuiltEntityExtractor(Model): :param type_id: The type ID of the Entity Model. :type type_id: int :param readable_type: Required. Possible values include: 'Entity - Extractor', 'Hierarchical Entity Extractor', 'Hierarchical Child Entity - Extractor', 'Composite Entity Extractor', 'List Entity Extractor', - 'Prebuilt Entity Extractor', 'Intent Classifier', 'Pattern.Any Entity - Extractor', 'Closed List Entity Extractor', 'Regex Entity Extractor' + Extractor', 'Child Entity Extractor', 'Hierarchical Entity Extractor', + 'Hierarchical Child Entity Extractor', 'Composite Entity Extractor', 'List + Entity Extractor', 'Prebuilt Entity Extractor', 'Intent Classifier', + 'Pattern.Any Entity Extractor', 'Closed List Entity Extractor', 'Regex + Entity Extractor' :type readable_type: str or ~azure.cognitiveservices.language.luis.authoring.models.enum :param roles: @@ -2713,10 +2834,11 @@ class RegexEntityExtractor(Model): :param type_id: The type ID of the Entity Model. :type type_id: int :param readable_type: Required. Possible values include: 'Entity - Extractor', 'Hierarchical Entity Extractor', 'Hierarchical Child Entity - Extractor', 'Composite Entity Extractor', 'List Entity Extractor', - 'Prebuilt Entity Extractor', 'Intent Classifier', 'Pattern.Any Entity - Extractor', 'Closed List Entity Extractor', 'Regex Entity Extractor' + Extractor', 'Child Entity Extractor', 'Hierarchical Entity Extractor', + 'Hierarchical Child Entity Extractor', 'Composite Entity Extractor', 'List + Entity Extractor', 'Prebuilt Entity Extractor', 'Intent Classifier', + 'Pattern.Any Entity Extractor', 'Closed List Entity Extractor', 'Regex + Entity Extractor' :type readable_type: str or ~azure.cognitiveservices.language.luis.authoring.models.enum :param roles: diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/_models_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/_models_py3.py index 3a78500b5f8e..c13552d93685 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/_models_py3.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/_models_py3.py @@ -336,6 +336,20 @@ class ChildEntity(Model): :type id: str :param name: The name of a child entity. :type name: str + :param instance_of: Instance of Model. + :type instance_of: str + :param type_id: The type ID of the Entity Model. + :type type_id: int + :param readable_type: Possible values include: 'Entity Extractor', 'Child + Entity Extractor', 'Hierarchical Entity Extractor', 'Hierarchical Child + Entity Extractor', 'Composite Entity Extractor', 'List Entity Extractor', + 'Prebuilt Entity Extractor', 'Intent Classifier', 'Pattern.Any Entity + Extractor', 'Closed List Entity Extractor', 'Regex Entity Extractor' + :type readable_type: str or + ~azure.cognitiveservices.language.luis.authoring.models.enum + :param children: List of children + :type children: + list[~azure.cognitiveservices.language.luis.authoring.models.ChildEntity] """ _validation = { @@ -345,12 +359,45 @@ class ChildEntity(Model): _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, + 'instance_of': {'key': 'instanceOf', 'type': 'str'}, + 'type_id': {'key': 'typeId', 'type': 'int'}, + 'readable_type': {'key': 'readableType', 'type': 'str'}, + 'children': {'key': 'children', 'type': '[ChildEntity]'}, } - def __init__(self, *, id: str, name: str=None, **kwargs) -> None: + def __init__(self, *, id: str, name: str=None, instance_of: str=None, type_id: int=None, readable_type=None, children=None, **kwargs) -> None: super(ChildEntity, self).__init__(**kwargs) self.id = id self.name = name + self.instance_of = instance_of + self.type_id = type_id + self.readable_type = readable_type + self.children = children + + +class ChildEntityModelCreateObject(Model): + """A child entity extractor create object. + + :param children: Child entities. + :type children: + list[~azure.cognitiveservices.language.luis.authoring.models.ChildEntityModelCreateObject] + :param name: Entity name. + :type name: str + :param instance_of: The instance of model name + :type instance_of: str + """ + + _attribute_map = { + 'children': {'key': 'children', 'type': '[ChildEntityModelCreateObject]'}, + 'name': {'key': 'name', 'type': 'str'}, + 'instance_of': {'key': 'instanceOf', 'type': 'str'}, + } + + def __init__(self, *, children=None, name: str=None, instance_of: str=None, **kwargs) -> None: + super(ChildEntityModelCreateObject, self).__init__(**kwargs) + self.children = children + self.name = name + self.instance_of = instance_of class ClosedList(Model): @@ -390,10 +437,11 @@ class ClosedListEntityExtractor(Model): :param type_id: The type ID of the Entity Model. :type type_id: int :param readable_type: Required. Possible values include: 'Entity - Extractor', 'Hierarchical Entity Extractor', 'Hierarchical Child Entity - Extractor', 'Composite Entity Extractor', 'List Entity Extractor', - 'Prebuilt Entity Extractor', 'Intent Classifier', 'Pattern.Any Entity - Extractor', 'Closed List Entity Extractor', 'Regex Entity Extractor' + Extractor', 'Child Entity Extractor', 'Hierarchical Entity Extractor', + 'Hierarchical Child Entity Extractor', 'Composite Entity Extractor', 'List + Entity Extractor', 'Prebuilt Entity Extractor', 'Intent Classifier', + 'Pattern.Any Entity Extractor', 'Closed List Entity Extractor', 'Regex + Entity Extractor' :type readable_type: str or ~azure.cognitiveservices.language.luis.authoring.models.enum :param roles: @@ -531,10 +579,11 @@ class CompositeEntityExtractor(Model): :param type_id: The type ID of the Entity Model. :type type_id: int :param readable_type: Required. Possible values include: 'Entity - Extractor', 'Hierarchical Entity Extractor', 'Hierarchical Child Entity - Extractor', 'Composite Entity Extractor', 'List Entity Extractor', - 'Prebuilt Entity Extractor', 'Intent Classifier', 'Pattern.Any Entity - Extractor', 'Closed List Entity Extractor', 'Regex Entity Extractor' + Extractor', 'Child Entity Extractor', 'Hierarchical Entity Extractor', + 'Hierarchical Child Entity Extractor', 'Composite Entity Extractor', 'List + Entity Extractor', 'Prebuilt Entity Extractor', 'Intent Classifier', + 'Pattern.Any Entity Extractor', 'Closed List Entity Extractor', 'Regex + Entity Extractor' :type readable_type: str or ~azure.cognitiveservices.language.luis.authoring.models.enum :param roles: @@ -601,10 +650,11 @@ class CustomPrebuiltModel(Model): :param type_id: The type ID of the Entity Model. :type type_id: int :param readable_type: Required. Possible values include: 'Entity - Extractor', 'Hierarchical Entity Extractor', 'Hierarchical Child Entity - Extractor', 'Composite Entity Extractor', 'List Entity Extractor', - 'Prebuilt Entity Extractor', 'Intent Classifier', 'Pattern.Any Entity - Extractor', 'Closed List Entity Extractor', 'Regex Entity Extractor' + Extractor', 'Child Entity Extractor', 'Hierarchical Entity Extractor', + 'Hierarchical Child Entity Extractor', 'Composite Entity Extractor', 'List + Entity Extractor', 'Prebuilt Entity Extractor', 'Intent Classifier', + 'Pattern.Any Entity Extractor', 'Closed List Entity Extractor', 'Regex + Entity Extractor' :type readable_type: str or ~azure.cognitiveservices.language.luis.authoring.models.enum :param custom_prebuilt_domain_name: The domain name. @@ -752,10 +802,11 @@ class EntityExtractor(Model): :param type_id: The type ID of the Entity Model. :type type_id: int :param readable_type: Required. Possible values include: 'Entity - Extractor', 'Hierarchical Entity Extractor', 'Hierarchical Child Entity - Extractor', 'Composite Entity Extractor', 'List Entity Extractor', - 'Prebuilt Entity Extractor', 'Intent Classifier', 'Pattern.Any Entity - Extractor', 'Closed List Entity Extractor', 'Regex Entity Extractor' + Extractor', 'Child Entity Extractor', 'Hierarchical Entity Extractor', + 'Hierarchical Child Entity Extractor', 'Composite Entity Extractor', 'List + Entity Extractor', 'Prebuilt Entity Extractor', 'Intent Classifier', + 'Pattern.Any Entity Extractor', 'Closed List Entity Extractor', 'Regex + Entity Extractor' :type readable_type: str or ~azure.cognitiveservices.language.luis.authoring.models.enum :param roles: @@ -807,9 +858,9 @@ class EntityLabel(Model): :param end_token_index: Required. The index within the utterance where the extracted entity ends. :type end_token_index: int - :param role: The role of the entity within the utterance. + :param role: The role of the predicted entity. :type role: str - :param role_id: The role Id. + :param role_id: The role id for the predicted entity. :type role_id: str """ @@ -850,7 +901,7 @@ class EntityLabelObject(Model): :param end_char_index: Required. The index within the utterance where the extracted entity ends. :type end_char_index: int - :param role: The role of the entity within the utterance. + :param role: The role the entity plays in the utterance. :type role: str """ @@ -875,6 +926,27 @@ def __init__(self, *, entity_name: str, start_char_index: int, end_char_index: i self.role = role +class EntityModelCreateObject(Model): + """An entity extractor create object. + + :param children: Child entities. + :type children: + list[~azure.cognitiveservices.language.luis.authoring.models.ChildEntityModelCreateObject] + :param name: Entity name. + :type name: str + """ + + _attribute_map = { + 'children': {'key': 'children', 'type': '[ChildEntityModelCreateObject]'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, *, children=None, name: str=None, **kwargs) -> None: + super(EntityModelCreateObject, self).__init__(**kwargs) + self.children = children + self.name = name + + class ModelInfo(Model): """Base type used in entity types. @@ -887,10 +959,11 @@ class ModelInfo(Model): :param type_id: The type ID of the Entity Model. :type type_id: int :param readable_type: Required. Possible values include: 'Entity - Extractor', 'Hierarchical Entity Extractor', 'Hierarchical Child Entity - Extractor', 'Composite Entity Extractor', 'List Entity Extractor', - 'Prebuilt Entity Extractor', 'Intent Classifier', 'Pattern.Any Entity - Extractor', 'Closed List Entity Extractor', 'Regex Entity Extractor' + Extractor', 'Child Entity Extractor', 'Hierarchical Entity Extractor', + 'Hierarchical Child Entity Extractor', 'Composite Entity Extractor', 'List + Entity Extractor', 'Prebuilt Entity Extractor', 'Intent Classifier', + 'Pattern.Any Entity Extractor', 'Closed List Entity Extractor', 'Regex + Entity Extractor' :type readable_type: str or ~azure.cognitiveservices.language.luis.authoring.models.enum """ @@ -927,10 +1000,11 @@ class EntityModelInfo(ModelInfo): :param type_id: The type ID of the Entity Model. :type type_id: int :param readable_type: Required. Possible values include: 'Entity - Extractor', 'Hierarchical Entity Extractor', 'Hierarchical Child Entity - Extractor', 'Composite Entity Extractor', 'List Entity Extractor', - 'Prebuilt Entity Extractor', 'Intent Classifier', 'Pattern.Any Entity - Extractor', 'Closed List Entity Extractor', 'Regex Entity Extractor' + Extractor', 'Child Entity Extractor', 'Hierarchical Entity Extractor', + 'Hierarchical Child Entity Extractor', 'Composite Entity Extractor', 'List + Entity Extractor', 'Prebuilt Entity Extractor', 'Intent Classifier', + 'Pattern.Any Entity Extractor', 'Closed List Entity Extractor', 'Regex + Entity Extractor' :type readable_type: str or ~azure.cognitiveservices.language.luis.authoring.models.enum :param roles: @@ -956,6 +1030,26 @@ def __init__(self, *, id: str, readable_type, name: str=None, type_id: int=None, self.roles = roles +class EntityModelUpdateObject(Model): + """An entity extractor update object. + + :param name: Entity name. + :type name: str + :param instance_of: The instance of model name + :type instance_of: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'instance_of': {'key': 'instanceOf', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, instance_of: str=None, **kwargs) -> None: + super(EntityModelUpdateObject, self).__init__(**kwargs) + self.name = name + self.instance_of = instance_of + + class EntityPrediction(Model): """A suggested entity. @@ -1168,19 +1262,24 @@ class FeatureInfoObject(Model): :type name: str :param is_active: Indicates if the feature is enabled. :type is_active: bool + :param enabled_for_all_models: Indicates if the feature is enabled for all + models in the application. + :type enabled_for_all_models: bool """ _attribute_map = { 'id': {'key': 'id', 'type': 'int'}, 'name': {'key': 'name', 'type': 'str'}, 'is_active': {'key': 'isActive', 'type': 'bool'}, + 'enabled_for_all_models': {'key': 'enabledForAllModels', 'type': 'bool'}, } - def __init__(self, *, id: int=None, name: str=None, is_active: bool=None, **kwargs) -> None: + def __init__(self, *, id: int=None, name: str=None, is_active: bool=None, enabled_for_all_models: bool=None, **kwargs) -> None: super(FeatureInfoObject, self).__init__(**kwargs) self.id = id self.name = name self.is_active = is_active + self.enabled_for_all_models = enabled_for_all_models class FeaturesResponseObject(Model): @@ -1214,15 +1313,20 @@ class HierarchicalChildEntity(ChildEntity): :type id: str :param name: The name of a child entity. :type name: str + :param instance_of: Instance of Model. + :type instance_of: str :param type_id: The type ID of the Entity Model. :type type_id: int - :param readable_type: Possible values include: 'Entity Extractor', - 'Hierarchical Entity Extractor', 'Hierarchical Child Entity Extractor', - 'Composite Entity Extractor', 'List Entity Extractor', 'Prebuilt Entity - Extractor', 'Intent Classifier', 'Pattern.Any Entity Extractor', 'Closed - List Entity Extractor', 'Regex Entity Extractor' + :param readable_type: Possible values include: 'Entity Extractor', 'Child + Entity Extractor', 'Hierarchical Entity Extractor', 'Hierarchical Child + Entity Extractor', 'Composite Entity Extractor', 'List Entity Extractor', + 'Prebuilt Entity Extractor', 'Intent Classifier', 'Pattern.Any Entity + Extractor', 'Closed List Entity Extractor', 'Regex Entity Extractor' :type readable_type: str or ~azure.cognitiveservices.language.luis.authoring.models.enum + :param children: List of children + :type children: + list[~azure.cognitiveservices.language.luis.authoring.models.ChildEntity] """ _validation = { @@ -1232,30 +1336,14 @@ class HierarchicalChildEntity(ChildEntity): _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, + 'instance_of': {'key': 'instanceOf', 'type': 'str'}, 'type_id': {'key': 'typeId', 'type': 'int'}, 'readable_type': {'key': 'readableType', 'type': 'str'}, + 'children': {'key': 'children', 'type': '[ChildEntity]'}, } - def __init__(self, *, id: str, name: str=None, type_id: int=None, readable_type=None, **kwargs) -> None: - super(HierarchicalChildEntity, self).__init__(id=id, name=name, **kwargs) - self.type_id = type_id - self.readable_type = readable_type - - -class HierarchicalChildModelCreateObject(Model): - """HierarchicalChildModelCreateObject. - - :param name: - :type name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__(self, *, name: str=None, **kwargs) -> None: - super(HierarchicalChildModelCreateObject, self).__init__(**kwargs) - self.name = name + def __init__(self, *, id: str, name: str=None, instance_of: str=None, type_id: int=None, readable_type=None, children=None, **kwargs) -> None: + super(HierarchicalChildEntity, self).__init__(id=id, name=name, instance_of=instance_of, type_id=type_id, readable_type=readable_type, children=children, **kwargs) class HierarchicalChildModelUpdateObject(Model): @@ -1286,10 +1374,11 @@ class HierarchicalEntityExtractor(Model): :param type_id: The type ID of the Entity Model. :type type_id: int :param readable_type: Required. Possible values include: 'Entity - Extractor', 'Hierarchical Entity Extractor', 'Hierarchical Child Entity - Extractor', 'Composite Entity Extractor', 'List Entity Extractor', - 'Prebuilt Entity Extractor', 'Intent Classifier', 'Pattern.Any Entity - Extractor', 'Closed List Entity Extractor', 'Regex Entity Extractor' + Extractor', 'Child Entity Extractor', 'Hierarchical Entity Extractor', + 'Hierarchical Child Entity Extractor', 'Composite Entity Extractor', 'List + Entity Extractor', 'Prebuilt Entity Extractor', 'Intent Classifier', + 'Pattern.Any Entity Extractor', 'Closed List Entity Extractor', 'Regex + Entity Extractor' :type readable_type: str or ~azure.cognitiveservices.language.luis.authoring.models.enum :param roles: @@ -1324,26 +1413,6 @@ def __init__(self, *, id: str, readable_type, name: str=None, type_id: int=None, self.children = children -class HierarchicalEntityModel(Model): - """A hierarchical entity extractor. - - :param children: Child entities. - :type children: list[str] - :param name: Entity name. - :type name: str - """ - - _attribute_map = { - 'children': {'key': 'children', 'type': '[str]'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__(self, *, children=None, name: str=None, **kwargs) -> None: - super(HierarchicalEntityModel, self).__init__(**kwargs) - self.children = children - self.name = name - - class HierarchicalModel(Model): """HierarchicalModel. @@ -1385,10 +1454,11 @@ class IntentClassifier(ModelInfo): :param type_id: The type ID of the Entity Model. :type type_id: int :param readable_type: Required. Possible values include: 'Entity - Extractor', 'Hierarchical Entity Extractor', 'Hierarchical Child Entity - Extractor', 'Composite Entity Extractor', 'List Entity Extractor', - 'Prebuilt Entity Extractor', 'Intent Classifier', 'Pattern.Any Entity - Extractor', 'Closed List Entity Extractor', 'Regex Entity Extractor' + Extractor', 'Child Entity Extractor', 'Hierarchical Entity Extractor', + 'Hierarchical Child Entity Extractor', 'Composite Entity Extractor', 'List + Entity Extractor', 'Prebuilt Entity Extractor', 'Intent Classifier', + 'Pattern.Any Entity Extractor', 'Closed List Entity Extractor', 'Regex + Entity Extractor' :type readable_type: str or ~azure.cognitiveservices.language.luis.authoring.models.enum :param custom_prebuilt_domain_name: The domain name. @@ -1481,7 +1551,7 @@ class JSONEntity(Model): :type end_pos: int :param entity: Required. The entity name. :type entity: str - :param role: The role of the entity within the utterance. + :param role: The role the entity plays in the utterance. :type role: str """ @@ -1779,6 +1849,27 @@ def __init__(self, *, name: str=None, **kwargs) -> None: self.name = name +class ModelFeatureInformation(Model): + """An object containing the model feature information either the model name or + feature name. + + :param model_name: The name of the model used. + :type model_name: str + :param feature_name: The name of the feature used. + :type feature_name: str + """ + + _attribute_map = { + 'model_name': {'key': 'modelName', 'type': 'str'}, + 'feature_name': {'key': 'featureName', 'type': 'str'}, + } + + def __init__(self, *, model_name: str=None, feature_name: str=None, **kwargs) -> None: + super(ModelFeatureInformation, self).__init__(**kwargs) + self.model_name = model_name + self.feature_name = feature_name + + class ModelInfoResponse(Model): """An application model info. @@ -1791,10 +1882,11 @@ class ModelInfoResponse(Model): :param type_id: The type ID of the Entity Model. :type type_id: int :param readable_type: Required. Possible values include: 'Entity - Extractor', 'Hierarchical Entity Extractor', 'Hierarchical Child Entity - Extractor', 'Composite Entity Extractor', 'List Entity Extractor', - 'Prebuilt Entity Extractor', 'Intent Classifier', 'Pattern.Any Entity - Extractor', 'Closed List Entity Extractor', 'Regex Entity Extractor' + Extractor', 'Child Entity Extractor', 'Hierarchical Entity Extractor', + 'Hierarchical Child Entity Extractor', 'Composite Entity Extractor', 'List + Entity Extractor', 'Prebuilt Entity Extractor', 'Intent Classifier', + 'Pattern.Any Entity Extractor', 'Closed List Entity Extractor', 'Regex + Entity Extractor' :type readable_type: str or ~azure.cognitiveservices.language.luis.authoring.models.enum :param roles: @@ -1922,6 +2014,65 @@ def __init__(self, *, name: str=None, **kwargs) -> None: self.name = name +class NDepthEntityExtractor(Model): + """N-Depth Entity Extractor. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The ID of the Entity Model. + :type id: str + :param name: Name of the Entity Model. + :type name: str + :param type_id: The type ID of the Entity Model. + :type type_id: int + :param readable_type: Required. Possible values include: 'Entity + Extractor', 'Child Entity Extractor', 'Hierarchical Entity Extractor', + 'Hierarchical Child Entity Extractor', 'Composite Entity Extractor', 'List + Entity Extractor', 'Prebuilt Entity Extractor', 'Intent Classifier', + 'Pattern.Any Entity Extractor', 'Closed List Entity Extractor', 'Regex + Entity Extractor' + :type readable_type: str or + ~azure.cognitiveservices.language.luis.authoring.models.enum + :param roles: + :type roles: + list[~azure.cognitiveservices.language.luis.authoring.models.EntityRole] + :param custom_prebuilt_domain_name: The domain name. + :type custom_prebuilt_domain_name: str + :param custom_prebuilt_model_name: The intent name or entity name. + :type custom_prebuilt_model_name: str + :param children: + :type children: + list[~azure.cognitiveservices.language.luis.authoring.models.ChildEntity] + """ + + _validation = { + 'id': {'required': True}, + 'readable_type': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type_id': {'key': 'typeId', 'type': 'int'}, + 'readable_type': {'key': 'readableType', 'type': 'str'}, + 'roles': {'key': 'roles', 'type': '[EntityRole]'}, + 'custom_prebuilt_domain_name': {'key': 'customPrebuiltDomainName', 'type': 'str'}, + 'custom_prebuilt_model_name': {'key': 'customPrebuiltModelName', 'type': 'str'}, + 'children': {'key': 'children', 'type': '[ChildEntity]'}, + } + + def __init__(self, *, id: str, readable_type, name: str=None, type_id: int=None, roles=None, custom_prebuilt_domain_name: str=None, custom_prebuilt_model_name: str=None, children=None, **kwargs) -> None: + super(NDepthEntityExtractor, self).__init__(**kwargs) + self.id = id + self.name = name + self.type_id = type_id + self.readable_type = readable_type + self.roles = roles + self.custom_prebuilt_domain_name = custom_prebuilt_domain_name + self.custom_prebuilt_model_name = custom_prebuilt_model_name + self.children = children + + class OperationError(Model): """Operation error details when invoking an operation on the API. @@ -2000,10 +2151,11 @@ class PatternAnyEntityExtractor(Model): :param type_id: The type ID of the Entity Model. :type type_id: int :param readable_type: Required. Possible values include: 'Entity - Extractor', 'Hierarchical Entity Extractor', 'Hierarchical Child Entity - Extractor', 'Composite Entity Extractor', 'List Entity Extractor', - 'Prebuilt Entity Extractor', 'Intent Classifier', 'Pattern.Any Entity - Extractor', 'Closed List Entity Extractor', 'Regex Entity Extractor' + Extractor', 'Child Entity Extractor', 'Hierarchical Entity Extractor', + 'Hierarchical Child Entity Extractor', 'Composite Entity Extractor', 'List + Entity Extractor', 'Prebuilt Entity Extractor', 'Intent Classifier', + 'Pattern.Any Entity Extractor', 'Closed List Entity Extractor', 'Regex + Entity Extractor' :type readable_type: str or ~azure.cognitiveservices.language.luis.authoring.models.enum :param roles: @@ -2078,26 +2230,6 @@ def __init__(self, *, name: str=None, explicit_list=None, **kwargs) -> None: self.explicit_list = explicit_list -class PatternCreateObject(Model): - """Object model for creating a Pattern feature. - - :param pattern: The Regular Expression to match. - :type pattern: str - :param name: Name of the feature. - :type name: str - """ - - _attribute_map = { - 'pattern': {'key': 'pattern', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__(self, *, pattern: str=None, name: str=None, **kwargs) -> None: - super(PatternCreateObject, self).__init__(**kwargs) - self.pattern = pattern - self.name = name - - class PatternFeatureInfo(FeatureInfoObject): """Pattern feature. @@ -2107,6 +2239,9 @@ class PatternFeatureInfo(FeatureInfoObject): :type name: str :param is_active: Indicates if the feature is enabled. :type is_active: bool + :param enabled_for_all_models: Indicates if the feature is enabled for all + models in the application. + :type enabled_for_all_models: bool :param pattern: The Regular Expression to match. :type pattern: str """ @@ -2115,11 +2250,12 @@ class PatternFeatureInfo(FeatureInfoObject): 'id': {'key': 'id', 'type': 'int'}, 'name': {'key': 'name', 'type': 'str'}, 'is_active': {'key': 'isActive', 'type': 'bool'}, + 'enabled_for_all_models': {'key': 'enabledForAllModels', 'type': 'bool'}, 'pattern': {'key': 'pattern', 'type': 'str'}, } - def __init__(self, *, id: int=None, name: str=None, is_active: bool=None, pattern: str=None, **kwargs) -> None: - super(PatternFeatureInfo, self).__init__(id=id, name=name, is_active=is_active, **kwargs) + def __init__(self, *, id: int=None, name: str=None, is_active: bool=None, enabled_for_all_models: bool=None, pattern: str=None, **kwargs) -> None: + super(PatternFeatureInfo, self).__init__(id=id, name=name, is_active=is_active, enabled_for_all_models=enabled_for_all_models, **kwargs) self.pattern = pattern @@ -2211,31 +2347,6 @@ def __init__(self, *, id: str=None, pattern: str=None, intent: str=None, **kwarg self.intent = intent -class PatternUpdateObject(Model): - """Object model for updating an existing Pattern feature. - - :param pattern: The Regular Expression to match. - :type pattern: str - :param name: Name of the feature. - :type name: str - :param is_active: Indicates if the Pattern feature is enabled. Default - value: True . - :type is_active: bool - """ - - _attribute_map = { - 'pattern': {'key': 'pattern', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'is_active': {'key': 'isActive', 'type': 'bool'}, - } - - def __init__(self, *, pattern: str=None, name: str=None, is_active: bool=True, **kwargs) -> None: - super(PatternUpdateObject, self).__init__(**kwargs) - self.pattern = pattern - self.name = name - self.is_active = is_active - - class PersonalAssistantsResponse(Model): """Response containing user's endpoint keys and the endpoint URLs of the prebuilt Cortana applications. @@ -2298,6 +2409,9 @@ class PhraseListFeatureInfo(FeatureInfoObject): :type name: str :param is_active: Indicates if the feature is enabled. :type is_active: bool + :param enabled_for_all_models: Indicates if the feature is enabled for all + models in the application. + :type enabled_for_all_models: bool :param phrases: A list of comma-separated values. :type phrases: str :param is_exchangeable: An exchangeable phrase list feature are serves as @@ -2318,12 +2432,13 @@ class PhraseListFeatureInfo(FeatureInfoObject): 'id': {'key': 'id', 'type': 'int'}, 'name': {'key': 'name', 'type': 'str'}, 'is_active': {'key': 'isActive', 'type': 'bool'}, + 'enabled_for_all_models': {'key': 'enabledForAllModels', 'type': 'bool'}, 'phrases': {'key': 'phrases', 'type': 'str'}, 'is_exchangeable': {'key': 'isExchangeable', 'type': 'bool'}, } - def __init__(self, *, id: int=None, name: str=None, is_active: bool=None, phrases: str=None, is_exchangeable: bool=None, **kwargs) -> None: - super(PhraseListFeatureInfo, self).__init__(id=id, name=name, is_active=is_active, **kwargs) + def __init__(self, *, id: int=None, name: str=None, is_active: bool=None, enabled_for_all_models: bool=None, phrases: str=None, is_exchangeable: bool=None, **kwargs) -> None: + super(PhraseListFeatureInfo, self).__init__(id=id, name=name, is_active=is_active, enabled_for_all_models=enabled_for_all_models, **kwargs) self.phrases = phrases self.is_exchangeable = is_exchangeable @@ -2351,6 +2466,9 @@ class PhraselistUpdateObject(Model): existing vocabulary features. Think of a non-exchangeable as set of different words. Default value is true. Default value: True . :type is_exchangeable: bool + :param enabled_for_all_models: Indicates if the Phraselist is enabled for + all models in the application. Default value: True . + :type enabled_for_all_models: bool """ _attribute_map = { @@ -2358,14 +2476,16 @@ class PhraselistUpdateObject(Model): 'name': {'key': 'name', 'type': 'str'}, 'is_active': {'key': 'isActive', 'type': 'bool'}, 'is_exchangeable': {'key': 'isExchangeable', 'type': 'bool'}, + 'enabled_for_all_models': {'key': 'enabledForAllModels', 'type': 'bool'}, } - def __init__(self, *, phrases: str=None, name: str=None, is_active: bool=True, is_exchangeable: bool=True, **kwargs) -> None: + def __init__(self, *, phrases: str=None, name: str=None, is_active: bool=True, is_exchangeable: bool=True, enabled_for_all_models: bool=True, **kwargs) -> None: super(PhraselistUpdateObject, self).__init__(**kwargs) self.phrases = phrases self.name = name self.is_active = is_active self.is_exchangeable = is_exchangeable + self.enabled_for_all_models = enabled_for_all_models class PrebuiltDomain(Model): @@ -2541,10 +2661,11 @@ class PrebuiltEntityExtractor(Model): :param type_id: The type ID of the Entity Model. :type type_id: int :param readable_type: Required. Possible values include: 'Entity - Extractor', 'Hierarchical Entity Extractor', 'Hierarchical Child Entity - Extractor', 'Composite Entity Extractor', 'List Entity Extractor', - 'Prebuilt Entity Extractor', 'Intent Classifier', 'Pattern.Any Entity - Extractor', 'Closed List Entity Extractor', 'Regex Entity Extractor' + Extractor', 'Child Entity Extractor', 'Hierarchical Entity Extractor', + 'Hierarchical Child Entity Extractor', 'Composite Entity Extractor', 'List + Entity Extractor', 'Prebuilt Entity Extractor', 'Intent Classifier', + 'Pattern.Any Entity Extractor', 'Closed List Entity Extractor', 'Regex + Entity Extractor' :type readable_type: str or ~azure.cognitiveservices.language.luis.authoring.models.enum :param roles: @@ -2713,10 +2834,11 @@ class RegexEntityExtractor(Model): :param type_id: The type ID of the Entity Model. :type type_id: int :param readable_type: Required. Possible values include: 'Entity - Extractor', 'Hierarchical Entity Extractor', 'Hierarchical Child Entity - Extractor', 'Composite Entity Extractor', 'List Entity Extractor', - 'Prebuilt Entity Extractor', 'Intent Classifier', 'Pattern.Any Entity - Extractor', 'Closed List Entity Extractor', 'Regex Entity Extractor' + Extractor', 'Child Entity Extractor', 'Hierarchical Entity Extractor', + 'Hierarchical Child Entity Extractor', 'Composite Entity Extractor', 'List + Entity Extractor', 'Prebuilt Entity Extractor', 'Intent Classifier', + 'Pattern.Any Entity Extractor', 'Closed List Entity Extractor', 'Regex + Entity Extractor' :type readable_type: str or ~azure.cognitiveservices.language.luis.authoring.models.enum :param roles: diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/_features_operations.py b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/_features_operations.py index edf56aad0006..1b7b477b3311 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/_features_operations.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/_features_operations.py @@ -35,72 +35,6 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def list_application_version_pattern_features( - self, app_id, version_id, skip=0, take=100, custom_headers=None, raw=False, **operation_config): - """[DEPRECATED NOTICE: This operation will soon be removed] Gets all the - pattern features. - - :param app_id: The application ID. - :type app_id: str - :param version_id: The version ID. - :type version_id: str - :param skip: The number of entries to skip. Default value is 0. - :type skip: int - :param take: The number of entries to return. Maximum page size is - 500. Default is 100. - :type take: int - :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: list or ClientRawResponse if raw=true - :rtype: - list[~azure.cognitiveservices.language.luis.authoring.models.PatternFeatureInfo] - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = self.list_application_version_pattern_features.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'), - 'versionId': self._serialize.url("version_id", version_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if skip is not None: - query_parameters['skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if take is not None: - query_parameters['take'] = self._serialize.query("take", take, 'int', maximum=500, minimum=0) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if custom_headers: - header_parameters.update(custom_headers) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('[PatternFeatureInfo]', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - list_application_version_pattern_features.metadata = {'url': '/apps/{appId}/versions/{versionId}/patterns'} - def add_phrase_list( self, app_id, version_id, phraselist_create_object, custom_headers=None, raw=False, **operation_config): """Creates a new phraselist feature in a version of the application. @@ -485,3 +419,143 @@ def delete_phrase_list( return deserialized delete_phrase_list.metadata = {'url': '/apps/{appId}/versions/{versionId}/phraselists/{phraselistId}'} + + def add_intent_feature( + self, app_id, version_id, intent_id, model_name=None, feature_name=None, custom_headers=None, raw=False, **operation_config): + """Adds a new feature relation to be used by the intent in a version of + the application. + + :param app_id: The application ID. + :type app_id: str + :param version_id: The version ID. + :type version_id: str + :param intent_id: The intent classifier ID. + :type intent_id: str + :param model_name: The name of the model used. + :type model_name: str + :param feature_name: The name of the feature used. + :type feature_name: str + :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: OperationStatus or ClientRawResponse if raw=true + :rtype: + ~azure.cognitiveservices.language.luis.authoring.models.OperationStatus + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + feature_relation_create_object = models.ModelFeatureInformation(model_name=model_name, feature_name=feature_name) + + # Construct URL + url = self.add_intent_feature.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'), + 'versionId': self._serialize.url("version_id", version_id, 'str'), + 'intentId': self._serialize.url("intent_id", intent_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # 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(feature_relation_create_object, 'ModelFeatureInformation') + + # 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.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationStatus', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + add_intent_feature.metadata = {'url': '/apps/{appId}/versions/{versionId}/intents/{intentId}/features'} + + def add_entity_feature( + self, app_id, version_id, entity_id, model_name=None, feature_name=None, custom_headers=None, raw=False, **operation_config): + """Adds a new feature relation to be used by the entity in a version of + the application. + + :param app_id: The application ID. + :type app_id: str + :param version_id: The version ID. + :type version_id: str + :param entity_id: The entity extractor ID. + :type entity_id: str + :param model_name: The name of the model used. + :type model_name: str + :param feature_name: The name of the feature used. + :type feature_name: str + :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: OperationStatus or ClientRawResponse if raw=true + :rtype: + ~azure.cognitiveservices.language.luis.authoring.models.OperationStatus + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + feature_relation_create_object = models.ModelFeatureInformation(model_name=model_name, feature_name=feature_name) + + # Construct URL + url = self.add_entity_feature.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'), + 'versionId': self._serialize.url("version_id", version_id, 'str'), + 'entityId': self._serialize.url("entity_id", entity_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # 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(feature_relation_create_object, 'ModelFeatureInformation') + + # 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.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationStatus', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + add_entity_feature.metadata = {'url': '/apps/{appId}/versions/{versionId}/entities/{entityId}/features'} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/_model_operations.py b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/_model_operations.py index 1cebef17b8a1..d3ced6fec0c8 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/_model_operations.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/_model_operations.py @@ -164,14 +164,17 @@ def list_intents( list_intents.metadata = {'url': '/apps/{appId}/versions/{versionId}/intents'} def add_entity( - self, app_id, version_id, name=None, custom_headers=None, raw=False, **operation_config): - """Adds a simple entity extractor to a version of the application. + self, app_id, version_id, children=None, name=None, custom_headers=None, raw=False, **operation_config): + """Adds an entity extractor to a version of the application. :param app_id: The application ID. :type app_id: str :param version_id: The version ID. :type version_id: str - :param name: Name of the new entity extractor. + :param children: Child entities. + :type children: + list[~azure.cognitiveservices.language.luis.authoring.models.ChildEntityModelCreateObject] + :param name: Entity name. :type name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the @@ -183,7 +186,7 @@ def add_entity( :raises: :class:`ErrorResponseException` """ - model_create_object = models.ModelCreateObject(name=name) + entity_model_create_object = models.EntityModelCreateObject(children=children, name=name) # Construct URL url = self.add_entity.metadata['url'] @@ -205,7 +208,7 @@ def add_entity( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(model_create_object, 'ModelCreateObject') + body_content = self._serialize.body(entity_model_create_object, 'EntityModelCreateObject') # Construct and send request request = self._client.post(url, query_parameters, header_parameters, body_content) @@ -246,7 +249,7 @@ def list_entities( overrides`. :return: list or ClientRawResponse if raw=true :rtype: - list[~azure.cognitiveservices.language.luis.authoring.models.EntityExtractor] + list[~azure.cognitiveservices.language.luis.authoring.models.NDepthEntityExtractor] or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` @@ -282,7 +285,7 @@ def list_entities( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('[EntityExtractor]', response) + deserialized = self._deserialize('[NDepthEntityExtractor]', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -291,32 +294,34 @@ def list_entities( return deserialized list_entities.metadata = {'url': '/apps/{appId}/versions/{versionId}/entities'} - def add_hierarchical_entity( - self, app_id, version_id, children=None, name=None, custom_headers=None, raw=False, **operation_config): - """Adds a hierarchical entity extractor to a version of the application. + def list_hierarchical_entities( + self, app_id, version_id, skip=0, take=100, custom_headers=None, raw=False, **operation_config): + """Gets information about all the hierarchical entity models in a version + of the application. :param app_id: The application ID. :type app_id: str :param version_id: The version ID. :type version_id: str - :param children: Child entities. - :type children: list[str] - :param name: Entity name. - :type name: str + :param skip: The number of entries to skip. Default value is 0. + :type skip: int + :param take: The number of entries to return. Maximum page size is + 500. Default is 100. + :type take: int :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: str or ClientRawResponse if raw=true - :rtype: str or ~msrest.pipeline.ClientRawResponse + :return: list or ClientRawResponse if raw=true + :rtype: + list[~azure.cognitiveservices.language.luis.authoring.models.HierarchicalEntityExtractor] + or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ - hierarchical_model_create_object = models.HierarchicalEntityModel(children=children, name=name) - # Construct URL - url = self.add_hierarchical_entity.metadata['url'] + url = self.list_hierarchical_entities.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'), @@ -326,39 +331,105 @@ def add_hierarchical_entity( # Construct parameters query_parameters = {} + if skip is not None: + query_parameters['skip'] = self._serialize.query("skip", skip, 'int', minimum=0) + if take is not None: + query_parameters['take'] = self._serialize.query("take", take, 'int', maximum=500, minimum=0) # 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(hierarchical_model_create_object, 'HierarchicalEntityModel') + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('[HierarchicalEntityExtractor]', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_hierarchical_entities.metadata = {'url': '/apps/{appId}/versions/{versionId}/hierarchicalentities'} + + def list_composite_entities( + self, app_id, version_id, skip=0, take=100, custom_headers=None, raw=False, **operation_config): + """Gets information about all the composite entity models in a version of + the application. + + :param app_id: The application ID. + :type app_id: str + :param version_id: The version ID. + :type version_id: str + :param skip: The number of entries to skip. Default value is 0. + :type skip: int + :param take: The number of entries to return. Maximum page size is + 500. Default is 100. + :type take: int + :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: list or ClientRawResponse if raw=true + :rtype: + list[~azure.cognitiveservices.language.luis.authoring.models.CompositeEntityExtractor] + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_composite_entities.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'), + 'versionId': self._serialize.url("version_id", version_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if skip is not None: + query_parameters['skip'] = self._serialize.query("skip", skip, 'int', minimum=0) + if take is not None: + query_parameters['take'] = self._serialize.query("take", take, 'int', maximum=500, minimum=0) + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) + request = self._client.get(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [201]: + if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) deserialized = None - if response.status_code == 201: - deserialized = self._deserialize('str', response) + if response.status_code == 200: + deserialized = self._deserialize('[CompositeEntityExtractor]', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - add_hierarchical_entity.metadata = {'url': '/apps/{appId}/versions/{versionId}/hierarchicalentities'} + list_composite_entities.metadata = {'url': '/apps/{appId}/versions/{versionId}/compositeentities'} - def list_hierarchical_entities( + def list_closed_lists( self, app_id, version_id, skip=0, take=100, custom_headers=None, raw=False, **operation_config): - """Gets information about all the hierarchical entity models in a version - of the application. + """Gets information about all the list entity models in a version of the + application. :param app_id: The application ID. :type app_id: str @@ -376,13 +447,13 @@ def list_hierarchical_entities( overrides`. :return: list or ClientRawResponse if raw=true :rtype: - list[~azure.cognitiveservices.language.luis.authoring.models.HierarchicalEntityExtractor] + list[~azure.cognitiveservices.language.luis.authoring.models.ClosedListEntityExtractor] or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = self.list_hierarchical_entities.metadata['url'] + url = self.list_closed_lists.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'), @@ -412,26 +483,27 @@ def list_hierarchical_entities( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('[HierarchicalEntityExtractor]', response) + deserialized = self._deserialize('[ClosedListEntityExtractor]', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - list_hierarchical_entities.metadata = {'url': '/apps/{appId}/versions/{versionId}/hierarchicalentities'} + list_closed_lists.metadata = {'url': '/apps/{appId}/versions/{versionId}/closedlists'} - def add_composite_entity( - self, app_id, version_id, children=None, name=None, custom_headers=None, raw=False, **operation_config): - """Adds a composite entity extractor to a version of the application. + def add_closed_list( + self, app_id, version_id, sub_lists=None, name=None, custom_headers=None, raw=False, **operation_config): + """Adds a list entity model to a version of the application. :param app_id: The application ID. :type app_id: str :param version_id: The version ID. :type version_id: str - :param children: Child entities. - :type children: list[str] - :param name: Entity name. + :param sub_lists: Sublists for the feature. + :type sub_lists: + list[~azure.cognitiveservices.language.luis.authoring.models.WordListObject] + :param name: Name of the list entity. :type name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the @@ -443,10 +515,10 @@ def add_composite_entity( :raises: :class:`ErrorResponseException` """ - composite_model_create_object = models.CompositeEntityModel(children=children, name=name) + closed_list_model_create_object = models.ClosedListModelCreateObject(sub_lists=sub_lists, name=name) # Construct URL - url = self.add_composite_entity.metadata['url'] + url = self.add_closed_list.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'), @@ -465,7 +537,7 @@ def add_composite_entity( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(composite_model_create_object, 'CompositeEntityModel') + body_content = self._serialize.body(closed_list_model_create_object, 'ClosedListModelCreateObject') # Construct and send request request = self._client.post(url, query_parameters, header_parameters, body_content) @@ -483,12 +555,75 @@ def add_composite_entity( return client_raw_response return deserialized - add_composite_entity.metadata = {'url': '/apps/{appId}/versions/{versionId}/compositeentities'} + add_closed_list.metadata = {'url': '/apps/{appId}/versions/{versionId}/closedlists'} - def list_composite_entities( + def add_prebuilt( + self, app_id, version_id, prebuilt_extractor_names, custom_headers=None, raw=False, **operation_config): + """Adds a list of prebuilt entities to a version of the application. + + :param app_id: The application ID. + :type app_id: str + :param version_id: The version ID. + :type version_id: str + :param prebuilt_extractor_names: An array of prebuilt entity extractor + names. + :type prebuilt_extractor_names: list[str] + :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: list or ClientRawResponse if raw=true + :rtype: + list[~azure.cognitiveservices.language.luis.authoring.models.PrebuiltEntityExtractor] + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.add_prebuilt.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'), + 'versionId': self._serialize.url("version_id", version_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # 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(prebuilt_extractor_names, '[str]') + + # 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 [201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 201: + deserialized = self._deserialize('[PrebuiltEntityExtractor]', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + add_prebuilt.metadata = {'url': '/apps/{appId}/versions/{versionId}/prebuilts'} + + def list_prebuilts( self, app_id, version_id, skip=0, take=100, custom_headers=None, raw=False, **operation_config): - """Gets information about all the composite entity models in a version of - the application. + """Gets information about all the prebuilt entities in a version of the + application. :param app_id: The application ID. :type app_id: str @@ -506,13 +641,13 @@ def list_composite_entities( overrides`. :return: list or ClientRawResponse if raw=true :rtype: - list[~azure.cognitiveservices.language.luis.authoring.models.CompositeEntityExtractor] + list[~azure.cognitiveservices.language.luis.authoring.models.PrebuiltEntityExtractor] or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = self.list_composite_entities.metadata['url'] + url = self.list_prebuilts.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'), @@ -542,20 +677,77 @@ def list_composite_entities( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('[CompositeEntityExtractor]', response) + deserialized = self._deserialize('[PrebuiltEntityExtractor]', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - list_composite_entities.metadata = {'url': '/apps/{appId}/versions/{versionId}/compositeentities'} + list_prebuilts.metadata = {'url': '/apps/{appId}/versions/{versionId}/prebuilts'} - def list_closed_lists( - self, app_id, version_id, skip=0, take=100, custom_headers=None, raw=False, **operation_config): - """Gets information about all the list entity models in a version of the + def list_prebuilt_entities( + self, app_id, version_id, custom_headers=None, raw=False, **operation_config): + """Gets all the available prebuilt entities in a version of the application. + :param app_id: The application ID. + :type app_id: str + :param version_id: The version ID. + :type version_id: str + :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: list or ClientRawResponse if raw=true + :rtype: + list[~azure.cognitiveservices.language.luis.authoring.models.AvailablePrebuiltEntityModel] + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_prebuilt_entities.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'), + 'versionId': self._serialize.url("version_id", version_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('[AvailablePrebuiltEntityModel]', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_prebuilt_entities.metadata = {'url': '/apps/{appId}/versions/{versionId}/listprebuilts'} + + def list_models( + self, app_id, version_id, skip=0, take=100, custom_headers=None, raw=False, **operation_config): + """Gets information about all the intent and entity models in a version of + the application. + :param app_id: The application ID. :type app_id: str :param version_id: The version ID. @@ -572,13 +764,13 @@ def list_closed_lists( overrides`. :return: list or ClientRawResponse if raw=true :rtype: - list[~azure.cognitiveservices.language.luis.authoring.models.ClosedListEntityExtractor] + list[~azure.cognitiveservices.language.luis.authoring.models.ModelInfoResponse] or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = self.list_closed_lists.metadata['url'] + url = self.list_models.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'), @@ -608,109 +800,177 @@ def list_closed_lists( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('[ClosedListEntityExtractor]', response) + deserialized = self._deserialize('[ModelInfoResponse]', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - list_closed_lists.metadata = {'url': '/apps/{appId}/versions/{versionId}/closedlists'} + list_models.metadata = {'url': '/apps/{appId}/versions/{versionId}/models'} - def add_closed_list( - self, app_id, version_id, sub_lists=None, name=None, custom_headers=None, raw=False, **operation_config): - """Adds a list entity model to a version of the application. + def examples_method( + self, app_id, version_id, model_id, skip=0, take=100, custom_headers=None, raw=False, **operation_config): + """Gets the example utterances for the given intent or entity model in a + version of the application. :param app_id: The application ID. :type app_id: str :param version_id: The version ID. :type version_id: str - :param sub_lists: Sublists for the feature. - :type sub_lists: - list[~azure.cognitiveservices.language.luis.authoring.models.WordListObject] - :param name: Name of the list entity. - :type name: str + :param model_id: The ID (GUID) of the model. + :type model_id: str + :param skip: The number of entries to skip. Default value is 0. + :type skip: int + :param take: The number of entries to return. Maximum page size is + 500. Default is 100. + :type take: int :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: str or ClientRawResponse if raw=true - :rtype: str or ~msrest.pipeline.ClientRawResponse + :return: list or ClientRawResponse if raw=true + :rtype: + list[~azure.cognitiveservices.language.luis.authoring.models.LabelTextObject] + or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ - closed_list_model_create_object = models.ClosedListModelCreateObject(sub_lists=sub_lists, name=name) - # Construct URL - url = self.add_closed_list.metadata['url'] + url = self.examples_method.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'), - 'versionId': self._serialize.url("version_id", version_id, 'str') + 'versionId': self._serialize.url("version_id", version_id, 'str'), + 'modelId': self._serialize.url("model_id", model_id, 'str') } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} + if skip is not None: + query_parameters['skip'] = self._serialize.query("skip", skip, 'int', minimum=0) + if take is not None: + query_parameters['take'] = self._serialize.query("take", take, 'int', maximum=500, minimum=0) # 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(closed_list_model_create_object, 'ClosedListModelCreateObject') + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('[LabelTextObject]', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + examples_method.metadata = {'url': '/apps/{appId}/versions/{versionId}/models/{modelId}/examples'} + + def get_intent( + self, app_id, version_id, intent_id, custom_headers=None, raw=False, **operation_config): + """Gets information about the intent model in a version of the + application. + + :param app_id: The application ID. + :type app_id: str + :param version_id: The version ID. + :type version_id: str + :param intent_id: The intent classifier ID. + :type intent_id: str + :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: IntentClassifier or ClientRawResponse if raw=true + :rtype: + ~azure.cognitiveservices.language.luis.authoring.models.IntentClassifier + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_intent.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'), + 'versionId': self._serialize.url("version_id", version_id, 'str'), + 'intentId': self._serialize.url("intent_id", intent_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) + request = self._client.get(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [201]: + if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) deserialized = None - if response.status_code == 201: - deserialized = self._deserialize('str', response) + if response.status_code == 200: + deserialized = self._deserialize('IntentClassifier', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - add_closed_list.metadata = {'url': '/apps/{appId}/versions/{versionId}/closedlists'} + get_intent.metadata = {'url': '/apps/{appId}/versions/{versionId}/intents/{intentId}'} - def add_prebuilt( - self, app_id, version_id, prebuilt_extractor_names, custom_headers=None, raw=False, **operation_config): - """Adds a list of prebuilt entities to a version of the application. + def update_intent( + self, app_id, version_id, intent_id, name=None, custom_headers=None, raw=False, **operation_config): + """Updates the name of an intent in a version of the application. :param app_id: The application ID. :type app_id: str :param version_id: The version ID. :type version_id: str - :param prebuilt_extractor_names: An array of prebuilt entity extractor - names. - :type prebuilt_extractor_names: list[str] + :param intent_id: The intent classifier ID. + :type intent_id: str + :param name: The entity's new name. + :type name: str :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: list or ClientRawResponse if raw=true + :return: OperationStatus or ClientRawResponse if raw=true :rtype: - list[~azure.cognitiveservices.language.luis.authoring.models.PrebuiltEntityExtractor] + ~azure.cognitiveservices.language.luis.authoring.models.OperationStatus or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ + model_update_object = models.ModelUpdateObject(name=name) + # Construct URL - url = self.add_prebuilt.metadata['url'] + url = self.update_intent.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'), - 'versionId': self._serialize.url("version_id", version_id, 'str') + 'versionId': self._serialize.url("version_id", version_id, 'str'), + 'intentId': self._serialize.url("intent_id", intent_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -725,67 +985,66 @@ def add_prebuilt( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(prebuilt_extractor_names, '[str]') + body_content = self._serialize.body(model_update_object, 'ModelUpdateObject') # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) + request = self._client.put(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [201]: + if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) deserialized = None - if response.status_code == 201: - deserialized = self._deserialize('[PrebuiltEntityExtractor]', response) + if response.status_code == 200: + deserialized = self._deserialize('OperationStatus', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - add_prebuilt.metadata = {'url': '/apps/{appId}/versions/{versionId}/prebuilts'} + update_intent.metadata = {'url': '/apps/{appId}/versions/{versionId}/intents/{intentId}'} - def list_prebuilts( - self, app_id, version_id, skip=0, take=100, custom_headers=None, raw=False, **operation_config): - """Gets information about all the prebuilt entities in a version of the - application. + def delete_intent( + self, app_id, version_id, intent_id, delete_utterances=False, custom_headers=None, raw=False, **operation_config): + """Deletes an intent from a version of the application. :param app_id: The application ID. :type app_id: str :param version_id: The version ID. :type version_id: str - :param skip: The number of entries to skip. Default value is 0. - :type skip: int - :param take: The number of entries to return. Maximum page size is - 500. Default is 100. - :type take: int + :param intent_id: The intent classifier ID. + :type intent_id: str + :param delete_utterances: If true, deletes the intent's example + utterances. If false, moves the example utterances to the None intent. + The default value is false. + :type delete_utterances: 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: list or ClientRawResponse if raw=true + :return: OperationStatus or ClientRawResponse if raw=true :rtype: - list[~azure.cognitiveservices.language.luis.authoring.models.PrebuiltEntityExtractor] + ~azure.cognitiveservices.language.luis.authoring.models.OperationStatus or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = self.list_prebuilts.metadata['url'] + url = self.delete_intent.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'), - 'versionId': self._serialize.url("version_id", version_id, 'str') + 'versionId': self._serialize.url("version_id", version_id, 'str'), + 'intentId': self._serialize.url("intent_id", intent_id, 'str') } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} - if skip is not None: - query_parameters['skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if take is not None: - query_parameters['take'] = self._serialize.query("take", take, 'int', maximum=500, minimum=0) + if delete_utterances is not None: + query_parameters['deleteUtterances'] = self._serialize.query("delete_utterances", delete_utterances, 'bool') # Construct headers header_parameters = {} @@ -794,7 +1053,7 @@ def list_prebuilts( header_parameters.update(custom_headers) # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.delete(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: @@ -802,42 +1061,44 @@ def list_prebuilts( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('[PrebuiltEntityExtractor]', response) + deserialized = self._deserialize('OperationStatus', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - list_prebuilts.metadata = {'url': '/apps/{appId}/versions/{versionId}/prebuilts'} + delete_intent.metadata = {'url': '/apps/{appId}/versions/{versionId}/intents/{intentId}'} - def list_prebuilt_entities( - self, app_id, version_id, custom_headers=None, raw=False, **operation_config): - """Gets all the available prebuilt entities in a version of the - application. + def get_entity( + self, app_id, version_id, entity_id, custom_headers=None, raw=False, **operation_config): + """Gets information about an entity model in a version of the application. :param app_id: The application ID. :type app_id: str :param version_id: The version ID. :type version_id: str + :param entity_id: The entity extractor ID. + :type entity_id: str :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: list or ClientRawResponse if raw=true + :return: NDepthEntityExtractor or ClientRawResponse if raw=true :rtype: - list[~azure.cognitiveservices.language.luis.authoring.models.AvailablePrebuiltEntityModel] + ~azure.cognitiveservices.language.luis.authoring.models.NDepthEntityExtractor or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = self.list_prebuilt_entities.metadata['url'] + url = self.get_entity.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'), - 'versionId': self._serialize.url("version_id", version_id, 'str') + 'versionId': self._serialize.url("version_id", version_id, 'str'), + 'entityId': self._serialize.url("entity_id", entity_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -859,56 +1120,50 @@ def list_prebuilt_entities( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('[AvailablePrebuiltEntityModel]', response) + deserialized = self._deserialize('NDepthEntityExtractor', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - list_prebuilt_entities.metadata = {'url': '/apps/{appId}/versions/{versionId}/listprebuilts'} + get_entity.metadata = {'url': '/apps/{appId}/versions/{versionId}/entities/{entityId}'} - def list_models( - self, app_id, version_id, skip=0, take=100, custom_headers=None, raw=False, **operation_config): - """Gets information about all the intent and entity models in a version of - the application. + def delete_entity( + self, app_id, version_id, entity_id, custom_headers=None, raw=False, **operation_config): + """Deletes an entity or a child from a version of the application. :param app_id: The application ID. :type app_id: str :param version_id: The version ID. :type version_id: str - :param skip: The number of entries to skip. Default value is 0. - :type skip: int - :param take: The number of entries to return. Maximum page size is - 500. Default is 100. - :type take: int + :param entity_id: The entity extractor or the child entity extractor + ID. + :type entity_id: str :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: list or ClientRawResponse if raw=true + :return: OperationStatus or ClientRawResponse if raw=true :rtype: - list[~azure.cognitiveservices.language.luis.authoring.models.ModelInfoResponse] + ~azure.cognitiveservices.language.luis.authoring.models.OperationStatus or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = self.list_models.metadata['url'] + url = self.delete_entity.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'), - 'versionId': self._serialize.url("version_id", version_id, 'str') + 'versionId': self._serialize.url("version_id", version_id, 'str'), + 'entityId': self._serialize.url("entity_id", entity_id, 'str') } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} - if skip is not None: - query_parameters['skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if take is not None: - query_parameters['take'] = self._serialize.query("take", take, 'int', maximum=500, minimum=0) # Construct headers header_parameters = {} @@ -917,7 +1172,7 @@ def list_models( header_parameters.update(custom_headers) # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.delete(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: @@ -925,68 +1180,70 @@ def list_models( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('[ModelInfoResponse]', response) + deserialized = self._deserialize('OperationStatus', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - list_models.metadata = {'url': '/apps/{appId}/versions/{versionId}/models'} + delete_entity.metadata = {'url': '/apps/{appId}/versions/{versionId}/entities/{entityId}'} - def examples_method( - self, app_id, version_id, model_id, skip=0, take=100, custom_headers=None, raw=False, **operation_config): - """Gets the example utterances for the given intent or entity model in a - version of the application. + def update_entity_child( + self, app_id, version_id, entity_id, name=None, instance_of=None, custom_headers=None, raw=False, **operation_config): + """Updates the name of an entity extractor or the name and instanceOf + model of a child entity extractor. :param app_id: The application ID. :type app_id: str :param version_id: The version ID. :type version_id: str - :param model_id: The ID (GUID) of the model. - :type model_id: str - :param skip: The number of entries to skip. Default value is 0. - :type skip: int - :param take: The number of entries to return. Maximum page size is - 500. Default is 100. - :type take: int + :param entity_id: The entity extractor or the child entity extractor + ID. + :type entity_id: str + :param name: Entity name. + :type name: str + :param instance_of: The instance of model name + :type instance_of: str :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: list or ClientRawResponse if raw=true + :return: OperationStatus or ClientRawResponse if raw=true :rtype: - list[~azure.cognitiveservices.language.luis.authoring.models.LabelTextObject] + ~azure.cognitiveservices.language.luis.authoring.models.OperationStatus or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ + entity_model_update_object = models.EntityModelUpdateObject(name=name, instance_of=instance_of) + # Construct URL - url = self.examples_method.metadata['url'] + url = self.update_entity_child.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'), 'versionId': self._serialize.url("version_id", version_id, 'str'), - 'modelId': self._serialize.url("model_id", model_id, 'str') + 'entityId': self._serialize.url("entity_id", entity_id, 'str') } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} - if skip is not None: - query_parameters['skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if take is not None: - query_parameters['take'] = self._serialize.query("take", take, 'int', maximum=500, minimum=0) # 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(entity_model_update_object, 'EntityModelUpdateObject') + # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.patch(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: @@ -994,19 +1251,19 @@ def examples_method( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('[LabelTextObject]', response) + deserialized = self._deserialize('OperationStatus', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - examples_method.metadata = {'url': '/apps/{appId}/versions/{versionId}/models/{modelId}/examples'} + update_entity_child.metadata = {'url': '/apps/{appId}/versions/{versionId}/entities/{entityId}'} - def get_intent( + def get_intent_features( self, app_id, version_id, intent_id, custom_headers=None, raw=False, **operation_config): - """Gets information about the intent model in a version of the - application. + """Gets the information of the features used by the intent in a version of + the application. :param app_id: The application ID. :type app_id: str @@ -1019,15 +1276,15 @@ def get_intent( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: IntentClassifier or ClientRawResponse if raw=true + :return: list or ClientRawResponse if raw=true :rtype: - ~azure.cognitiveservices.language.luis.authoring.models.IntentClassifier + list[~azure.cognitiveservices.language.luis.authoring.models.ModelFeatureInformation] or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = self.get_intent.metadata['url'] + url = self.get_intent_features.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'), @@ -1054,18 +1311,19 @@ def get_intent( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('IntentClassifier', response) + deserialized = self._deserialize('[ModelFeatureInformation]', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - get_intent.metadata = {'url': '/apps/{appId}/versions/{versionId}/intents/{intentId}'} + get_intent_features.metadata = {'url': '/apps/{appId}/versions/{versionId}/intents/{intentId}/features'} - def update_intent( - self, app_id, version_id, intent_id, name=None, custom_headers=None, raw=False, **operation_config): - """Updates the name of an intent in a version of the application. + def replace_intent_features( + self, app_id, version_id, intent_id, feature_relations_update_object, custom_headers=None, raw=False, **operation_config): + """Updates the information of the features used by the intent in a version + of the application. :param app_id: The application ID. :type app_id: str @@ -1073,8 +1331,10 @@ def update_intent( :type version_id: str :param intent_id: The intent classifier ID. :type intent_id: str - :param name: The entity's new name. - :type name: str + :param feature_relations_update_object: A list of feature information + objects containing the new feature relations. + :type feature_relations_update_object: + list[~azure.cognitiveservices.language.luis.authoring.models.ModelFeatureInformation] :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -1087,10 +1347,8 @@ def update_intent( :raises: :class:`ErrorResponseException` """ - model_update_object = models.ModelUpdateObject(name=name) - # Construct URL - url = self.update_intent.metadata['url'] + url = self.replace_intent_features.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'), @@ -1110,7 +1368,7 @@ def update_intent( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(model_update_object, 'ModelUpdateObject') + body_content = self._serialize.body(feature_relations_update_object, '[ModelFeatureInformation]') # Construct and send request request = self._client.put(url, query_parameters, header_parameters, body_content) @@ -1128,11 +1386,12 @@ def update_intent( return client_raw_response return deserialized - update_intent.metadata = {'url': '/apps/{appId}/versions/{versionId}/intents/{intentId}'} + replace_intent_features.metadata = {'url': '/apps/{appId}/versions/{versionId}/intents/{intentId}/features'} - def delete_intent( - self, app_id, version_id, intent_id, delete_utterances=False, custom_headers=None, raw=False, **operation_config): - """Deletes an intent from a version of the application. + def delete_intent_feature( + self, app_id, version_id, intent_id, model_name=None, feature_name=None, custom_headers=None, raw=False, **operation_config): + """Deletes a relation from the feature relations used by the intent in a + version of the application. :param app_id: The application ID. :type app_id: str @@ -1140,10 +1399,10 @@ def delete_intent( :type version_id: str :param intent_id: The intent classifier ID. :type intent_id: str - :param delete_utterances: If true, deletes the intent's example - utterances. If false, moves the example utterances to the None intent. - The default value is false. - :type delete_utterances: bool + :param model_name: The name of the model used. + :type model_name: str + :param feature_name: The name of the feature used. + :type feature_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -1156,8 +1415,10 @@ def delete_intent( :raises: :class:`ErrorResponseException` """ + feature_relation_delete_object = models.ModelFeatureInformation(model_name=model_name, feature_name=feature_name) + # Construct URL - url = self.delete_intent.metadata['url'] + url = self.delete_intent_feature.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'), @@ -1168,17 +1429,19 @@ def delete_intent( # Construct parameters query_parameters = {} - if delete_utterances is not None: - query_parameters['deleteUtterances'] = self._serialize.query("delete_utterances", delete_utterances, '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(feature_relation_delete_object, 'ModelFeatureInformation') + # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) + request = self._client.delete(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: @@ -1193,11 +1456,12 @@ def delete_intent( return client_raw_response return deserialized - delete_intent.metadata = {'url': '/apps/{appId}/versions/{versionId}/intents/{intentId}'} + delete_intent_feature.metadata = {'url': '/apps/{appId}/versions/{versionId}/intents/{intentId}/features'} - def get_entity( + def get_entity_features( self, app_id, version_id, entity_id, custom_headers=None, raw=False, **operation_config): - """Gets information about an entity model in a version of the application. + """Gets the information of the features used by the entity in a version of + the application. :param app_id: The application ID. :type app_id: str @@ -1210,15 +1474,15 @@ def get_entity( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: EntityExtractor or ClientRawResponse if raw=true + :return: list or ClientRawResponse if raw=true :rtype: - ~azure.cognitiveservices.language.luis.authoring.models.EntityExtractor + list[~azure.cognitiveservices.language.luis.authoring.models.ModelFeatureInformation] or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = self.get_entity.metadata['url'] + url = self.get_entity_features.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'), @@ -1245,18 +1509,19 @@ def get_entity( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('EntityExtractor', response) + deserialized = self._deserialize('[ModelFeatureInformation]', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - get_entity.metadata = {'url': '/apps/{appId}/versions/{versionId}/entities/{entityId}'} + get_entity_features.metadata = {'url': '/apps/{appId}/versions/{versionId}/entities/{entityId}/features'} - def update_entity( - self, app_id, version_id, entity_id, name=None, custom_headers=None, raw=False, **operation_config): - """Updates the name of an entity in a version of the application. + def replace_entity_features( + self, app_id, version_id, entity_id, feature_relations_update_object, custom_headers=None, raw=False, **operation_config): + """Updates the information of the features used by the entity in a version + of the application. :param app_id: The application ID. :type app_id: str @@ -1264,8 +1529,10 @@ def update_entity( :type version_id: str :param entity_id: The entity extractor ID. :type entity_id: str - :param name: The entity's new name. - :type name: str + :param feature_relations_update_object: A list of feature information + objects containing the new feature relations. + :type feature_relations_update_object: + list[~azure.cognitiveservices.language.luis.authoring.models.ModelFeatureInformation] :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -1278,10 +1545,8 @@ def update_entity( :raises: :class:`ErrorResponseException` """ - model_update_object = models.ModelUpdateObject(name=name) - # Construct URL - url = self.update_entity.metadata['url'] + url = self.replace_entity_features.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'), @@ -1301,7 +1566,7 @@ def update_entity( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(model_update_object, 'ModelUpdateObject') + body_content = self._serialize.body(feature_relations_update_object, '[ModelFeatureInformation]') # Construct and send request request = self._client.put(url, query_parameters, header_parameters, body_content) @@ -1319,11 +1584,12 @@ def update_entity( return client_raw_response return deserialized - update_entity.metadata = {'url': '/apps/{appId}/versions/{versionId}/entities/{entityId}'} + replace_entity_features.metadata = {'url': '/apps/{appId}/versions/{versionId}/entities/{entityId}/features'} - def delete_entity( - self, app_id, version_id, entity_id, custom_headers=None, raw=False, **operation_config): - """Deletes an entity from a version of the application. + def delete_entity_feature( + self, app_id, version_id, entity_id, model_name=None, feature_name=None, custom_headers=None, raw=False, **operation_config): + """Deletes a relation from the feature relations used by the entity in a + version of the application. :param app_id: The application ID. :type app_id: str @@ -1331,6 +1597,10 @@ def delete_entity( :type version_id: str :param entity_id: The entity extractor ID. :type entity_id: str + :param model_name: The name of the model used. + :type model_name: str + :param feature_name: The name of the feature used. + :type feature_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -1343,8 +1613,10 @@ def delete_entity( :raises: :class:`ErrorResponseException` """ + feature_relation_delete_object = models.ModelFeatureInformation(model_name=model_name, feature_name=feature_name) + # Construct URL - url = self.delete_entity.metadata['url'] + url = self.delete_entity_feature.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'), @@ -1359,11 +1631,15 @@ def delete_entity( # 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(feature_relation_delete_object, 'ModelFeatureInformation') + # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) + request = self._client.delete(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: @@ -1378,7 +1654,7 @@ def delete_entity( return client_raw_response return deserialized - delete_entity.metadata = {'url': '/apps/{appId}/versions/{versionId}/entities/{entityId}'} + delete_entity_feature.metadata = {'url': '/apps/{appId}/versions/{versionId}/entities/{entityId}/features'} def get_hierarchical_entity( self, app_id, version_id, h_entity_id, custom_headers=None, raw=False, **operation_config): @@ -1441,9 +1717,9 @@ def get_hierarchical_entity( get_hierarchical_entity.metadata = {'url': '/apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}'} def update_hierarchical_entity( - self, app_id, version_id, h_entity_id, children=None, name=None, custom_headers=None, raw=False, **operation_config): - """Updates the name and children of a hierarchical entity model in a - version of the application. + self, app_id, version_id, h_entity_id, name=None, custom_headers=None, raw=False, **operation_config): + """Updates the name of a hierarchical entity model in a version of the + application. :param app_id: The application ID. :type app_id: str @@ -1451,9 +1727,7 @@ def update_hierarchical_entity( :type version_id: str :param h_entity_id: The hierarchical entity extractor ID. :type h_entity_id: str - :param children: Child entities. - :type children: list[str] - :param name: Entity name. + :param name: The entity's new name. :type name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the @@ -1467,7 +1741,7 @@ def update_hierarchical_entity( :raises: :class:`ErrorResponseException` """ - hierarchical_model_update_object = models.HierarchicalEntityModel(children=children, name=name) + model_update_object = models.ModelUpdateObject(name=name) # Construct URL url = self.update_hierarchical_entity.metadata['url'] @@ -1490,10 +1764,10 @@ def update_hierarchical_entity( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(hierarchical_model_update_object, 'HierarchicalEntityModel') + body_content = self._serialize.body(model_update_object, 'ModelUpdateObject') # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) + request = self._client.patch(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: @@ -2888,39 +3162,38 @@ def delete_custom_prebuilt_domain( return deserialized delete_custom_prebuilt_domain.metadata = {'url': '/apps/{appId}/versions/{versionId}/customprebuiltdomains/{domainName}'} - def get_hierarchical_entity_child( - self, app_id, version_id, h_entity_id, h_child_id, custom_headers=None, raw=False, **operation_config): - """Gets information about the child's model contained in an hierarchical - entity child model in a version of the application. + def add_entity_child( + self, app_id, version_id, entity_id, child_entity_model_create_object, custom_headers=None, raw=False, **operation_config): + """Creates a single child in an existing entity model hierarchy in a + version of the application. :param app_id: The application ID. :type app_id: str :param version_id: The version ID. :type version_id: str - :param h_entity_id: The hierarchical entity extractor ID. - :type h_entity_id: str - :param h_child_id: The hierarchical entity extractor child ID. - :type h_child_id: str + :param entity_id: The entity extractor ID. + :type entity_id: str + :param child_entity_model_create_object: A model object containing the + name of the new child model and its children. + :type child_entity_model_create_object: + ~azure.cognitiveservices.language.luis.authoring.models.ChildEntityModelCreateObject :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: HierarchicalChildEntity or ClientRawResponse if raw=true - :rtype: - ~azure.cognitiveservices.language.luis.authoring.models.HierarchicalChildEntity - or ~msrest.pipeline.ClientRawResponse + :return: str or ClientRawResponse if raw=true + :rtype: str or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = self.get_hierarchical_entity_child.metadata['url'] + url = self.add_entity_child.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'), 'versionId': self._serialize.url("version_id", version_id, 'str'), - 'hEntityId': self._serialize.url("h_entity_id", h_entity_id, 'str'), - 'hChildId': self._serialize.url("h_child_id", h_child_id, 'str') + 'entityId': self._serialize.url("entity_id", entity_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -2930,31 +3203,35 @@ def get_hierarchical_entity_child( # 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(child_entity_model_create_object, 'ChildEntityModelCreateObject') + # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + 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]: + if response.status_code not in [201]: raise models.ErrorResponseException(self._deserialize, response) deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('HierarchicalChildEntity', response) + if response.status_code == 201: + deserialized = self._deserialize('str', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - get_hierarchical_entity_child.metadata = {'url': '/apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}/children/{hChildId}'} + add_entity_child.metadata = {'url': '/apps/{appId}/versions/{versionId}/entities/{entityId}/children'} - def update_hierarchical_entity_child( - self, app_id, version_id, h_entity_id, h_child_id, name=None, custom_headers=None, raw=False, **operation_config): - """Renames a single child in an existing hierarchical entity model in a - version of the application. + def get_hierarchical_entity_child( + self, app_id, version_id, h_entity_id, h_child_id, custom_headers=None, raw=False, **operation_config): + """Gets information about the child's model contained in an hierarchical + entity child model in a version of the application. :param app_id: The application ID. :type app_id: str @@ -2964,24 +3241,20 @@ def update_hierarchical_entity_child( :type h_entity_id: str :param h_child_id: The hierarchical entity extractor child ID. :type h_child_id: str - :param name: - :type name: str :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: OperationStatus or ClientRawResponse if raw=true + :return: HierarchicalChildEntity or ClientRawResponse if raw=true :rtype: - ~azure.cognitiveservices.language.luis.authoring.models.OperationStatus + ~azure.cognitiveservices.language.luis.authoring.models.HierarchicalChildEntity or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ - hierarchical_child_model_update_object = models.HierarchicalChildModelUpdateObject(name=name) - # Construct URL - url = self.update_hierarchical_entity_child.metadata['url'] + url = self.get_hierarchical_entity_child.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'), @@ -2997,15 +3270,11 @@ def update_hierarchical_entity_child( # 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(hierarchical_child_model_update_object, 'HierarchicalChildModelUpdateObject') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) + request = self._client.get(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: @@ -3013,19 +3282,19 @@ def update_hierarchical_entity_child( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('OperationStatus', response) + deserialized = self._deserialize('HierarchicalChildEntity', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - update_hierarchical_entity_child.metadata = {'url': '/apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}/children/{hChildId}'} + get_hierarchical_entity_child.metadata = {'url': '/apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}/children/{hChildId}'} - def delete_hierarchical_entity_child( - self, app_id, version_id, h_entity_id, h_child_id, custom_headers=None, raw=False, **operation_config): - """Deletes a hierarchical entity extractor child in a version of the - application. + def update_hierarchical_entity_child( + self, app_id, version_id, h_entity_id, h_child_id, name=None, custom_headers=None, raw=False, **operation_config): + """Renames a single child in an existing hierarchical entity model in a + version of the application. :param app_id: The application ID. :type app_id: str @@ -3035,6 +3304,8 @@ def delete_hierarchical_entity_child( :type h_entity_id: str :param h_child_id: The hierarchical entity extractor child ID. :type h_child_id: str + :param name: + :type name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -3047,8 +3318,10 @@ def delete_hierarchical_entity_child( :raises: :class:`ErrorResponseException` """ + hierarchical_child_model_update_object = models.HierarchicalChildModelUpdateObject(name=name) + # Construct URL - url = self.delete_hierarchical_entity_child.metadata['url'] + url = self.update_hierarchical_entity_child.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'), @@ -3064,11 +3337,15 @@ def delete_hierarchical_entity_child( # 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(hierarchical_child_model_update_object, 'HierarchicalChildModelUpdateObject') + # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) + request = self._client.patch(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: @@ -3083,12 +3360,12 @@ def delete_hierarchical_entity_child( return client_raw_response return deserialized - delete_hierarchical_entity_child.metadata = {'url': '/apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}/children/{hChildId}'} + update_hierarchical_entity_child.metadata = {'url': '/apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}/children/{hChildId}'} - def add_hierarchical_entity_child( - self, app_id, version_id, h_entity_id, name=None, custom_headers=None, raw=False, **operation_config): - """Creates a single child in an existing hierarchical entity model in a - version of the application. + def delete_hierarchical_entity_child( + self, app_id, version_id, h_entity_id, h_child_id, custom_headers=None, raw=False, **operation_config): + """Deletes a hierarchical entity extractor child in a version of the + application. :param app_id: The application ID. :type app_id: str @@ -3096,27 +3373,28 @@ def add_hierarchical_entity_child( :type version_id: str :param h_entity_id: The hierarchical entity extractor ID. :type h_entity_id: str - :param name: - :type name: str + :param h_child_id: The hierarchical entity extractor child ID. + :type h_child_id: str :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: str or ClientRawResponse if raw=true - :rtype: str or ~msrest.pipeline.ClientRawResponse + :return: OperationStatus or ClientRawResponse if raw=true + :rtype: + ~azure.cognitiveservices.language.luis.authoring.models.OperationStatus + or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ - hierarchical_child_model_create_object = models.HierarchicalChildModelCreateObject(name=name) - # Construct URL - url = self.add_hierarchical_entity_child.metadata['url'] + url = self.delete_hierarchical_entity_child.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'), 'versionId': self._serialize.url("version_id", version_id, 'str'), - 'hEntityId': self._serialize.url("h_entity_id", h_entity_id, 'str') + 'hEntityId': self._serialize.url("h_entity_id", h_entity_id, 'str'), + 'hChildId': self._serialize.url("h_child_id", h_child_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -3126,30 +3404,26 @@ def add_hierarchical_entity_child( # 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(hierarchical_child_model_create_object, 'HierarchicalChildModelCreateObject') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) + request = self._client.delete(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [201]: + if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) deserialized = None - if response.status_code == 201: - deserialized = self._deserialize('str', response) + if response.status_code == 200: + deserialized = self._deserialize('OperationStatus', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - add_hierarchical_entity_child.metadata = {'url': '/apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}/children'} + delete_hierarchical_entity_child.metadata = {'url': '/apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}/children/{hChildId}'} def add_composite_entity_child( self, app_id, version_id, c_entity_id, name=None, custom_headers=None, raw=False, **operation_config):