Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from .luis_runtime_client import LUISRuntimeClient
from .version import VERSION

__all__ = ['LUISRuntimeClient']

__version__ = VERSION

Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.service_client import SDKClient
from msrest import Configuration, Serializer, Deserializer
from .version import VERSION
from .operations.prediction_operations import PredictionOperations
from . import models


class LUISRuntimeClientConfiguration(Configuration):
"""Configuration for LUISRuntimeClient
Note that all parameters used to create this instance are saved as instance
attributes.

:param credentials: Subscription credentials which uniquely identify
client subscription.
:type credentials: None
:param str base_url: Service URL
"""

def __init__(
self, credentials, base_url=None):

if credentials is None:
raise ValueError("Parameter 'credentials' must not be None.")
if not base_url:
base_url = 'https://api.cognitive.microsoft.com/luis/v2.0'

super(LUISRuntimeClientConfiguration, self).__init__(base_url)

self.add_user_agent('azure-cognitiveservices-language-luis/{}'.format(VERSION))

self.credentials = credentials


class LUISRuntimeClient(SDKClient):
"""LUISRuntimeClient

:ivar config: Configuration for client.
:vartype config: LUISRuntimeClientConfiguration

:ivar prediction: Prediction operations
:vartype prediction: azure.cognitiveservices.language.luis.runtime.operations.PredictionOperations

:param credentials: Subscription credentials which uniquely identify
client subscription.
:type credentials: None
:param str base_url: Service URL
"""

def __init__(
self, credentials, base_url=None):

self.config = LUISRuntimeClientConfiguration(credentials, base_url)
super(LUISRuntimeClient, self).__init__(self.config.credentials, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '2.0'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

self.prediction = PredictionOperations(
self._client, self.config, self._serialize, self._deserialize)
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

try:
from .intent_model_py3 import IntentModel
from .entity_model_py3 import EntityModel
from .composite_child_model_py3 import CompositeChildModel
from .composite_entity_model_py3 import CompositeEntityModel
from .sentiment_py3 import Sentiment
from .luis_result_py3 import LuisResult
from .entity_with_score_py3 import EntityWithScore
from .entity_with_resolution_py3 import EntityWithResolution
from .api_error_py3 import APIError, APIErrorException
except (SyntaxError, ImportError):
from .intent_model import IntentModel
from .entity_model import EntityModel
from .composite_child_model import CompositeChildModel
from .composite_entity_model import CompositeEntityModel
from .sentiment import Sentiment
from .luis_result import LuisResult
from .entity_with_score import EntityWithScore
from .entity_with_resolution import EntityWithResolution
from .api_error import APIError, APIErrorException

__all__ = [
'IntentModel',
'EntityModel',
'CompositeChildModel',
'CompositeEntityModel',
'Sentiment',
'LuisResult',
'EntityWithScore',
'EntityWithResolution',
'APIError', 'APIErrorException',
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model
from msrest.exceptions import HttpOperationError


class APIError(Model):
"""Error information returned by the API.

:param status_code: HTTP Status code
:type status_code: str
:param message: Cause of the error.
:type message: str
"""

_attribute_map = {
'status_code': {'key': 'statusCode', 'type': 'str'},
'message': {'key': 'message', 'type': 'str'},
}

def __init__(self, **kwargs):
super(APIError, self).__init__(**kwargs)
self.status_code = kwargs.get('status_code', None)
self.message = kwargs.get('message', None)


class APIErrorException(HttpOperationError):
"""Server responsed with exception of type: 'APIError'.

:param deserialize: A deserializer
:param response: Server response to be deserialized.
"""

def __init__(self, deserialize, response, *args):

super(APIErrorException, self).__init__(deserialize, response, 'APIError', *args)
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model
from msrest.exceptions import HttpOperationError


class APIError(Model):
"""Error information returned by the API.

:param status_code: HTTP Status code
:type status_code: str
:param message: Cause of the error.
:type message: str
"""

_attribute_map = {
'status_code': {'key': 'statusCode', 'type': 'str'},
'message': {'key': 'message', 'type': 'str'},
}

def __init__(self, *, status_code: str=None, message: str=None, **kwargs) -> None:
super(APIError, self).__init__(**kwargs)
self.status_code = status_code
self.message = message


class APIErrorException(HttpOperationError):
"""Server responsed with exception of type: 'APIError'.

:param deserialize: A deserializer
:param response: Server response to be deserialized.
"""

def __init__(self, deserialize, response, *args):

super(APIErrorException, self).__init__(deserialize, response, 'APIError', *args)
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class CompositeChildModel(Model):
"""Child entity in a LUIS Composite Entity.

All required parameters must be populated in order to send to Azure.

:param type: Required. Type of child entity.
:type type: str
:param value: Required. Value extracted by LUIS.
:type value: str
"""

_validation = {
'type': {'required': True},
'value': {'required': True},
}

_attribute_map = {
'type': {'key': 'type', 'type': 'str'},
'value': {'key': 'value', 'type': 'str'},
}

def __init__(self, **kwargs):
super(CompositeChildModel, self).__init__(**kwargs)
self.type = kwargs.get('type', None)
self.value = kwargs.get('value', None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class CompositeChildModel(Model):
"""Child entity in a LUIS Composite Entity.

All required parameters must be populated in order to send to Azure.

:param type: Required. Type of child entity.
:type type: str
:param value: Required. Value extracted by LUIS.
:type value: str
"""

_validation = {
'type': {'required': True},
'value': {'required': True},
}

_attribute_map = {
'type': {'key': 'type', 'type': 'str'},
'value': {'key': 'value', 'type': 'str'},
}

def __init__(self, *, type: str, value: str, **kwargs) -> None:
super(CompositeChildModel, self).__init__(**kwargs)
self.type = type
self.value = value
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class CompositeEntityModel(Model):
"""LUIS Composite Entity.

All required parameters must be populated in order to send to Azure.

:param parent_type: Required. Type/name of parent entity.
:type parent_type: str
:param value: Required. Value for composite entity extracted by LUIS.
:type value: str
:param children: Required. Child entities.
:type children:
list[~azure.cognitiveservices.language.luis.runtime.models.CompositeChildModel]
"""

_validation = {
'parent_type': {'required': True},
'value': {'required': True},
'children': {'required': True},
}

_attribute_map = {
'parent_type': {'key': 'parentType', 'type': 'str'},
'value': {'key': 'value', 'type': 'str'},
'children': {'key': 'children', 'type': '[CompositeChildModel]'},
}

def __init__(self, **kwargs):
super(CompositeEntityModel, self).__init__(**kwargs)
self.parent_type = kwargs.get('parent_type', None)
self.value = kwargs.get('value', None)
self.children = kwargs.get('children', None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class CompositeEntityModel(Model):
"""LUIS Composite Entity.

All required parameters must be populated in order to send to Azure.

:param parent_type: Required. Type/name of parent entity.
:type parent_type: str
:param value: Required. Value for composite entity extracted by LUIS.
:type value: str
:param children: Required. Child entities.
:type children:
list[~azure.cognitiveservices.language.luis.runtime.models.CompositeChildModel]
"""

_validation = {
'parent_type': {'required': True},
'value': {'required': True},
'children': {'required': True},
}

_attribute_map = {
'parent_type': {'key': 'parentType', 'type': 'str'},
'value': {'key': 'value', 'type': 'str'},
'children': {'key': 'children', 'type': '[CompositeChildModel]'},
}

def __init__(self, *, parent_type: str, value: str, children, **kwargs) -> None:
super(CompositeEntityModel, self).__init__(**kwargs)
self.parent_type = parent_type
self.value = value
self.children = children
Loading