diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_async_lro.py b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_async_lro.py index a5fbcc5957f6..8b3e2764fc3d 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_async_lro.py +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_async_lro.py @@ -170,8 +170,8 @@ class AsyncAnalyzeBatchActionsLROPollingMethod(TextAnalyticsAsyncLROPollingMetho @property def _current_body(self): - from ._generated.v3_1_preview_3.models import JobMetadata - return JobMetadata.deserialize(self._pipeline_response) + from ._generated.v3_1_preview_3.models import AnalyzeJobMetadata + return AnalyzeJobMetadata.deserialize(self._pipeline_response) @property def created_on(self): diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/_operations_mixin.py b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/_operations_mixin.py index 28efc6437820..07e1856dae5f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/_operations_mixin.py +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/_operations_mixin.py @@ -13,8 +13,7 @@ import warnings # FIXME: have to manually reconfigure import path for multiapi operation mixin -from .._lro import AnalyzeHealthcareEntitiesLROPoller, AnalyzeHealthcareEntitiesLROPollingMethod -from .._lro import AnalyzeBatchActionsLROPoller, AnalyzeBatchActionsLROPollingMethod +from .._lro import AnalyzeBatchActionsLROPoller, AnalyzeBatchActionsLROPollingMethod, AnalyzeHealthcareEntitiesLROPoller, AnalyzeHealthcareEntitiesLROPollingMethod from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse @@ -61,6 +60,8 @@ def analyze_status( api_version = self._get_api_version('analyze_status') if api_version == 'v3.1-preview.3': from .v3_1_preview_3.operations import TextAnalyticsClientOperationsMixin as OperationClass + elif api_version == 'v3.1-preview.4': + from .v3_1_preview_4.operations import TextAnalyticsClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'analyze_status'".format(api_version)) mixin_instance = OperationClass() @@ -96,6 +97,8 @@ def begin_analyze( api_version = self._get_api_version('begin_analyze') if api_version == 'v3.1-preview.3': from .v3_1_preview_3.operations import TextAnalyticsClientOperationsMixin as OperationClass + elif api_version == 'v3.1-preview.4': + from .v3_1_preview_4.operations import TextAnalyticsClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'begin_analyze'".format(api_version)) mixin_instance = OperationClass() @@ -130,6 +133,8 @@ def begin_cancel_health_job( api_version = self._get_api_version('begin_cancel_health_job') if api_version == 'v3.1-preview.3': from .v3_1_preview_3.operations import TextAnalyticsClientOperationsMixin as OperationClass + elif api_version == 'v3.1-preview.4': + from .v3_1_preview_4.operations import TextAnalyticsClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'begin_cancel_health_job'".format(api_version)) mixin_instance = OperationClass() @@ -174,6 +179,8 @@ def begin_health( api_version = self._get_api_version('begin_health') if api_version == 'v3.1-preview.3': from .v3_1_preview_3.operations import TextAnalyticsClientOperationsMixin as OperationClass + elif api_version == 'v3.1-preview.4': + from .v3_1_preview_4.operations import TextAnalyticsClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'begin_health'".format(api_version)) mixin_instance = OperationClass() @@ -215,6 +222,8 @@ def entities_linking( from .v3_0.operations import TextAnalyticsClientOperationsMixin as OperationClass elif api_version == 'v3.1-preview.3': from .v3_1_preview_3.operations import TextAnalyticsClientOperationsMixin as OperationClass + elif api_version == 'v3.1-preview.4': + from .v3_1_preview_4.operations import TextAnalyticsClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'entities_linking'".format(api_version)) mixin_instance = OperationClass() @@ -257,6 +266,8 @@ def entities_recognition_general( from .v3_0.operations import TextAnalyticsClientOperationsMixin as OperationClass elif api_version == 'v3.1-preview.3': from .v3_1_preview_3.operations import TextAnalyticsClientOperationsMixin as OperationClass + elif api_version == 'v3.1-preview.4': + from .v3_1_preview_4.operations import TextAnalyticsClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'entities_recognition_general'".format(api_version)) mixin_instance = OperationClass() @@ -307,6 +318,8 @@ def entities_recognition_pii( api_version = self._get_api_version('entities_recognition_pii') if api_version == 'v3.1-preview.3': from .v3_1_preview_3.operations import TextAnalyticsClientOperationsMixin as OperationClass + elif api_version == 'v3.1-preview.4': + from .v3_1_preview_4.operations import TextAnalyticsClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'entities_recognition_pii'".format(api_version)) mixin_instance = OperationClass() @@ -348,6 +361,8 @@ def health_status( api_version = self._get_api_version('health_status') if api_version == 'v3.1-preview.3': from .v3_1_preview_3.operations import TextAnalyticsClientOperationsMixin as OperationClass + elif api_version == 'v3.1-preview.4': + from .v3_1_preview_4.operations import TextAnalyticsClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'health_status'".format(api_version)) mixin_instance = OperationClass() @@ -389,6 +404,8 @@ def key_phrases( from .v3_0.operations import TextAnalyticsClientOperationsMixin as OperationClass elif api_version == 'v3.1-preview.3': from .v3_1_preview_3.operations import TextAnalyticsClientOperationsMixin as OperationClass + elif api_version == 'v3.1-preview.4': + from .v3_1_preview_4.operations import TextAnalyticsClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'key_phrases'".format(api_version)) mixin_instance = OperationClass() @@ -431,6 +448,8 @@ def languages( from .v3_0.operations import TextAnalyticsClientOperationsMixin as OperationClass elif api_version == 'v3.1-preview.3': from .v3_1_preview_3.operations import TextAnalyticsClientOperationsMixin as OperationClass + elif api_version == 'v3.1-preview.4': + from .v3_1_preview_4.operations import TextAnalyticsClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'languages'".format(api_version)) mixin_instance = OperationClass() @@ -473,6 +492,8 @@ def sentiment( from .v3_0.operations import TextAnalyticsClientOperationsMixin as OperationClass elif api_version == 'v3.1-preview.3': from .v3_1_preview_3.operations import TextAnalyticsClientOperationsMixin as OperationClass + elif api_version == 'v3.1-preview.4': + from .v3_1_preview_4.operations import TextAnalyticsClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'sentiment'".format(api_version)) mixin_instance = OperationClass() diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/_text_analytics_client.py b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/_text_analytics_client.py index 333b62e6856a..11dd20effe38 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/_text_analytics_client.py +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/_text_analytics_client.py @@ -75,6 +75,8 @@ def __init__( base_url = '{Endpoint}/text/analytics/v3.0' elif api_version == 'v3.1-preview.3': base_url = '{Endpoint}/text/analytics/v3.1-preview.3' + elif api_version == 'v3.1-preview.4': + base_url = '{Endpoint}/text/analytics/v3.1-preview.4' else: raise ValueError("API version {} is not available".format(api_version)) self._config = TextAnalyticsClientConfiguration(credential, endpoint, **kwargs) @@ -94,6 +96,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * v3.0: :mod:`v3_0.models` * v3.1-preview.3: :mod:`v3_1_preview_3.models` + * v3.1-preview.4: :mod:`v3_1_preview_4.models` """ if api_version == 'v3.0': from .v3_0 import models @@ -101,6 +104,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == 'v3.1-preview.3': from .v3_1_preview_3 import models return models + elif api_version == 'v3.1-preview.4': + from .v3_1_preview_4 import models + return models raise ValueError("API version {} is not available".format(api_version)) def close(self): diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/aio/_operations_mixin.py b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/aio/_operations_mixin.py index cb2794948437..cedc40af0fc8 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/aio/_operations_mixin.py +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/aio/_operations_mixin.py @@ -13,8 +13,7 @@ import warnings # FIXME: have to manually reconfigure import path for multiapi operation mixin -from ..._async_lro import AnalyzeHealthcareEntitiesAsyncLROPoller, AnalyzeHealthcareEntitiesAsyncLROPollingMethod -from ..._async_lro import AsyncAnalyzeBatchActionsLROPoller, AsyncAnalyzeBatchActionsLROPollingMethod +from ..._async_lro import AnalyzeHealthcareEntitiesAsyncLROPoller, AnalyzeHealthcareEntitiesAsyncLROPollingMethod, AsyncAnalyzeBatchActionsLROPoller, AsyncAnalyzeBatchActionsLROPollingMethod from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest @@ -57,6 +56,8 @@ async def analyze_status( api_version = self._get_api_version('analyze_status') if api_version == 'v3.1-preview.3': from ..v3_1_preview_3.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass + elif api_version == 'v3.1-preview.4': + from ..v3_1_preview_4.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'analyze_status'".format(api_version)) mixin_instance = OperationClass() @@ -86,12 +87,14 @@ async def begin_analyze( :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncAnalyzeBatchActionsLROPoller that returns either AnalyzeJobState or the result of cls(response) - :rtype: ~...._async_lro.AsyncAnalyzeBatchActionsLROPoller[~azure.ai.textanalytics.v3_1_preview_3.models.AnalyzeJobState] + :rtype: ~....._async_lro.AsyncAnalyzeBatchActionsLROPoller[~azure.ai.textanalytics.v3_1_preview_3.models.AnalyzeJobState] :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('begin_analyze') if api_version == 'v3.1-preview.3': from ..v3_1_preview_3.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass + elif api_version == 'v3.1-preview.4': + from ..v3_1_preview_4.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'begin_analyze'".format(api_version)) mixin_instance = OperationClass() @@ -126,6 +129,8 @@ async def begin_cancel_health_job( api_version = self._get_api_version('begin_cancel_health_job') if api_version == 'v3.1-preview.3': from ..v3_1_preview_3.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass + elif api_version == 'v3.1-preview.4': + from ..v3_1_preview_4.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'begin_cancel_health_job'".format(api_version)) mixin_instance = OperationClass() @@ -170,6 +175,8 @@ async def begin_health( api_version = self._get_api_version('begin_health') if api_version == 'v3.1-preview.3': from ..v3_1_preview_3.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass + elif api_version == 'v3.1-preview.4': + from ..v3_1_preview_4.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'begin_health'".format(api_version)) mixin_instance = OperationClass() @@ -211,6 +218,8 @@ async def entities_linking( from ..v3_0.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass elif api_version == 'v3.1-preview.3': from ..v3_1_preview_3.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass + elif api_version == 'v3.1-preview.4': + from ..v3_1_preview_4.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'entities_linking'".format(api_version)) mixin_instance = OperationClass() @@ -253,6 +262,8 @@ async def entities_recognition_general( from ..v3_0.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass elif api_version == 'v3.1-preview.3': from ..v3_1_preview_3.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass + elif api_version == 'v3.1-preview.4': + from ..v3_1_preview_4.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'entities_recognition_general'".format(api_version)) mixin_instance = OperationClass() @@ -303,6 +314,8 @@ async def entities_recognition_pii( api_version = self._get_api_version('entities_recognition_pii') if api_version == 'v3.1-preview.3': from ..v3_1_preview_3.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass + elif api_version == 'v3.1-preview.4': + from ..v3_1_preview_4.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'entities_recognition_pii'".format(api_version)) mixin_instance = OperationClass() @@ -344,6 +357,8 @@ async def health_status( api_version = self._get_api_version('health_status') if api_version == 'v3.1-preview.3': from ..v3_1_preview_3.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass + elif api_version == 'v3.1-preview.4': + from ..v3_1_preview_4.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'health_status'".format(api_version)) mixin_instance = OperationClass() @@ -385,6 +400,8 @@ async def key_phrases( from ..v3_0.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass elif api_version == 'v3.1-preview.3': from ..v3_1_preview_3.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass + elif api_version == 'v3.1-preview.4': + from ..v3_1_preview_4.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'key_phrases'".format(api_version)) mixin_instance = OperationClass() @@ -427,6 +444,8 @@ async def languages( from ..v3_0.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass elif api_version == 'v3.1-preview.3': from ..v3_1_preview_3.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass + elif api_version == 'v3.1-preview.4': + from ..v3_1_preview_4.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'languages'".format(api_version)) mixin_instance = OperationClass() @@ -469,6 +488,8 @@ async def sentiment( from ..v3_0.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass elif api_version == 'v3.1-preview.3': from ..v3_1_preview_3.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass + elif api_version == 'v3.1-preview.4': + from ..v3_1_preview_4.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'sentiment'".format(api_version)) mixin_instance = OperationClass() diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/aio/_text_analytics_client.py b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/aio/_text_analytics_client.py index e60c34ea5476..cac9a1c199c1 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/aio/_text_analytics_client.py +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/aio/_text_analytics_client.py @@ -73,6 +73,8 @@ def __init__( base_url = '{Endpoint}/text/analytics/v3.0' elif api_version == 'v3.1-preview.3': base_url = '{Endpoint}/text/analytics/v3.1-preview.3' + elif api_version == 'v3.1-preview.4': + base_url = '{Endpoint}/text/analytics/v3.1-preview.4' else: raise ValueError("API version {} is not available".format(api_version)) self._config = TextAnalyticsClientConfiguration(credential, endpoint, **kwargs) @@ -92,6 +94,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * v3.0: :mod:`v3_0.models` * v3.1-preview.3: :mod:`v3_1_preview_3.models` + * v3.1-preview.4: :mod:`v3_1_preview_4.models` """ if api_version == 'v3.0': from ..v3_0 import models @@ -99,6 +102,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == 'v3.1-preview.3': from ..v3_1_preview_3 import models return models + elif api_version == 'v3.1-preview.4': + from ..v3_1_preview_4 import models + return models raise ValueError("API version {} is not available".format(api_version)) async def close(self): diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_3/_metadata.json b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_3/_metadata.json new file mode 100644 index 000000000000..870a86ee2d3e --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_3/_metadata.json @@ -0,0 +1,264 @@ +{ + "chosen_version": "v3.1-preview.3", + "total_api_version_list": ["v3.1-preview.3"], + "client": { + "name": "TextAnalyticsClient", + "filename": "_text_analytics_client", + "description": "The Text Analytics API is a suite of natural language processing (NLP) services built with best-in-class Microsoft machine learning algorithms. The API can be used to analyze unstructured text for tasks such as sentiment analysis, key phrase extraction and language detection. Further documentation can be found in :code:`\u003ca href=\"https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview\"\u003ehttps://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview\u003c/a\u003e`.", + "base_url": null, + "custom_base_url": "\u0027{Endpoint}/text/analytics/v3.1-preview.3\u0027", + "azure_arm": false, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.core\": [\"PipelineClient\"]}, \"local\": {\"._configuration\": [\"TextAnalyticsClientConfiguration\"], \"._operations_mixin\": [\"TextAnalyticsClientOperationsMixin\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.core\": [\"AsyncPipelineClient\"]}, \"local\": {\"._configuration\": [\"TextAnalyticsClientConfiguration\"], \"._operations_mixin\": [\"TextAnalyticsClientOperationsMixin\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "endpoint": { + "signature": "endpoint, # type: str", + "description": "Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "endpoint": { + "signature": "endpoint: str,", + "description": "Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, endpoint", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://cognitiveservices.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + }, + "operation_mixins": { + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"ClientAuthenticationError\", \"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"], \"...._lro\": [\"AnalyzeBatchActionsLROPoller\", \"AnalyzeBatchActionsLROPollingMethod\", \"AnalyzeHealthcareEntitiesLROPoller\", \"AnalyzeHealthcareEntitiesLROPollingMethod\"], \"azure.core.polling\": [\"LROPoller\", \"NoPolling\", \"PollingMethod\"], \"azure.core.polling.base_polling\": [\"LROBasePolling\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"List\", \"Optional\", \"TypeVar\", \"Union\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"ClientAuthenticationError\", \"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"], \"....._async_lro\": [\"AnalyzeHealthcareEntitiesAsyncLROPoller\", \"AnalyzeHealthcareEntitiesAsyncLROPollingMethod\", \"AsyncAnalyzeBatchActionsLROPoller\", \"AsyncAnalyzeBatchActionsLROPollingMethod\"], \"azure.core.polling\": [\"AsyncLROPoller\", \"AsyncNoPolling\", \"AsyncPollingMethod\"], \"azure.core.polling.async_base_polling\": [\"AsyncLROBasePolling\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"List\", \"Optional\", \"TypeVar\", \"Union\"]}}}", + "operations": { + "_analyze_initial" : { + "sync": { + "signature": "def _analyze_initial(\n self,\n body=None, # type: Optional[\"_models.AnalyzeBatchInput\"]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"\n\n:param body: Collection of documents to analyze and tasks to execute.\n:type body: ~azure.ai.textanalytics.v3_1_preview_3.models.AnalyzeBatchInput\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: AnalyzeJobState, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_3.models.AnalyzeJobState or None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def _analyze_initial(\n self,\n body: Optional[\"_models.AnalyzeBatchInput\"] = None,\n **kwargs\n) -\u003e Optional[\"_models.AnalyzeJobState\"]:\n", + "doc": "\"\"\"\n\n:param body: Collection of documents to analyze and tasks to execute.\n:type body: ~azure.ai.textanalytics.v3_1_preview_3.models.AnalyzeBatchInput\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: AnalyzeJobState, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_3.models.AnalyzeJobState or None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "body" + }, + "begin_analyze" : { + "sync": { + "signature": "def begin_analyze(\n self,\n body=None, # type: Optional[\"_models.AnalyzeBatchInput\"]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Submit analysis job.\n\nSubmit a collection of text documents for analysis. Specify one or more unique tasks to be\nexecuted.\n\n:param body: Collection of documents to analyze and tasks to execute.\n:type body: ~azure.ai.textanalytics.v3_1_preview_3.models.AnalyzeBatchInput\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the AnalyzeBatchActionsLROPollingMethod polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AnalyzeBatchActionsLROPoller that returns either AnalyzeJobState or the result of cls(response)\n:rtype: ~...._lro.AnalyzeBatchActionsLROPoller[~azure.ai.textanalytics.v3_1_preview_3.models.AnalyzeJobState]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def begin_analyze(\n self,\n body: Optional[\"_models.AnalyzeBatchInput\"] = None,\n **kwargs\n) -\u003e AsyncAnalyzeBatchActionsLROPoller[\"_models.AnalyzeJobState\"]:\n", + "doc": "\"\"\"Submit analysis job.\n\nSubmit a collection of text documents for analysis. Specify one or more unique tasks to be\nexecuted.\n\n:param body: Collection of documents to analyze and tasks to execute.\n:type body: ~azure.ai.textanalytics.v3_1_preview_3.models.AnalyzeBatchInput\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the AsyncAnalyzeBatchActionsLROPollingMethod polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncAnalyzeBatchActionsLROPoller that returns either AnalyzeJobState or the result of cls(response)\n:rtype: ~....._async_lro.AsyncAnalyzeBatchActionsLROPoller[~azure.ai.textanalytics.v3_1_preview_3.models.AnalyzeJobState]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + }, + "call": "body" + }, + "analyze_status" : { + "sync": { + "signature": "def analyze_status(\n self,\n job_id, # type: str\n show_stats=None, # type: Optional[bool]\n top=20, # type: Optional[int]\n skip=0, # type: Optional[int]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Get analysis status and results.\n\nGet the status of an analysis job. A job may consist of one or more tasks. Once all tasks are\ncompleted, the job will transition to the completed state and results will be available for\neach task.\n\n:param job_id: Job ID for Analyze.\n:type job_id: str\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:param top: (Optional) Set the maximum number of results per task. When both $top and $skip are\n specified, $skip is applied first.\n:type top: int\n:param skip: (Optional) Set the number of elements to offset in the response. When both $top\n and $skip are specified, $skip is applied first.\n:type skip: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: AnalyzeJobState, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_3.models.AnalyzeJobState\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def analyze_status(\n self,\n job_id: str,\n show_stats: Optional[bool] = None,\n top: Optional[int] = 20,\n skip: Optional[int] = 0,\n **kwargs\n) -\u003e \"_models.AnalyzeJobState\":\n", + "doc": "\"\"\"Get analysis status and results.\n\nGet the status of an analysis job. A job may consist of one or more tasks. Once all tasks are\ncompleted, the job will transition to the completed state and results will be available for\neach task.\n\n:param job_id: Job ID for Analyze.\n:type job_id: str\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:param top: (Optional) Set the maximum number of results per task. When both $top and $skip are\n specified, $skip is applied first.\n:type top: int\n:param skip: (Optional) Set the number of elements to offset in the response. When both $top\n and $skip are specified, $skip is applied first.\n:type skip: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: AnalyzeJobState, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_3.models.AnalyzeJobState\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "job_id, show_stats, top, skip" + }, + "health_status" : { + "sync": { + "signature": "def health_status(\n self,\n job_id, # type: str\n top=20, # type: Optional[int]\n skip=0, # type: Optional[int]\n show_stats=None, # type: Optional[bool]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Get healthcare analysis job status and results.\n\nGet details of the healthcare prediction job specified by the jobId.\n\n:param job_id: Job ID.\n:type job_id: str\n:param top: (Optional) Set the maximum number of results per task. When both $top and $skip are\n specified, $skip is applied first.\n:type top: int\n:param skip: (Optional) Set the number of elements to offset in the response. When both $top\n and $skip are specified, $skip is applied first.\n:type skip: int\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: HealthcareJobState, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_3.models.HealthcareJobState\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def health_status(\n self,\n job_id: str,\n top: Optional[int] = 20,\n skip: Optional[int] = 0,\n show_stats: Optional[bool] = None,\n **kwargs\n) -\u003e \"_models.HealthcareJobState\":\n", + "doc": "\"\"\"Get healthcare analysis job status and results.\n\nGet details of the healthcare prediction job specified by the jobId.\n\n:param job_id: Job ID.\n:type job_id: str\n:param top: (Optional) Set the maximum number of results per task. When both $top and $skip are\n specified, $skip is applied first.\n:type top: int\n:param skip: (Optional) Set the number of elements to offset in the response. When both $top\n and $skip are specified, $skip is applied first.\n:type skip: int\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: HealthcareJobState, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_3.models.HealthcareJobState\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "job_id, top, skip, show_stats" + }, + "_cancel_health_job_initial" : { + "sync": { + "signature": "def _cancel_health_job_initial(\n self,\n job_id, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"\n\n:param job_id: Job ID.\n:type job_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def _cancel_health_job_initial(\n self,\n job_id: str,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"\n\n:param job_id: Job ID.\n:type job_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "job_id" + }, + "begin_cancel_health_job" : { + "sync": { + "signature": "def begin_cancel_health_job(\n self,\n job_id, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Cancel healthcare prediction job.\n\nCancel healthcare prediction job.\n\n:param job_id: Job ID.\n:type job_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the LROBasePolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def begin_cancel_health_job(\n self,\n job_id: str,\n **kwargs\n) -\u003e AsyncLROPoller[None]:\n", + "doc": "\"\"\"Cancel healthcare prediction job.\n\nCancel healthcare prediction job.\n\n:param job_id: Job ID.\n:type job_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the AsyncLROBasePolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + }, + "call": "job_id" + }, + "_health_initial" : { + "sync": { + "signature": "def _health_initial(\n self,\n documents, # type: List[\"_models.MultiLanguageInput\"]\n model_version=None, # type: Optional[str]\n string_index_type=\"TextElements_v8\", # type: Optional[Union[str, \"_models.StringIndexType\"]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"\n\n:param documents: The set of documents to process as part of this batch.\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_3.models.MultiLanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param string_index_type: (Optional) Specifies the method used to interpret string offsets.\n Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information\n see https://aka.ms/text-analytics-offsets.\n:type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_3.models.StringIndexType\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: HealthcareJobState, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_3.models.HealthcareJobState or None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def _health_initial(\n self,\n documents: List[\"_models.MultiLanguageInput\"],\n model_version: Optional[str] = None,\n string_index_type: Optional[Union[str, \"_models.StringIndexType\"]] = \"TextElements_v8\",\n **kwargs\n) -\u003e Optional[\"_models.HealthcareJobState\"]:\n", + "doc": "\"\"\"\n\n:param documents: The set of documents to process as part of this batch.\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_3.models.MultiLanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param string_index_type: (Optional) Specifies the method used to interpret string offsets.\n Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information\n see https://aka.ms/text-analytics-offsets.\n:type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_3.models.StringIndexType\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: HealthcareJobState, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_3.models.HealthcareJobState or None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "documents, model_version, string_index_type" + }, + "begin_health" : { + "sync": { + "signature": "def begin_health(\n self,\n documents, # type: List[\"_models.MultiLanguageInput\"]\n model_version=None, # type: Optional[str]\n string_index_type=\"TextElements_v8\", # type: Optional[Union[str, \"_models.StringIndexType\"]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Submit healthcare analysis job.\n\nStart a healthcare analysis job to recognize healthcare related entities (drugs, conditions,\nsymptoms, etc) and their relations.\n\n:param documents: The set of documents to process as part of this batch.\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_3.models.MultiLanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param string_index_type: (Optional) Specifies the method used to interpret string offsets.\n Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information\n see https://aka.ms/text-analytics-offsets.\n:type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_3.models.StringIndexType\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the AnalyzeHealthcareEntitiesLROPollingMethod polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AnalyzeHealthcareEntitiesLROPoller that returns either HealthcareJobState or the result of cls(response)\n:rtype: ~...._lro.AnalyzeHealthcareEntitiesLROPoller[~azure.ai.textanalytics.v3_1_preview_3.models.HealthcareJobState]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def begin_health(\n self,\n documents: List[\"_models.MultiLanguageInput\"],\n model_version: Optional[str] = None,\n string_index_type: Optional[Union[str, \"_models.StringIndexType\"]] = \"TextElements_v8\",\n **kwargs\n) -\u003e AnalyzeHealthcareEntitiesAsyncLROPoller[\"_models.HealthcareJobState\"]:\n", + "doc": "\"\"\"Submit healthcare analysis job.\n\nStart a healthcare analysis job to recognize healthcare related entities (drugs, conditions,\nsymptoms, etc) and their relations.\n\n:param documents: The set of documents to process as part of this batch.\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_3.models.MultiLanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param string_index_type: (Optional) Specifies the method used to interpret string offsets.\n Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information\n see https://aka.ms/text-analytics-offsets.\n:type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_3.models.StringIndexType\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the AnalyzeHealthcareEntitiesAsyncLROPollingMethod polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AnalyzeHealthcareEntitiesAsyncLROPoller that returns either HealthcareJobState or the result of cls(response)\n:rtype: ~....._async_lro.AnalyzeHealthcareEntitiesAsyncLROPoller[~azure.ai.textanalytics.v3_1_preview_3.models.HealthcareJobState]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + }, + "call": "documents, model_version, string_index_type" + }, + "entities_recognition_general" : { + "sync": { + "signature": "def entities_recognition_general(\n self,\n documents, # type: List[\"_models.MultiLanguageInput\"]\n model_version=None, # type: Optional[str]\n show_stats=None, # type: Optional[bool]\n string_index_type=\"TextElements_v8\", # type: Optional[Union[str, \"_models.StringIndexType\"]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Named Entity Recognition.\n\nThe API returns a list of general named entities in a given document. For the list of supported\nentity types, check :code:`\u003ca href=\"https://aka.ms/taner\"\u003eSupported Entity Types in Text\nAnalytics API\u003c/a\u003e`. See the :code:`\u003ca href=\"https://aka.ms/talangs\"\u003eSupported languages in Text\nAnalytics API\u003c/a\u003e` for the list of enabled languages.\n\n:param documents: The set of documents to process as part of this batch.\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_3.models.MultiLanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:param string_index_type: (Optional) Specifies the method used to interpret string offsets.\n Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information\n see https://aka.ms/text-analytics-offsets.\n:type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_3.models.StringIndexType\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: EntitiesResult, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_3.models.EntitiesResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def entities_recognition_general(\n self,\n documents: List[\"_models.MultiLanguageInput\"],\n model_version: Optional[str] = None,\n show_stats: Optional[bool] = None,\n string_index_type: Optional[Union[str, \"_models.StringIndexType\"]] = \"TextElements_v8\",\n **kwargs\n) -\u003e \"_models.EntitiesResult\":\n", + "doc": "\"\"\"Named Entity Recognition.\n\nThe API returns a list of general named entities in a given document. For the list of supported\nentity types, check :code:`\u003ca href=\"https://aka.ms/taner\"\u003eSupported Entity Types in Text\nAnalytics API\u003c/a\u003e`. See the :code:`\u003ca href=\"https://aka.ms/talangs\"\u003eSupported languages in Text\nAnalytics API\u003c/a\u003e` for the list of enabled languages.\n\n:param documents: The set of documents to process as part of this batch.\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_3.models.MultiLanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:param string_index_type: (Optional) Specifies the method used to interpret string offsets.\n Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information\n see https://aka.ms/text-analytics-offsets.\n:type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_3.models.StringIndexType\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: EntitiesResult, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_3.models.EntitiesResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "documents, model_version, show_stats, string_index_type" + }, + "entities_recognition_pii" : { + "sync": { + "signature": "def entities_recognition_pii(\n self,\n documents, # type: List[\"_models.MultiLanguageInput\"]\n model_version=None, # type: Optional[str]\n show_stats=None, # type: Optional[bool]\n domain=None, # type: Optional[str]\n string_index_type=\"TextElements_v8\", # type: Optional[Union[str, \"_models.StringIndexType\"]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Entities containing personal information.\n\nThe API returns a list of entities with personal information (\\\"SSN\\\", \\\"Bank Account\\\" etc) in\nthe document. For the list of supported entity types, check :code:`\u003ca\nhref=\"https://aka.ms/tanerpii\"\u003eSupported Entity Types in Text Analytics API\u003c/a\u003e`. See the\n:code:`\u003ca href=\"https://aka.ms/talangs\"\u003eSupported languages in Text Analytics API\u003c/a\u003e` for the\nlist of enabled languages.\n\n:param documents: The set of documents to process as part of this batch.\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_3.models.MultiLanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:param domain: (Optional) if specified, will set the PII domain to include only a subset of the\n entity categories. Possible values include: \u0027PHI\u0027, \u0027none\u0027.\n:type domain: str\n:param string_index_type: (Optional) Specifies the method used to interpret string offsets.\n Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information\n see https://aka.ms/text-analytics-offsets.\n:type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_3.models.StringIndexType\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: PiiResult, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_3.models.PiiResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def entities_recognition_pii(\n self,\n documents: List[\"_models.MultiLanguageInput\"],\n model_version: Optional[str] = None,\n show_stats: Optional[bool] = None,\n domain: Optional[str] = None,\n string_index_type: Optional[Union[str, \"_models.StringIndexType\"]] = \"TextElements_v8\",\n **kwargs\n) -\u003e \"_models.PiiResult\":\n", + "doc": "\"\"\"Entities containing personal information.\n\nThe API returns a list of entities with personal information (\\\"SSN\\\", \\\"Bank Account\\\" etc) in\nthe document. For the list of supported entity types, check :code:`\u003ca\nhref=\"https://aka.ms/tanerpii\"\u003eSupported Entity Types in Text Analytics API\u003c/a\u003e`. See the\n:code:`\u003ca href=\"https://aka.ms/talangs\"\u003eSupported languages in Text Analytics API\u003c/a\u003e` for the\nlist of enabled languages.\n\n:param documents: The set of documents to process as part of this batch.\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_3.models.MultiLanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:param domain: (Optional) if specified, will set the PII domain to include only a subset of the\n entity categories. Possible values include: \u0027PHI\u0027, \u0027none\u0027.\n:type domain: str\n:param string_index_type: (Optional) Specifies the method used to interpret string offsets.\n Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information\n see https://aka.ms/text-analytics-offsets.\n:type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_3.models.StringIndexType\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: PiiResult, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_3.models.PiiResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "documents, model_version, show_stats, domain, string_index_type" + }, + "entities_linking" : { + "sync": { + "signature": "def entities_linking(\n self,\n documents, # type: List[\"_models.MultiLanguageInput\"]\n model_version=None, # type: Optional[str]\n show_stats=None, # type: Optional[bool]\n string_index_type=\"TextElements_v8\", # type: Optional[Union[str, \"_models.StringIndexType\"]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Linked entities from a well-known knowledge base.\n\nThe API returns a list of recognized entities with links to a well-known knowledge base. See\nthe :code:`\u003ca href=\"https://aka.ms/talangs\"\u003eSupported languages in Text Analytics API\u003c/a\u003e` for\nthe list of enabled languages.\n\n:param documents: The set of documents to process as part of this batch.\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_3.models.MultiLanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:param string_index_type: (Optional) Specifies the method used to interpret string offsets.\n Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information\n see https://aka.ms/text-analytics-offsets.\n:type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_3.models.StringIndexType\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: EntityLinkingResult, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_3.models.EntityLinkingResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def entities_linking(\n self,\n documents: List[\"_models.MultiLanguageInput\"],\n model_version: Optional[str] = None,\n show_stats: Optional[bool] = None,\n string_index_type: Optional[Union[str, \"_models.StringIndexType\"]] = \"TextElements_v8\",\n **kwargs\n) -\u003e \"_models.EntityLinkingResult\":\n", + "doc": "\"\"\"Linked entities from a well-known knowledge base.\n\nThe API returns a list of recognized entities with links to a well-known knowledge base. See\nthe :code:`\u003ca href=\"https://aka.ms/talangs\"\u003eSupported languages in Text Analytics API\u003c/a\u003e` for\nthe list of enabled languages.\n\n:param documents: The set of documents to process as part of this batch.\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_3.models.MultiLanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:param string_index_type: (Optional) Specifies the method used to interpret string offsets.\n Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information\n see https://aka.ms/text-analytics-offsets.\n:type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_3.models.StringIndexType\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: EntityLinkingResult, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_3.models.EntityLinkingResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "documents, model_version, show_stats, string_index_type" + }, + "key_phrases" : { + "sync": { + "signature": "def key_phrases(\n self,\n documents, # type: List[\"_models.MultiLanguageInput\"]\n model_version=None, # type: Optional[str]\n show_stats=None, # type: Optional[bool]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Key Phrases.\n\nThe API returns a list of strings denoting the key phrases in the input text. See the :code:`\u003ca\nhref=\"https://aka.ms/talangs\"\u003eSupported languages in Text Analytics API\u003c/a\u003e` for the list of\nenabled languages.\n\n:param documents: The set of documents to process as part of this batch.\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_3.models.MultiLanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyPhraseResult, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_3.models.KeyPhraseResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def key_phrases(\n self,\n documents: List[\"_models.MultiLanguageInput\"],\n model_version: Optional[str] = None,\n show_stats: Optional[bool] = None,\n **kwargs\n) -\u003e \"_models.KeyPhraseResult\":\n", + "doc": "\"\"\"Key Phrases.\n\nThe API returns a list of strings denoting the key phrases in the input text. See the :code:`\u003ca\nhref=\"https://aka.ms/talangs\"\u003eSupported languages in Text Analytics API\u003c/a\u003e` for the list of\nenabled languages.\n\n:param documents: The set of documents to process as part of this batch.\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_3.models.MultiLanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyPhraseResult, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_3.models.KeyPhraseResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "documents, model_version, show_stats" + }, + "languages" : { + "sync": { + "signature": "def languages(\n self,\n documents, # type: List[\"_models.LanguageInput\"]\n model_version=None, # type: Optional[str]\n show_stats=None, # type: Optional[bool]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Detect Language.\n\nThe API returns the detected language and a numeric score between 0 and 1. Scores close to 1\nindicate 100% certainty that the identified language is true. See the :code:`\u003ca\nhref=\"https://aka.ms/talangs\"\u003eSupported languages in Text Analytics API\u003c/a\u003e` for the list of\nenabled languages.\n\n:param documents:\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_3.models.LanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: LanguageResult, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_3.models.LanguageResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def languages(\n self,\n documents: List[\"_models.LanguageInput\"],\n model_version: Optional[str] = None,\n show_stats: Optional[bool] = None,\n **kwargs\n) -\u003e \"_models.LanguageResult\":\n", + "doc": "\"\"\"Detect Language.\n\nThe API returns the detected language and a numeric score between 0 and 1. Scores close to 1\nindicate 100% certainty that the identified language is true. See the :code:`\u003ca\nhref=\"https://aka.ms/talangs\"\u003eSupported languages in Text Analytics API\u003c/a\u003e` for the list of\nenabled languages.\n\n:param documents:\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_3.models.LanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: LanguageResult, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_3.models.LanguageResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "documents, model_version, show_stats" + }, + "sentiment" : { + "sync": { + "signature": "def sentiment(\n self,\n documents, # type: List[\"_models.MultiLanguageInput\"]\n model_version=None, # type: Optional[str]\n show_stats=None, # type: Optional[bool]\n opinion_mining=None, # type: Optional[bool]\n string_index_type=\"TextElements_v8\", # type: Optional[Union[str, \"_models.StringIndexType\"]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Sentiment.\n\nThe API returns a detailed sentiment analysis for the input text. The analysis is done in\nmultiple levels of granularity, start from the a document level, down to sentence and key terms\n(aspects) and opinions.\n\n:param documents: The set of documents to process as part of this batch.\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_3.models.MultiLanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:param opinion_mining: (Optional) if set to true, response will contain input and document\n level statistics including aspect-based sentiment analysis results.\n:type opinion_mining: bool\n:param string_index_type: (Optional) Specifies the method used to interpret string offsets.\n Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information\n see https://aka.ms/text-analytics-offsets.\n:type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_3.models.StringIndexType\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SentimentResponse, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_3.models.SentimentResponse\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def sentiment(\n self,\n documents: List[\"_models.MultiLanguageInput\"],\n model_version: Optional[str] = None,\n show_stats: Optional[bool] = None,\n opinion_mining: Optional[bool] = None,\n string_index_type: Optional[Union[str, \"_models.StringIndexType\"]] = \"TextElements_v8\",\n **kwargs\n) -\u003e \"_models.SentimentResponse\":\n", + "doc": "\"\"\"Sentiment.\n\nThe API returns a detailed sentiment analysis for the input text. The analysis is done in\nmultiple levels of granularity, start from the a document level, down to sentence and key terms\n(aspects) and opinions.\n\n:param documents: The set of documents to process as part of this batch.\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_3.models.MultiLanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:param opinion_mining: (Optional) if set to true, response will contain input and document\n level statistics including aspect-based sentiment analysis results.\n:type opinion_mining: bool\n:param string_index_type: (Optional) Specifies the method used to interpret string offsets.\n Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information\n see https://aka.ms/text-analytics-offsets.\n:type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_3.models.StringIndexType\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SentimentResponse, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_3.models.SentimentResponse\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "documents, model_version, show_stats, opinion_mining, string_index_type" + } + } + } +} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_3/aio/operations/_text_analytics_client_operations.py b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_3/aio/operations/_text_analytics_client_operations.py index 4271cfa5ad8f..07b6892a3009 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_3/aio/operations/_text_analytics_client_operations.py +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_3/aio/operations/_text_analytics_client_operations.py @@ -8,12 +8,7 @@ from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union import warnings -from ....._async_lro import ( - AnalyzeHealthcareEntitiesAsyncLROPoller, - AnalyzeHealthcareEntitiesAsyncLROPollingMethod, - AsyncAnalyzeBatchActionsLROPoller, - AsyncAnalyzeBatchActionsLROPollingMethod -) +from ....._async_lro import AnalyzeHealthcareEntitiesAsyncLROPoller, AnalyzeHealthcareEntitiesAsyncLROPollingMethod, AsyncAnalyzeBatchActionsLROPoller, AsyncAnalyzeBatchActionsLROPollingMethod from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest @@ -106,7 +101,7 @@ async def begin_analyze( :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncAnalyzeBatchActionsLROPoller that returns either AnalyzeJobState or the result of cls(response) - :rtype: ~...._async_lro.AsyncAnalyzeBatchActionsLROPoller[~azure.ai.textanalytics.v3_1_preview_3.models.AnalyzeJobState] + :rtype: ~....._async_lro.AsyncAnalyzeBatchActionsLROPoller[~azure.ai.textanalytics.v3_1_preview_3.models.AnalyzeJobState] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', False) # type: Union[bool, AsyncPollingMethod] diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_3/models/__init__.py b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_3/models/__init__.py index 5b0c3c08fc83..2283433631d4 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_3/models/__init__.py +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_3/models/__init__.py @@ -8,6 +8,7 @@ try: from ._models_py3 import AnalyzeBatchInput + from ._models_py3 import AnalyzeJobMetadata from ._models_py3 import AnalyzeJobState from ._models_py3 import AspectConfidenceScoreLabel from ._models_py3 import AspectRelation @@ -71,6 +72,7 @@ from ._models_py3 import TextAnalyticsWarning except (SyntaxError, ImportError): from ._models import AnalyzeBatchInput # type: ignore + from ._models import AnalyzeJobMetadata # type: ignore from ._models import AnalyzeJobState # type: ignore from ._models import AspectConfidenceScoreLabel # type: ignore from ._models import AspectRelation # type: ignore @@ -149,6 +151,7 @@ __all__ = [ 'AnalyzeBatchInput', + 'AnalyzeJobMetadata', 'AnalyzeJobState', 'AspectConfidenceScoreLabel', 'AspectRelation', diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_3/models/_models.py b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_3/models/_models.py index ebfc34f1abc8..951f9939c49e 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_3/models/_models.py +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_3/models/_models.py @@ -92,59 +92,58 @@ def __init__( self.analysis_input = kwargs['analysis_input'] -class Pagination(msrest.serialization.Model): - """Pagination. - - :param next_link: - :type next_link: str - """ - - _attribute_map = { - 'next_link': {'key': '@nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Pagination, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - - -class TasksState(msrest.serialization.Model): - """TasksState. +class JobMetadata(msrest.serialization.Model): + """JobMetadata. All required parameters must be populated in order to send to Azure. - :param tasks: Required. - :type tasks: ~azure.ai.textanalytics.v3_1_preview_3.models.TasksStateTasks + :param created_date_time: Required. + :type created_date_time: ~datetime.datetime + :param expiration_date_time: + :type expiration_date_time: ~datetime.datetime + :param job_id: Required. + :type job_id: str + :param last_update_date_time: Required. + :type last_update_date_time: ~datetime.datetime + :param status: Required. Possible values include: "notStarted", "running", "succeeded", + "failed", "rejected", "cancelled", "cancelling", "partiallyCompleted". + :type status: str or ~azure.ai.textanalytics.v3_1_preview_3.models.State """ _validation = { - 'tasks': {'required': True}, + 'created_date_time': {'required': True}, + 'job_id': {'required': True}, + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, } _attribute_map = { - 'tasks': {'key': 'tasks', 'type': 'TasksStateTasks'}, + 'created_date_time': {'key': 'createdDateTime', 'type': 'iso-8601'}, + 'expiration_date_time': {'key': 'expirationDateTime', 'type': 'iso-8601'}, + 'job_id': {'key': 'jobId', 'type': 'str'}, + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'status': {'key': 'status', 'type': 'str'}, } def __init__( self, **kwargs ): - super(TasksState, self).__init__(**kwargs) - self.tasks = kwargs['tasks'] + super(JobMetadata, self).__init__(**kwargs) + self.created_date_time = kwargs['created_date_time'] + self.expiration_date_time = kwargs.get('expiration_date_time', None) + self.job_id = kwargs['job_id'] + self.last_update_date_time = kwargs['last_update_date_time'] + self.status = kwargs['status'] -class JobMetadata(msrest.serialization.Model): - """JobMetadata. +class AnalyzeJobMetadata(JobMetadata): + """AnalyzeJobMetadata. All required parameters must be populated in order to send to Azure. :param created_date_time: Required. :type created_date_time: ~datetime.datetime - :param display_name: - :type display_name: str :param expiration_date_time: :type expiration_date_time: ~datetime.datetime :param job_id: Required. @@ -154,6 +153,8 @@ class JobMetadata(msrest.serialization.Model): :param status: Required. Possible values include: "notStarted", "running", "succeeded", "failed", "rejected", "cancelled", "cancelling", "partiallyCompleted". :type status: str or ~azure.ai.textanalytics.v3_1_preview_3.models.State + :param display_name: + :type display_name: str """ _validation = { @@ -165,27 +166,66 @@ class JobMetadata(msrest.serialization.Model): _attribute_map = { 'created_date_time': {'key': 'createdDateTime', 'type': 'iso-8601'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, 'expiration_date_time': {'key': 'expirationDateTime', 'type': 'iso-8601'}, 'job_id': {'key': 'jobId', 'type': 'str'}, 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, 'status': {'key': 'status', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, } def __init__( self, **kwargs ): - super(JobMetadata, self).__init__(**kwargs) - self.created_date_time = kwargs['created_date_time'] + super(AnalyzeJobMetadata, self).__init__(**kwargs) self.display_name = kwargs.get('display_name', None) - self.expiration_date_time = kwargs.get('expiration_date_time', None) - self.job_id = kwargs['job_id'] - self.last_update_date_time = kwargs['last_update_date_time'] - self.status = kwargs['status'] -class AnalyzeJobState(JobMetadata, TasksState, Pagination): +class Pagination(msrest.serialization.Model): + """Pagination. + + :param next_link: + :type next_link: str + """ + + _attribute_map = { + 'next_link': {'key': '@nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Pagination, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + + +class TasksState(msrest.serialization.Model): + """TasksState. + + All required parameters must be populated in order to send to Azure. + + :param tasks: Required. + :type tasks: ~azure.ai.textanalytics.v3_1_preview_3.models.TasksStateTasks + """ + + _validation = { + 'tasks': {'required': True}, + } + + _attribute_map = { + 'tasks': {'key': 'tasks', 'type': 'TasksStateTasks'}, + } + + def __init__( + self, + **kwargs + ): + super(TasksState, self).__init__(**kwargs) + self.tasks = kwargs['tasks'] + + +class AnalyzeJobState(AnalyzeJobMetadata, TasksState, Pagination): """AnalyzeJobState. All required parameters must be populated in order to send to Azure. @@ -196,8 +236,6 @@ class AnalyzeJobState(JobMetadata, TasksState, Pagination): :type tasks: ~azure.ai.textanalytics.v3_1_preview_3.models.TasksStateTasks :param created_date_time: Required. :type created_date_time: ~datetime.datetime - :param display_name: - :type display_name: str :param expiration_date_time: :type expiration_date_time: ~datetime.datetime :param job_id: Required. @@ -207,6 +245,8 @@ class AnalyzeJobState(JobMetadata, TasksState, Pagination): :param status: Required. Possible values include: "notStarted", "running", "succeeded", "failed", "rejected", "cancelled", "cancelling", "partiallyCompleted". :type status: str or ~azure.ai.textanalytics.v3_1_preview_3.models.State + :param display_name: + :type display_name: str :param errors: :type errors: list[~azure.ai.textanalytics.v3_1_preview_3.models.TextAnalyticsError] :param statistics: if showStats=true was specified in the request this field will contain @@ -226,11 +266,11 @@ class AnalyzeJobState(JobMetadata, TasksState, Pagination): 'next_link': {'key': '@nextLink', 'type': 'str'}, 'tasks': {'key': 'tasks', 'type': 'TasksStateTasks'}, 'created_date_time': {'key': 'createdDateTime', 'type': 'iso-8601'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, 'expiration_date_time': {'key': 'expirationDateTime', 'type': 'iso-8601'}, 'job_id': {'key': 'jobId', 'type': 'str'}, 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, 'status': {'key': 'status', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, 'errors': {'key': 'errors', 'type': '[TextAnalyticsError]'}, 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, } @@ -246,20 +286,20 @@ def __init__( self.statistics = kwargs.get('statistics', None) self.next_link = kwargs.get('next_link', None) self.created_date_time = kwargs['created_date_time'] - self.display_name = kwargs.get('display_name', None) self.expiration_date_time = kwargs.get('expiration_date_time', None) self.job_id = kwargs['job_id'] self.last_update_date_time = kwargs['last_update_date_time'] self.status = kwargs['status'] + self.display_name = kwargs.get('display_name', None) self.errors = kwargs.get('errors', None) self.statistics = kwargs.get('statistics', None) self.tasks = kwargs['tasks'] self.created_date_time = kwargs['created_date_time'] - self.display_name = kwargs.get('display_name', None) self.expiration_date_time = kwargs.get('expiration_date_time', None) self.job_id = kwargs['job_id'] self.last_update_date_time = kwargs['last_update_date_time'] self.status = kwargs['status'] + self.display_name = kwargs.get('display_name', None) self.errors = kwargs.get('errors', None) self.statistics = kwargs.get('statistics', None) @@ -1049,8 +1089,6 @@ class HealthcareJobState(JobMetadata, Pagination): :type next_link: str :param created_date_time: Required. :type created_date_time: ~datetime.datetime - :param display_name: - :type display_name: str :param expiration_date_time: :type expiration_date_time: ~datetime.datetime :param job_id: Required. @@ -1076,7 +1114,6 @@ class HealthcareJobState(JobMetadata, Pagination): _attribute_map = { 'next_link': {'key': '@nextLink', 'type': 'str'}, 'created_date_time': {'key': 'createdDateTime', 'type': 'iso-8601'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, 'expiration_date_time': {'key': 'expirationDateTime', 'type': 'iso-8601'}, 'job_id': {'key': 'jobId', 'type': 'str'}, 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, @@ -1094,7 +1131,6 @@ def __init__( self.results = kwargs.get('results', None) self.errors = kwargs.get('errors', None) self.created_date_time = kwargs['created_date_time'] - self.display_name = kwargs.get('display_name', None) self.expiration_date_time = kwargs.get('expiration_date_time', None) self.job_id = kwargs['job_id'] self.last_update_date_time = kwargs['last_update_date_time'] diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_3/models/_models_py3.py b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_3/models/_models_py3.py index 46cfa90ec725..0f8ce3bb049b 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_3/models/_models_py3.py +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_3/models/_models_py3.py @@ -105,63 +105,64 @@ def __init__( self.analysis_input = analysis_input -class Pagination(msrest.serialization.Model): - """Pagination. - - :param next_link: - :type next_link: str - """ - - _attribute_map = { - 'next_link': {'key': '@nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - next_link: Optional[str] = None, - **kwargs - ): - super(Pagination, self).__init__(**kwargs) - self.next_link = next_link - - -class TasksState(msrest.serialization.Model): - """TasksState. +class JobMetadata(msrest.serialization.Model): + """JobMetadata. All required parameters must be populated in order to send to Azure. - :param tasks: Required. - :type tasks: ~azure.ai.textanalytics.v3_1_preview_3.models.TasksStateTasks + :param created_date_time: Required. + :type created_date_time: ~datetime.datetime + :param expiration_date_time: + :type expiration_date_time: ~datetime.datetime + :param job_id: Required. + :type job_id: str + :param last_update_date_time: Required. + :type last_update_date_time: ~datetime.datetime + :param status: Required. Possible values include: "notStarted", "running", "succeeded", + "failed", "rejected", "cancelled", "cancelling", "partiallyCompleted". + :type status: str or ~azure.ai.textanalytics.v3_1_preview_3.models.State """ _validation = { - 'tasks': {'required': True}, + 'created_date_time': {'required': True}, + 'job_id': {'required': True}, + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, } _attribute_map = { - 'tasks': {'key': 'tasks', 'type': 'TasksStateTasks'}, + 'created_date_time': {'key': 'createdDateTime', 'type': 'iso-8601'}, + 'expiration_date_time': {'key': 'expirationDateTime', 'type': 'iso-8601'}, + 'job_id': {'key': 'jobId', 'type': 'str'}, + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'status': {'key': 'status', 'type': 'str'}, } def __init__( self, *, - tasks: "TasksStateTasks", + created_date_time: datetime.datetime, + job_id: str, + last_update_date_time: datetime.datetime, + status: Union[str, "State"], + expiration_date_time: Optional[datetime.datetime] = None, **kwargs ): - super(TasksState, self).__init__(**kwargs) - self.tasks = tasks + super(JobMetadata, self).__init__(**kwargs) + self.created_date_time = created_date_time + self.expiration_date_time = expiration_date_time + self.job_id = job_id + self.last_update_date_time = last_update_date_time + self.status = status -class JobMetadata(msrest.serialization.Model): - """JobMetadata. +class AnalyzeJobMetadata(JobMetadata): + """AnalyzeJobMetadata. All required parameters must be populated in order to send to Azure. :param created_date_time: Required. :type created_date_time: ~datetime.datetime - :param display_name: - :type display_name: str :param expiration_date_time: :type expiration_date_time: ~datetime.datetime :param job_id: Required. @@ -171,6 +172,8 @@ class JobMetadata(msrest.serialization.Model): :param status: Required. Possible values include: "notStarted", "running", "succeeded", "failed", "rejected", "cancelled", "cancelling", "partiallyCompleted". :type status: str or ~azure.ai.textanalytics.v3_1_preview_3.models.State + :param display_name: + :type display_name: str """ _validation = { @@ -182,11 +185,11 @@ class JobMetadata(msrest.serialization.Model): _attribute_map = { 'created_date_time': {'key': 'createdDateTime', 'type': 'iso-8601'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, 'expiration_date_time': {'key': 'expirationDateTime', 'type': 'iso-8601'}, 'job_id': {'key': 'jobId', 'type': 'str'}, 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, 'status': {'key': 'status', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, } def __init__( @@ -196,20 +199,63 @@ def __init__( job_id: str, last_update_date_time: datetime.datetime, status: Union[str, "State"], - display_name: Optional[str] = None, expiration_date_time: Optional[datetime.datetime] = None, + display_name: Optional[str] = None, **kwargs ): - super(JobMetadata, self).__init__(**kwargs) - self.created_date_time = created_date_time + super(AnalyzeJobMetadata, self).__init__(created_date_time=created_date_time, expiration_date_time=expiration_date_time, job_id=job_id, last_update_date_time=last_update_date_time, status=status, **kwargs) self.display_name = display_name - self.expiration_date_time = expiration_date_time - self.job_id = job_id - self.last_update_date_time = last_update_date_time - self.status = status -class AnalyzeJobState(JobMetadata, TasksState, Pagination): +class Pagination(msrest.serialization.Model): + """Pagination. + + :param next_link: + :type next_link: str + """ + + _attribute_map = { + 'next_link': {'key': '@nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + **kwargs + ): + super(Pagination, self).__init__(**kwargs) + self.next_link = next_link + + +class TasksState(msrest.serialization.Model): + """TasksState. + + All required parameters must be populated in order to send to Azure. + + :param tasks: Required. + :type tasks: ~azure.ai.textanalytics.v3_1_preview_3.models.TasksStateTasks + """ + + _validation = { + 'tasks': {'required': True}, + } + + _attribute_map = { + 'tasks': {'key': 'tasks', 'type': 'TasksStateTasks'}, + } + + def __init__( + self, + *, + tasks: "TasksStateTasks", + **kwargs + ): + super(TasksState, self).__init__(**kwargs) + self.tasks = tasks + + +class AnalyzeJobState(AnalyzeJobMetadata, TasksState, Pagination): """AnalyzeJobState. All required parameters must be populated in order to send to Azure. @@ -220,8 +266,6 @@ class AnalyzeJobState(JobMetadata, TasksState, Pagination): :type tasks: ~azure.ai.textanalytics.v3_1_preview_3.models.TasksStateTasks :param created_date_time: Required. :type created_date_time: ~datetime.datetime - :param display_name: - :type display_name: str :param expiration_date_time: :type expiration_date_time: ~datetime.datetime :param job_id: Required. @@ -231,6 +275,8 @@ class AnalyzeJobState(JobMetadata, TasksState, Pagination): :param status: Required. Possible values include: "notStarted", "running", "succeeded", "failed", "rejected", "cancelled", "cancelling", "partiallyCompleted". :type status: str or ~azure.ai.textanalytics.v3_1_preview_3.models.State + :param display_name: + :type display_name: str :param errors: :type errors: list[~azure.ai.textanalytics.v3_1_preview_3.models.TextAnalyticsError] :param statistics: if showStats=true was specified in the request this field will contain @@ -250,11 +296,11 @@ class AnalyzeJobState(JobMetadata, TasksState, Pagination): 'next_link': {'key': '@nextLink', 'type': 'str'}, 'tasks': {'key': 'tasks', 'type': 'TasksStateTasks'}, 'created_date_time': {'key': 'createdDateTime', 'type': 'iso-8601'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, 'expiration_date_time': {'key': 'expirationDateTime', 'type': 'iso-8601'}, 'job_id': {'key': 'jobId', 'type': 'str'}, 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, 'status': {'key': 'status', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, 'errors': {'key': 'errors', 'type': '[TextAnalyticsError]'}, 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, } @@ -268,33 +314,33 @@ def __init__( last_update_date_time: datetime.datetime, status: Union[str, "State"], next_link: Optional[str] = None, - display_name: Optional[str] = None, expiration_date_time: Optional[datetime.datetime] = None, + display_name: Optional[str] = None, errors: Optional[List["TextAnalyticsError"]] = None, statistics: Optional["RequestStatistics"] = None, **kwargs ): - super(AnalyzeJobState, self).__init__(created_date_time=created_date_time, display_name=display_name, expiration_date_time=expiration_date_time, job_id=job_id, last_update_date_time=last_update_date_time, status=status, tasks=tasks, next_link=next_link, **kwargs) + super(AnalyzeJobState, self).__init__(created_date_time=created_date_time, expiration_date_time=expiration_date_time, job_id=job_id, last_update_date_time=last_update_date_time, status=status, display_name=display_name, tasks=tasks, next_link=next_link, **kwargs) self.next_link = next_link self.tasks = tasks self.errors = errors self.statistics = statistics self.next_link = next_link self.created_date_time = created_date_time - self.display_name = display_name self.expiration_date_time = expiration_date_time self.job_id = job_id self.last_update_date_time = last_update_date_time self.status = status + self.display_name = display_name self.errors = errors self.statistics = statistics self.tasks = tasks self.created_date_time = created_date_time - self.display_name = display_name self.expiration_date_time = expiration_date_time self.job_id = job_id self.last_update_date_time = last_update_date_time self.status = status + self.display_name = display_name self.errors = errors self.statistics = statistics @@ -1175,8 +1221,6 @@ class HealthcareJobState(JobMetadata, Pagination): :type next_link: str :param created_date_time: Required. :type created_date_time: ~datetime.datetime - :param display_name: - :type display_name: str :param expiration_date_time: :type expiration_date_time: ~datetime.datetime :param job_id: Required. @@ -1202,7 +1246,6 @@ class HealthcareJobState(JobMetadata, Pagination): _attribute_map = { 'next_link': {'key': '@nextLink', 'type': 'str'}, 'created_date_time': {'key': 'createdDateTime', 'type': 'iso-8601'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, 'expiration_date_time': {'key': 'expirationDateTime', 'type': 'iso-8601'}, 'job_id': {'key': 'jobId', 'type': 'str'}, 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, @@ -1219,18 +1262,16 @@ def __init__( last_update_date_time: datetime.datetime, status: Union[str, "State"], next_link: Optional[str] = None, - display_name: Optional[str] = None, expiration_date_time: Optional[datetime.datetime] = None, results: Optional["HealthcareResult"] = None, errors: Optional[List["TextAnalyticsError"]] = None, **kwargs ): - super(HealthcareJobState, self).__init__(created_date_time=created_date_time, display_name=display_name, expiration_date_time=expiration_date_time, job_id=job_id, last_update_date_time=last_update_date_time, status=status, next_link=next_link, **kwargs) + super(HealthcareJobState, self).__init__(created_date_time=created_date_time, expiration_date_time=expiration_date_time, job_id=job_id, last_update_date_time=last_update_date_time, status=status, next_link=next_link, **kwargs) self.next_link = next_link self.results = results self.errors = errors self.created_date_time = created_date_time - self.display_name = display_name self.expiration_date_time = expiration_date_time self.job_id = job_id self.last_update_date_time = last_update_date_time diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_3/operations/_text_analytics_client_operations.py b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_3/operations/_text_analytics_client_operations.py index e35bc5c9bc38..4fdad40602c2 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_3/operations/_text_analytics_client_operations.py +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_3/operations/_text_analytics_client_operations.py @@ -8,9 +8,7 @@ from typing import TYPE_CHECKING import warnings -# FIXME: have to manually reconfigure import path for multiapi operation mixin -from ...._lro import AnalyzeHealthcareEntitiesLROPoller, AnalyzeHealthcareEntitiesLROPollingMethod -from ...._lro import AnalyzeBatchActionsLROPoller, AnalyzeBatchActionsLROPollingMethod +from ...._lro import AnalyzeBatchActionsLROPoller, AnalyzeBatchActionsLROPollingMethod, AnalyzeHealthcareEntitiesLROPoller, AnalyzeHealthcareEntitiesLROPollingMethod from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/__init__.py b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/__init__.py new file mode 100644 index 000000000000..ca973ce68900 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/__init__.py @@ -0,0 +1,16 @@ +# 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 ._text_analytics_client import TextAnalyticsClient +__all__ = ['TextAnalyticsClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/_configuration.py b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/_configuration.py new file mode 100644 index 000000000000..e216512dcf2e --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/_configuration.py @@ -0,0 +1,68 @@ +# 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 typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + +VERSION = "unknown" + +class TextAnalyticsClientConfiguration(Configuration): + """Configuration for TextAnalyticsClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). + :type endpoint: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + endpoint, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") + super(TextAnalyticsClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.endpoint = endpoint + self.credential_scopes = kwargs.pop('credential_scopes', ['https://cognitiveservices.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'ai-textanalytics/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/_metadata.json b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/_metadata.json new file mode 100644 index 000000000000..8f580ec35dc6 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/_metadata.json @@ -0,0 +1,264 @@ +{ + "chosen_version": "v3.1-preview.4", + "total_api_version_list": ["v3.1-preview.4"], + "client": { + "name": "TextAnalyticsClient", + "filename": "_text_analytics_client", + "description": "The Text Analytics API is a suite of natural language processing (NLP) services built with best-in-class Microsoft machine learning algorithms. The API can be used to analyze unstructured text for tasks such as sentiment analysis, key phrase extraction and language detection. Functionality for analysis of text specific to the healthcare domain and personal information are also available in the API. Further documentation can be found in :code:`\u003ca href=\"https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview\"\u003ehttps://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview\u003c/a\u003e`.", + "base_url": null, + "custom_base_url": "\u0027{Endpoint}/text/analytics/v3.1-preview.4\u0027", + "azure_arm": false, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.core\": [\"PipelineClient\"]}, \"local\": {\"._configuration\": [\"TextAnalyticsClientConfiguration\"], \"._operations_mixin\": [\"TextAnalyticsClientOperationsMixin\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.core\": [\"AsyncPipelineClient\"]}, \"local\": {\"._configuration\": [\"TextAnalyticsClientConfiguration\"], \"._operations_mixin\": [\"TextAnalyticsClientOperationsMixin\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "endpoint": { + "signature": "endpoint, # type: str", + "description": "Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "endpoint": { + "signature": "endpoint: str,", + "description": "Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, endpoint", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://cognitiveservices.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + }, + "operation_mixins": { + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"ClientAuthenticationError\", \"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"], \"...._lro\": [\"AnalyzeBatchActionsLROPoller\", \"AnalyzeBatchActionsLROPollingMethod\", \"AnalyzeHealthcareEntitiesLROPoller\", \"AnalyzeHealthcareEntitiesLROPollingMethod\"], \"azure.core.polling\": [\"LROPoller\", \"NoPolling\", \"PollingMethod\"], \"azure.core.polling.base_polling\": [\"LROBasePolling\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"List\", \"Optional\", \"TypeVar\", \"Union\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"ClientAuthenticationError\", \"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"], \"....._async_lro\": [\"AnalyzeHealthcareEntitiesAsyncLROPoller\", \"AnalyzeHealthcareEntitiesAsyncLROPollingMethod\", \"AsyncAnalyzeBatchActionsLROPoller\", \"AsyncAnalyzeBatchActionsLROPollingMethod\"], \"azure.core.polling\": [\"AsyncLROPoller\", \"AsyncNoPolling\", \"AsyncPollingMethod\"], \"azure.core.polling.async_base_polling\": [\"AsyncLROBasePolling\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"List\", \"Optional\", \"TypeVar\", \"Union\"]}}}", + "operations": { + "_analyze_initial" : { + "sync": { + "signature": "def _analyze_initial(\n self,\n body=None, # type: Optional[\"_models.AnalyzeBatchInput\"]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"\n\n:param body: Collection of documents to analyze and tasks to execute.\n:type body: ~azure.ai.textanalytics.v3_1_preview_4.models.AnalyzeBatchInput\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: AnalyzeJobState, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.AnalyzeJobState or None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def _analyze_initial(\n self,\n body: Optional[\"_models.AnalyzeBatchInput\"] = None,\n **kwargs\n) -\u003e Optional[\"_models.AnalyzeJobState\"]:\n", + "doc": "\"\"\"\n\n:param body: Collection of documents to analyze and tasks to execute.\n:type body: ~azure.ai.textanalytics.v3_1_preview_4.models.AnalyzeBatchInput\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: AnalyzeJobState, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.AnalyzeJobState or None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "body" + }, + "begin_analyze" : { + "sync": { + "signature": "def begin_analyze(\n self,\n body=None, # type: Optional[\"_models.AnalyzeBatchInput\"]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Submit analysis job.\n\nSubmit a collection of text documents for analysis. Specify one or more unique tasks to be\nexecuted.\n\n:param body: Collection of documents to analyze and tasks to execute.\n:type body: ~azure.ai.textanalytics.v3_1_preview_4.models.AnalyzeBatchInput\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the AnalyzeBatchActionsLROPollingMethod polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AnalyzeBatchActionsLROPoller that returns either AnalyzeJobState or the result of cls(response)\n:rtype: ~...._lro.AnalyzeBatchActionsLROPoller[~azure.ai.textanalytics.v3_1_preview_4.models.AnalyzeJobState]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def begin_analyze(\n self,\n body: Optional[\"_models.AnalyzeBatchInput\"] = None,\n **kwargs\n) -\u003e AsyncAnalyzeBatchActionsLROPoller[\"_models.AnalyzeJobState\"]:\n", + "doc": "\"\"\"Submit analysis job.\n\nSubmit a collection of text documents for analysis. Specify one or more unique tasks to be\nexecuted.\n\n:param body: Collection of documents to analyze and tasks to execute.\n:type body: ~azure.ai.textanalytics.v3_1_preview_4.models.AnalyzeBatchInput\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the AsyncAnalyzeBatchActionsLROPollingMethod polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncAnalyzeBatchActionsLROPoller that returns either AnalyzeJobState or the result of cls(response)\n:rtype: ~....._async_lro.AsyncAnalyzeBatchActionsLROPoller[~azure.ai.textanalytics.v3_1_preview_4.models.AnalyzeJobState]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + }, + "call": "body" + }, + "analyze_status" : { + "sync": { + "signature": "def analyze_status(\n self,\n job_id, # type: str\n show_stats=None, # type: Optional[bool]\n top=20, # type: Optional[int]\n skip=0, # type: Optional[int]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Get analysis status and results.\n\nGet the status of an analysis job. A job may consist of one or more tasks. Once all tasks are\ncompleted, the job will transition to the completed state and results will be available for\neach task.\n\n:param job_id: Job ID for Analyze.\n:type job_id: str\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:param top: (Optional) Set the maximum number of results per task. When both $top and $skip are\n specified, $skip is applied first.\n:type top: int\n:param skip: (Optional) Set the number of elements to offset in the response. When both $top\n and $skip are specified, $skip is applied first.\n:type skip: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: AnalyzeJobState, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.AnalyzeJobState\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def analyze_status(\n self,\n job_id: str,\n show_stats: Optional[bool] = None,\n top: Optional[int] = 20,\n skip: Optional[int] = 0,\n **kwargs\n) -\u003e \"_models.AnalyzeJobState\":\n", + "doc": "\"\"\"Get analysis status and results.\n\nGet the status of an analysis job. A job may consist of one or more tasks. Once all tasks are\ncompleted, the job will transition to the completed state and results will be available for\neach task.\n\n:param job_id: Job ID for Analyze.\n:type job_id: str\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:param top: (Optional) Set the maximum number of results per task. When both $top and $skip are\n specified, $skip is applied first.\n:type top: int\n:param skip: (Optional) Set the number of elements to offset in the response. When both $top\n and $skip are specified, $skip is applied first.\n:type skip: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: AnalyzeJobState, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.AnalyzeJobState\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "job_id, show_stats, top, skip" + }, + "health_status" : { + "sync": { + "signature": "def health_status(\n self,\n job_id, # type: str\n top=20, # type: Optional[int]\n skip=0, # type: Optional[int]\n show_stats=None, # type: Optional[bool]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Get healthcare analysis job status and results.\n\nGet details of the healthcare prediction job specified by the jobId.\n\n:param job_id: Job ID.\n:type job_id: str\n:param top: (Optional) Set the maximum number of results per task. When both $top and $skip are\n specified, $skip is applied first.\n:type top: int\n:param skip: (Optional) Set the number of elements to offset in the response. When both $top\n and $skip are specified, $skip is applied first.\n:type skip: int\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: HealthcareJobState, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.HealthcareJobState\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def health_status(\n self,\n job_id: str,\n top: Optional[int] = 20,\n skip: Optional[int] = 0,\n show_stats: Optional[bool] = None,\n **kwargs\n) -\u003e \"_models.HealthcareJobState\":\n", + "doc": "\"\"\"Get healthcare analysis job status and results.\n\nGet details of the healthcare prediction job specified by the jobId.\n\n:param job_id: Job ID.\n:type job_id: str\n:param top: (Optional) Set the maximum number of results per task. When both $top and $skip are\n specified, $skip is applied first.\n:type top: int\n:param skip: (Optional) Set the number of elements to offset in the response. When both $top\n and $skip are specified, $skip is applied first.\n:type skip: int\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: HealthcareJobState, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.HealthcareJobState\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "job_id, top, skip, show_stats" + }, + "_cancel_health_job_initial" : { + "sync": { + "signature": "def _cancel_health_job_initial(\n self,\n job_id, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"\n\n:param job_id: Job ID.\n:type job_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def _cancel_health_job_initial(\n self,\n job_id: str,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"\n\n:param job_id: Job ID.\n:type job_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "job_id" + }, + "begin_cancel_health_job" : { + "sync": { + "signature": "def begin_cancel_health_job(\n self,\n job_id, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Cancel healthcare prediction job.\n\nCancel healthcare prediction job.\n\n:param job_id: Job ID.\n:type job_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the LROBasePolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def begin_cancel_health_job(\n self,\n job_id: str,\n **kwargs\n) -\u003e AsyncLROPoller[None]:\n", + "doc": "\"\"\"Cancel healthcare prediction job.\n\nCancel healthcare prediction job.\n\n:param job_id: Job ID.\n:type job_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the AsyncLROBasePolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + }, + "call": "job_id" + }, + "_health_initial" : { + "sync": { + "signature": "def _health_initial(\n self,\n documents, # type: List[\"_models.MultiLanguageInput\"]\n model_version=None, # type: Optional[str]\n string_index_type=\"TextElements_v8\", # type: Optional[Union[str, \"_models.StringIndexType\"]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"\n\n:param documents: The set of documents to process as part of this batch.\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.MultiLanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param string_index_type: (Optional) Specifies the method used to interpret string offsets.\n Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information\n see https://aka.ms/text-analytics-offsets.\n:type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_4.models.StringIndexType\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: HealthcareJobState, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.HealthcareJobState or None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def _health_initial(\n self,\n documents: List[\"_models.MultiLanguageInput\"],\n model_version: Optional[str] = None,\n string_index_type: Optional[Union[str, \"_models.StringIndexType\"]] = \"TextElements_v8\",\n **kwargs\n) -\u003e Optional[\"_models.HealthcareJobState\"]:\n", + "doc": "\"\"\"\n\n:param documents: The set of documents to process as part of this batch.\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.MultiLanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param string_index_type: (Optional) Specifies the method used to interpret string offsets.\n Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information\n see https://aka.ms/text-analytics-offsets.\n:type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_4.models.StringIndexType\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: HealthcareJobState, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.HealthcareJobState or None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "documents, model_version, string_index_type" + }, + "begin_health" : { + "sync": { + "signature": "def begin_health(\n self,\n documents, # type: List[\"_models.MultiLanguageInput\"]\n model_version=None, # type: Optional[str]\n string_index_type=\"TextElements_v8\", # type: Optional[Union[str, \"_models.StringIndexType\"]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Submit healthcare analysis job.\n\nStart a healthcare analysis job to recognize healthcare related entities (drugs, conditions,\nsymptoms, etc) and their relations.\n\n:param documents: The set of documents to process as part of this batch.\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.MultiLanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param string_index_type: (Optional) Specifies the method used to interpret string offsets.\n Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information\n see https://aka.ms/text-analytics-offsets.\n:type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_4.models.StringIndexType\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the AnalyzeHealthcareEntitiesLROPollingMethod polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AnalyzeHealthcareEntitiesLROPoller that returns either HealthcareJobState or the result of cls(response)\n:rtype: ~...._lro.AnalyzeHealthcareEntitiesLROPoller[~azure.ai.textanalytics.v3_1_preview_4.models.HealthcareJobState]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def begin_health(\n self,\n documents: List[\"_models.MultiLanguageInput\"],\n model_version: Optional[str] = None,\n string_index_type: Optional[Union[str, \"_models.StringIndexType\"]] = \"TextElements_v8\",\n **kwargs\n) -\u003e AnalyzeHealthcareEntitiesAsyncLROPoller[\"_models.HealthcareJobState\"]:\n", + "doc": "\"\"\"Submit healthcare analysis job.\n\nStart a healthcare analysis job to recognize healthcare related entities (drugs, conditions,\nsymptoms, etc) and their relations.\n\n:param documents: The set of documents to process as part of this batch.\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.MultiLanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param string_index_type: (Optional) Specifies the method used to interpret string offsets.\n Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information\n see https://aka.ms/text-analytics-offsets.\n:type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_4.models.StringIndexType\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the AnalyzeHealthcareEntitiesAsyncLROPollingMethod polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AnalyzeHealthcareEntitiesAsyncLROPoller that returns either HealthcareJobState or the result of cls(response)\n:rtype: ~....._async_lro.AnalyzeHealthcareEntitiesAsyncLROPoller[~azure.ai.textanalytics.v3_1_preview_4.models.HealthcareJobState]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + }, + "call": "documents, model_version, string_index_type" + }, + "entities_recognition_general" : { + "sync": { + "signature": "def entities_recognition_general(\n self,\n documents, # type: List[\"_models.MultiLanguageInput\"]\n model_version=None, # type: Optional[str]\n show_stats=None, # type: Optional[bool]\n string_index_type=\"TextElements_v8\", # type: Optional[Union[str, \"_models.StringIndexType\"]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Named Entity Recognition.\n\nThe API returns a list of general named entities in a given document. For the list of supported\nentity types, check :code:`\u003ca href=\"https://aka.ms/taner\"\u003eSupported Entity Types in Text\nAnalytics API\u003c/a\u003e`. See the :code:`\u003ca href=\"https://aka.ms/talangs\"\u003eSupported languages in Text\nAnalytics API\u003c/a\u003e` for the list of enabled languages.\n\n:param documents: The set of documents to process as part of this batch.\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.MultiLanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:param string_index_type: (Optional) Specifies the method used to interpret string offsets.\n Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information\n see https://aka.ms/text-analytics-offsets.\n:type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_4.models.StringIndexType\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: EntitiesResult, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.EntitiesResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def entities_recognition_general(\n self,\n documents: List[\"_models.MultiLanguageInput\"],\n model_version: Optional[str] = None,\n show_stats: Optional[bool] = None,\n string_index_type: Optional[Union[str, \"_models.StringIndexType\"]] = \"TextElements_v8\",\n **kwargs\n) -\u003e \"_models.EntitiesResult\":\n", + "doc": "\"\"\"Named Entity Recognition.\n\nThe API returns a list of general named entities in a given document. For the list of supported\nentity types, check :code:`\u003ca href=\"https://aka.ms/taner\"\u003eSupported Entity Types in Text\nAnalytics API\u003c/a\u003e`. See the :code:`\u003ca href=\"https://aka.ms/talangs\"\u003eSupported languages in Text\nAnalytics API\u003c/a\u003e` for the list of enabled languages.\n\n:param documents: The set of documents to process as part of this batch.\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.MultiLanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:param string_index_type: (Optional) Specifies the method used to interpret string offsets.\n Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information\n see https://aka.ms/text-analytics-offsets.\n:type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_4.models.StringIndexType\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: EntitiesResult, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.EntitiesResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "documents, model_version, show_stats, string_index_type" + }, + "entities_recognition_pii" : { + "sync": { + "signature": "def entities_recognition_pii(\n self,\n documents, # type: List[\"_models.MultiLanguageInput\"]\n model_version=None, # type: Optional[str]\n show_stats=None, # type: Optional[bool]\n domain=None, # type: Optional[str]\n string_index_type=\"TextElements_v8\", # type: Optional[Union[str, \"_models.StringIndexType\"]]\n pii_categories=None, # type: Optional[List[Union[str, \"_models.PiiCategory\"]]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Entities containing personal information.\n\nThe API returns a list of entities with personal information (\\\"SSN\\\", \\\"Bank Account\\\" etc) in\nthe document. For the list of supported entity types, check :code:`\u003ca\nhref=\"https://aka.ms/tanerpii\"\u003eSupported Entity Types in Text Analytics API\u003c/a\u003e`. See the\n:code:`\u003ca href=\"https://aka.ms/talangs\"\u003eSupported languages in Text Analytics API\u003c/a\u003e` for the\nlist of enabled languages.\n\n:param documents: The set of documents to process as part of this batch.\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.MultiLanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:param domain: (Optional) if specified, will set the PII domain to include only a subset of the\n entity categories. Possible values include: \u0027PHI\u0027, \u0027none\u0027.\n:type domain: str\n:param string_index_type: (Optional) Specifies the method used to interpret string offsets.\n Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information\n see https://aka.ms/text-analytics-offsets.\n:type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_4.models.StringIndexType\n:param pii_categories: (Optional) describes the PII categories to return.\n:type pii_categories: list[str or ~azure.ai.textanalytics.v3_1_preview_4.models.PiiCategory]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: PiiResult, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.PiiResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def entities_recognition_pii(\n self,\n documents: List[\"_models.MultiLanguageInput\"],\n model_version: Optional[str] = None,\n show_stats: Optional[bool] = None,\n domain: Optional[str] = None,\n string_index_type: Optional[Union[str, \"_models.StringIndexType\"]] = \"TextElements_v8\",\n pii_categories: Optional[List[Union[str, \"_models.PiiCategory\"]]] = None,\n **kwargs\n) -\u003e \"_models.PiiResult\":\n", + "doc": "\"\"\"Entities containing personal information.\n\nThe API returns a list of entities with personal information (\\\"SSN\\\", \\\"Bank Account\\\" etc) in\nthe document. For the list of supported entity types, check :code:`\u003ca\nhref=\"https://aka.ms/tanerpii\"\u003eSupported Entity Types in Text Analytics API\u003c/a\u003e`. See the\n:code:`\u003ca href=\"https://aka.ms/talangs\"\u003eSupported languages in Text Analytics API\u003c/a\u003e` for the\nlist of enabled languages.\n\n:param documents: The set of documents to process as part of this batch.\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.MultiLanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:param domain: (Optional) if specified, will set the PII domain to include only a subset of the\n entity categories. Possible values include: \u0027PHI\u0027, \u0027none\u0027.\n:type domain: str\n:param string_index_type: (Optional) Specifies the method used to interpret string offsets.\n Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information\n see https://aka.ms/text-analytics-offsets.\n:type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_4.models.StringIndexType\n:param pii_categories: (Optional) describes the PII categories to return.\n:type pii_categories: list[str or ~azure.ai.textanalytics.v3_1_preview_4.models.PiiCategory]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: PiiResult, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.PiiResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "documents, model_version, show_stats, domain, string_index_type, pii_categories" + }, + "entities_linking" : { + "sync": { + "signature": "def entities_linking(\n self,\n documents, # type: List[\"_models.MultiLanguageInput\"]\n model_version=None, # type: Optional[str]\n show_stats=None, # type: Optional[bool]\n string_index_type=\"TextElements_v8\", # type: Optional[Union[str, \"_models.StringIndexType\"]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Linked entities from a well known knowledge base.\n\nThe API returns a list of recognized entities with links to a well known knowledge base. See\nthe :code:`\u003ca href=\"https://aka.ms/talangs\"\u003eSupported languages in Text Analytics API\u003c/a\u003e` for\nthe list of enabled languages.\n\n:param documents: The set of documents to process as part of this batch.\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.MultiLanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:param string_index_type: (Optional) Specifies the method used to interpret string offsets.\n Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information\n see https://aka.ms/text-analytics-offsets.\n:type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_4.models.StringIndexType\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: EntityLinkingResult, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.EntityLinkingResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def entities_linking(\n self,\n documents: List[\"_models.MultiLanguageInput\"],\n model_version: Optional[str] = None,\n show_stats: Optional[bool] = None,\n string_index_type: Optional[Union[str, \"_models.StringIndexType\"]] = \"TextElements_v8\",\n **kwargs\n) -\u003e \"_models.EntityLinkingResult\":\n", + "doc": "\"\"\"Linked entities from a well known knowledge base.\n\nThe API returns a list of recognized entities with links to a well known knowledge base. See\nthe :code:`\u003ca href=\"https://aka.ms/talangs\"\u003eSupported languages in Text Analytics API\u003c/a\u003e` for\nthe list of enabled languages.\n\n:param documents: The set of documents to process as part of this batch.\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.MultiLanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:param string_index_type: (Optional) Specifies the method used to interpret string offsets.\n Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information\n see https://aka.ms/text-analytics-offsets.\n:type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_4.models.StringIndexType\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: EntityLinkingResult, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.EntityLinkingResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "documents, model_version, show_stats, string_index_type" + }, + "key_phrases" : { + "sync": { + "signature": "def key_phrases(\n self,\n documents, # type: List[\"_models.MultiLanguageInput\"]\n model_version=None, # type: Optional[str]\n show_stats=None, # type: Optional[bool]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Key Phrases.\n\nThe API returns a list of strings denoting the key phrases in the input text. See the :code:`\u003ca\nhref=\"https://aka.ms/talangs\"\u003eSupported languages in Text Analytics API\u003c/a\u003e` for the list of\nenabled languages.\n\n:param documents: The set of documents to process as part of this batch.\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.MultiLanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyPhraseResult, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.KeyPhraseResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def key_phrases(\n self,\n documents: List[\"_models.MultiLanguageInput\"],\n model_version: Optional[str] = None,\n show_stats: Optional[bool] = None,\n **kwargs\n) -\u003e \"_models.KeyPhraseResult\":\n", + "doc": "\"\"\"Key Phrases.\n\nThe API returns a list of strings denoting the key phrases in the input text. See the :code:`\u003ca\nhref=\"https://aka.ms/talangs\"\u003eSupported languages in Text Analytics API\u003c/a\u003e` for the list of\nenabled languages.\n\n:param documents: The set of documents to process as part of this batch.\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.MultiLanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyPhraseResult, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.KeyPhraseResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "documents, model_version, show_stats" + }, + "languages" : { + "sync": { + "signature": "def languages(\n self,\n documents, # type: List[\"_models.LanguageInput\"]\n model_version=None, # type: Optional[str]\n show_stats=None, # type: Optional[bool]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Detect Language.\n\nThe API returns the detected language and a numeric score between 0 and 1. Scores close to 1\nindicate 100% certainty that the identified language is true. See the :code:`\u003ca\nhref=\"https://aka.ms/talangs\"\u003eSupported languages in Text Analytics API\u003c/a\u003e` for the list of\nenabled languages.\n\n:param documents:\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.LanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: LanguageResult, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.LanguageResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def languages(\n self,\n documents: List[\"_models.LanguageInput\"],\n model_version: Optional[str] = None,\n show_stats: Optional[bool] = None,\n **kwargs\n) -\u003e \"_models.LanguageResult\":\n", + "doc": "\"\"\"Detect Language.\n\nThe API returns the detected language and a numeric score between 0 and 1. Scores close to 1\nindicate 100% certainty that the identified language is true. See the :code:`\u003ca\nhref=\"https://aka.ms/talangs\"\u003eSupported languages in Text Analytics API\u003c/a\u003e` for the list of\nenabled languages.\n\n:param documents:\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.LanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: LanguageResult, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.LanguageResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "documents, model_version, show_stats" + }, + "sentiment" : { + "sync": { + "signature": "def sentiment(\n self,\n documents, # type: List[\"_models.MultiLanguageInput\"]\n model_version=None, # type: Optional[str]\n show_stats=None, # type: Optional[bool]\n opinion_mining=None, # type: Optional[bool]\n string_index_type=\"TextElements_v8\", # type: Optional[Union[str, \"_models.StringIndexType\"]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Sentiment.\n\nThe API returns a detailed sentiment analysis for the input text. The analysis is done in\nmultiple levels of granularity, start from the a document level, down to sentence and key terms\n(targets and assessments).\n\n:param documents: The set of documents to process as part of this batch.\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.MultiLanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:param opinion_mining: (Optional) if set to true, response will contain not only sentiment\n prediction but also opinion mining (aspect-based sentiment analysis) results.\n:type opinion_mining: bool\n:param string_index_type: (Optional) Specifies the method used to interpret string offsets.\n Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information\n see https://aka.ms/text-analytics-offsets.\n:type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_4.models.StringIndexType\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SentimentResponse, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.SentimentResponse\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def sentiment(\n self,\n documents: List[\"_models.MultiLanguageInput\"],\n model_version: Optional[str] = None,\n show_stats: Optional[bool] = None,\n opinion_mining: Optional[bool] = None,\n string_index_type: Optional[Union[str, \"_models.StringIndexType\"]] = \"TextElements_v8\",\n **kwargs\n) -\u003e \"_models.SentimentResponse\":\n", + "doc": "\"\"\"Sentiment.\n\nThe API returns a detailed sentiment analysis for the input text. The analysis is done in\nmultiple levels of granularity, start from the a document level, down to sentence and key terms\n(targets and assessments).\n\n:param documents: The set of documents to process as part of this batch.\n:type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.MultiLanguageInput]\n:param model_version: (Optional) This value indicates which model will be used for scoring. If\n a model-version is not specified, the API should default to the latest, non-preview version.\n:type model_version: str\n:param show_stats: (Optional) if set to true, response will contain request and document level\n statistics.\n:type show_stats: bool\n:param opinion_mining: (Optional) if set to true, response will contain not only sentiment\n prediction but also opinion mining (aspect-based sentiment analysis) results.\n:type opinion_mining: bool\n:param string_index_type: (Optional) Specifies the method used to interpret string offsets.\n Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information\n see https://aka.ms/text-analytics-offsets.\n:type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_4.models.StringIndexType\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SentimentResponse, or the result of cls(response)\n:rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.SentimentResponse\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "documents, model_version, show_stats, opinion_mining, string_index_type" + } + } + } +} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/_text_analytics_client.py b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/_text_analytics_client.py new file mode 100644 index 000000000000..8d45331521ef --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/_text_analytics_client.py @@ -0,0 +1,63 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core import PipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + +from ._configuration import TextAnalyticsClientConfiguration +from .operations import TextAnalyticsClientOperationsMixin +from . import models + + +class TextAnalyticsClient(TextAnalyticsClientOperationsMixin): + """The Text Analytics API is a suite of natural language processing (NLP) services built with best-in-class Microsoft machine learning algorithms. The API can be used to analyze unstructured text for tasks such as sentiment analysis, key phrase extraction and language detection. Functionality for analysis of text specific to the healthcare domain and personal information are also available in the API. Further documentation can be found in :code:`https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview`. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). + :type endpoint: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + endpoint, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + base_url = '{Endpoint}/text/analytics/v3.1-preview.4' + self._config = TextAnalyticsClientConfiguration(credential, endpoint, **kwargs) + self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> TextAnalyticsClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/aio/__init__.py b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/aio/__init__.py new file mode 100644 index 000000000000..b64fe33ea84d --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/aio/__init__.py @@ -0,0 +1,10 @@ +# 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 ._text_analytics_client import TextAnalyticsClient +__all__ = ['TextAnalyticsClient'] diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/aio/_configuration.py b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/aio/_configuration.py new file mode 100644 index 000000000000..033d80c38005 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/aio/_configuration.py @@ -0,0 +1,64 @@ +# 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 typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +VERSION = "unknown" + +class TextAnalyticsClientConfiguration(Configuration): + """Configuration for TextAnalyticsClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). + :type endpoint: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + endpoint: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") + super(TextAnalyticsClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.endpoint = endpoint + self.credential_scopes = kwargs.pop('credential_scopes', ['https://cognitiveservices.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'ai-textanalytics/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/aio/_text_analytics_client.py b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/aio/_text_analytics_client.py new file mode 100644 index 000000000000..1882af8b94d6 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/aio/_text_analytics_client.py @@ -0,0 +1,57 @@ +# 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 typing import Any, TYPE_CHECKING + +from azure.core import AsyncPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import TextAnalyticsClientConfiguration +from .operations import TextAnalyticsClientOperationsMixin +from .. import models + + +class TextAnalyticsClient(TextAnalyticsClientOperationsMixin): + """The Text Analytics API is a suite of natural language processing (NLP) services built with best-in-class Microsoft machine learning algorithms. The API can be used to analyze unstructured text for tasks such as sentiment analysis, key phrase extraction and language detection. Functionality for analysis of text specific to the healthcare domain and personal information are also available in the API. Further documentation can be found in :code:`https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview`. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). + :type endpoint: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + endpoint: str, + **kwargs: Any + ) -> None: + base_url = '{Endpoint}/text/analytics/v3.1-preview.4' + self._config = TextAnalyticsClientConfiguration(credential, endpoint, **kwargs) + self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "TextAnalyticsClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/aio/operations/__init__.py b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/aio/operations/__init__.py new file mode 100644 index 000000000000..4384511c0346 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/aio/operations/__init__.py @@ -0,0 +1,13 @@ +# 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 ._text_analytics_client_operations import TextAnalyticsClientOperationsMixin + +__all__ = [ + 'TextAnalyticsClientOperationsMixin', +] diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/aio/operations/_text_analytics_client_operations.py b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/aio/operations/_text_analytics_client_operations.py new file mode 100644 index 000000000000..b3e27cb29e7a --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/aio/operations/_text_analytics_client_operations.py @@ -0,0 +1,1063 @@ +# 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 typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union +import warnings + +from ....._async_lro import AnalyzeHealthcareEntitiesAsyncLROPoller, AnalyzeHealthcareEntitiesAsyncLROPollingMethod, AsyncAnalyzeBatchActionsLROPoller, AsyncAnalyzeBatchActionsLROPollingMethod +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.polling.async_base_polling import AsyncLROBasePolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TextAnalyticsClientOperationsMixin: + + async def _analyze_initial( + self, + body: Optional["_models.AnalyzeBatchInput"] = None, + **kwargs + ) -> Optional["_models.AnalyzeJobState"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AnalyzeJobState"]] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json, text/json" + + # Construct URL + url = self._analyze_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'AnalyzeBatchInput') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AnalyzeJobState', pipeline_response) + + if response.status_code == 202: + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _analyze_initial.metadata = {'url': '/analyze'} # type: ignore + + async def begin_analyze( + self, + body: Optional["_models.AnalyzeBatchInput"] = None, + **kwargs + ) -> AsyncAnalyzeBatchActionsLROPoller["_models.AnalyzeJobState"]: + """Submit analysis job. + + Submit a collection of text documents for analysis. Specify one or more unique tasks to be + executed. + + :param body: Collection of documents to analyze and tasks to execute. + :type body: ~azure.ai.textanalytics.v3_1_preview_4.models.AnalyzeBatchInput + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the AsyncAnalyzeBatchActionsLROPollingMethod polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncAnalyzeBatchActionsLROPoller that returns either AnalyzeJobState or the result of cls(response) + :rtype: ~....._async_lro.AsyncAnalyzeBatchActionsLROPoller[~azure.ai.textanalytics.v3_1_preview_4.models.AnalyzeJobState] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', False) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AnalyzeJobState"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._analyze_initial( + body=body, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AnalyzeJobState', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncAnalyzeBatchActionsLROPollingMethod(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncAnalyzeBatchActionsLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncAnalyzeBatchActionsLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_analyze.metadata = {'url': '/analyze'} # type: ignore + + async def analyze_status( + self, + job_id: str, + show_stats: Optional[bool] = None, + top: Optional[int] = 20, + skip: Optional[int] = 0, + **kwargs + ) -> "_models.AnalyzeJobState": + """Get analysis status and results. + + Get the status of an analysis job. A job may consist of one or more tasks. Once all tasks are + completed, the job will transition to the completed state and results will be available for + each task. + + :param job_id: Job ID for Analyze. + :type job_id: str + :param show_stats: (Optional) if set to true, response will contain request and document level + statistics. + :type show_stats: bool + :param top: (Optional) Set the maximum number of results per task. When both $top and $skip are + specified, $skip is applied first. + :type top: int + :param skip: (Optional) Set the number of elements to offset in the response. When both $top + and $skip are specified, $skip is applied first. + :type skip: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AnalyzeJobState, or the result of cls(response) + :rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.AnalyzeJobState + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AnalyzeJobState"] + error_map = { + 401: ClientAuthenticationError, + 409: ResourceExistsError, + 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json, text/json" + + # Construct URL + url = self.analyze_status.metadata['url'] # type: ignore + path_format_arguments = { + 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'jobId': self._serialize.url("job_id", job_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if show_stats is not None: + query_parameters['showStats'] = self._serialize.query("show_stats", show_stats, 'bool') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=50, minimum=1) + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + deserialized = self._deserialize('AnalyzeJobState', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + analyze_status.metadata = {'url': '/analyze/jobs/{jobId}'} # type: ignore + + async def health_status( + self, + job_id: str, + top: Optional[int] = 20, + skip: Optional[int] = 0, + show_stats: Optional[bool] = None, + **kwargs + ) -> "_models.HealthcareJobState": + """Get healthcare analysis job status and results. + + Get details of the healthcare prediction job specified by the jobId. + + :param job_id: Job ID. + :type job_id: str + :param top: (Optional) Set the maximum number of results per task. When both $top and $skip are + specified, $skip is applied first. + :type top: int + :param skip: (Optional) Set the number of elements to offset in the response. When both $top + and $skip are specified, $skip is applied first. + :type skip: int + :param show_stats: (Optional) if set to true, response will contain request and document level + statistics. + :type show_stats: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HealthcareJobState, or the result of cls(response) + :rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.HealthcareJobState + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.HealthcareJobState"] + error_map = { + 401: ClientAuthenticationError, + 409: ResourceExistsError, + 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json, text/json" + + # Construct URL + url = self.health_status.metadata['url'] # type: ignore + path_format_arguments = { + 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'jobId': self._serialize.url("job_id", job_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=50, minimum=1) + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) + if show_stats is not None: + query_parameters['showStats'] = self._serialize.query("show_stats", show_stats, 'bool') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + deserialized = self._deserialize('HealthcareJobState', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + health_status.metadata = {'url': '/entities/health/jobs/{jobId}'} # type: ignore + + async def _cancel_health_job_initial( + self, + job_id: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, + 409: ResourceExistsError, + 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json, text/json" + + # Construct URL + url = self._cancel_health_job_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'jobId': self._serialize.url("job_id", job_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _cancel_health_job_initial.metadata = {'url': '/entities/health/jobs/{jobId}'} # type: ignore + + async def begin_cancel_health_job( + self, + job_id: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Cancel healthcare prediction job. + + Cancel healthcare prediction job. + + :param job_id: Job ID. + :type job_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the AsyncLROBasePolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', False) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._cancel_health_job_initial( + job_id=job_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'jobId': self._serialize.url("job_id", job_id, 'str'), + } + + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_cancel_health_job.metadata = {'url': '/entities/health/jobs/{jobId}'} # type: ignore + + async def _health_initial( + self, + documents: List["_models.MultiLanguageInput"], + model_version: Optional[str] = None, + string_index_type: Optional[Union[str, "_models.StringIndexType"]] = "TextElements_v8", + **kwargs + ) -> Optional["_models.HealthcareJobState"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.HealthcareJobState"]] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + + _input = _models.MultiLanguageBatchInput(documents=documents) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json, text/json" + + # Construct URL + url = self._health_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if model_version is not None: + query_parameters['model-version'] = self._serialize.query("model_version", model_version, 'str') + if string_index_type is not None: + query_parameters['stringIndexType'] = self._serialize.query("string_index_type", string_index_type, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_input, 'MultiLanguageBatchInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('HealthcareJobState', pipeline_response) + + if response.status_code == 202: + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _health_initial.metadata = {'url': '/entities/health/jobs'} # type: ignore + + async def begin_health( + self, + documents: List["_models.MultiLanguageInput"], + model_version: Optional[str] = None, + string_index_type: Optional[Union[str, "_models.StringIndexType"]] = "TextElements_v8", + **kwargs + ) -> AnalyzeHealthcareEntitiesAsyncLROPoller["_models.HealthcareJobState"]: + """Submit healthcare analysis job. + + Start a healthcare analysis job to recognize healthcare related entities (drugs, conditions, + symptoms, etc) and their relations. + + :param documents: The set of documents to process as part of this batch. + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.MultiLanguageInput] + :param model_version: (Optional) This value indicates which model will be used for scoring. If + a model-version is not specified, the API should default to the latest, non-preview version. + :type model_version: str + :param string_index_type: (Optional) Specifies the method used to interpret string offsets. + Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information + see https://aka.ms/text-analytics-offsets. + :type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_4.models.StringIndexType + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the AnalyzeHealthcareEntitiesAsyncLROPollingMethod polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AnalyzeHealthcareEntitiesAsyncLROPoller that returns either HealthcareJobState or the result of cls(response) + :rtype: ~....._async_lro.AnalyzeHealthcareEntitiesAsyncLROPoller[~azure.ai.textanalytics.v3_1_preview_4.models.HealthcareJobState] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', False) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.HealthcareJobState"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._health_initial( + documents=documents, + model_version=model_version, + string_index_type=string_index_type, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('HealthcareJobState', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + + if polling is True: polling_method = AnalyzeHealthcareEntitiesAsyncLROPollingMethod(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AnalyzeHealthcareEntitiesAsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AnalyzeHealthcareEntitiesAsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_health.metadata = {'url': '/entities/health/jobs'} # type: ignore + + async def entities_recognition_general( + self, + documents: List["_models.MultiLanguageInput"], + model_version: Optional[str] = None, + show_stats: Optional[bool] = None, + string_index_type: Optional[Union[str, "_models.StringIndexType"]] = "TextElements_v8", + **kwargs + ) -> "_models.EntitiesResult": + """Named Entity Recognition. + + The API returns a list of general named entities in a given document. For the list of supported + entity types, check :code:`Supported Entity Types in Text + Analytics API`. See the :code:`Supported languages in Text + Analytics API` for the list of enabled languages. + + :param documents: The set of documents to process as part of this batch. + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.MultiLanguageInput] + :param model_version: (Optional) This value indicates which model will be used for scoring. If + a model-version is not specified, the API should default to the latest, non-preview version. + :type model_version: str + :param show_stats: (Optional) if set to true, response will contain request and document level + statistics. + :type show_stats: bool + :param string_index_type: (Optional) Specifies the method used to interpret string offsets. + Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information + see https://aka.ms/text-analytics-offsets. + :type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_4.models.StringIndexType + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EntitiesResult, or the result of cls(response) + :rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.EntitiesResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EntitiesResult"] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + + _input = _models.MultiLanguageBatchInput(documents=documents) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json, text/json" + + # Construct URL + url = self.entities_recognition_general.metadata['url'] # type: ignore + path_format_arguments = { + 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if model_version is not None: + query_parameters['model-version'] = self._serialize.query("model_version", model_version, 'str') + if show_stats is not None: + query_parameters['showStats'] = self._serialize.query("show_stats", show_stats, 'bool') + if string_index_type is not None: + query_parameters['stringIndexType'] = self._serialize.query("string_index_type", string_index_type, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_input, 'MultiLanguageBatchInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + deserialized = self._deserialize('EntitiesResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + entities_recognition_general.metadata = {'url': '/entities/recognition/general'} # type: ignore + + async def entities_recognition_pii( + self, + documents: List["_models.MultiLanguageInput"], + model_version: Optional[str] = None, + show_stats: Optional[bool] = None, + domain: Optional[str] = None, + string_index_type: Optional[Union[str, "_models.StringIndexType"]] = "TextElements_v8", + pii_categories: Optional[List[Union[str, "_models.PiiCategory"]]] = None, + **kwargs + ) -> "_models.PiiResult": + """Entities containing personal information. + + The API returns a list of entities with personal information (\"SSN\", \"Bank Account\" etc) in + the document. For the list of supported entity types, check :code:`Supported Entity Types in Text Analytics API`. See the + :code:`Supported languages in Text Analytics API` for the + list of enabled languages. + + :param documents: The set of documents to process as part of this batch. + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.MultiLanguageInput] + :param model_version: (Optional) This value indicates which model will be used for scoring. If + a model-version is not specified, the API should default to the latest, non-preview version. + :type model_version: str + :param show_stats: (Optional) if set to true, response will contain request and document level + statistics. + :type show_stats: bool + :param domain: (Optional) if specified, will set the PII domain to include only a subset of the + entity categories. Possible values include: 'PHI', 'none'. + :type domain: str + :param string_index_type: (Optional) Specifies the method used to interpret string offsets. + Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information + see https://aka.ms/text-analytics-offsets. + :type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_4.models.StringIndexType + :param pii_categories: (Optional) describes the PII categories to return. + :type pii_categories: list[str or ~azure.ai.textanalytics.v3_1_preview_4.models.PiiCategory] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PiiResult, or the result of cls(response) + :rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.PiiResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PiiResult"] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + + _input = _models.MultiLanguageBatchInput(documents=documents) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json, text/json" + + # Construct URL + url = self.entities_recognition_pii.metadata['url'] # type: ignore + path_format_arguments = { + 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if model_version is not None: + query_parameters['model-version'] = self._serialize.query("model_version", model_version, 'str') + if show_stats is not None: + query_parameters['showStats'] = self._serialize.query("show_stats", show_stats, 'bool') + if domain is not None: + query_parameters['domain'] = self._serialize.query("domain", domain, 'str') + if string_index_type is not None: + query_parameters['stringIndexType'] = self._serialize.query("string_index_type", string_index_type, 'str') + if pii_categories is not None: + query_parameters['piiCategories'] = self._serialize.query("pii_categories", pii_categories, '[str]', div=',') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_input, 'MultiLanguageBatchInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + deserialized = self._deserialize('PiiResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + entities_recognition_pii.metadata = {'url': '/entities/recognition/pii'} # type: ignore + + async def entities_linking( + self, + documents: List["_models.MultiLanguageInput"], + model_version: Optional[str] = None, + show_stats: Optional[bool] = None, + string_index_type: Optional[Union[str, "_models.StringIndexType"]] = "TextElements_v8", + **kwargs + ) -> "_models.EntityLinkingResult": + """Linked entities from a well known knowledge base. + + The API returns a list of recognized entities with links to a well known knowledge base. See + the :code:`Supported languages in Text Analytics API` for + the list of enabled languages. + + :param documents: The set of documents to process as part of this batch. + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.MultiLanguageInput] + :param model_version: (Optional) This value indicates which model will be used for scoring. If + a model-version is not specified, the API should default to the latest, non-preview version. + :type model_version: str + :param show_stats: (Optional) if set to true, response will contain request and document level + statistics. + :type show_stats: bool + :param string_index_type: (Optional) Specifies the method used to interpret string offsets. + Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information + see https://aka.ms/text-analytics-offsets. + :type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_4.models.StringIndexType + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EntityLinkingResult, or the result of cls(response) + :rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.EntityLinkingResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EntityLinkingResult"] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + + _input = _models.MultiLanguageBatchInput(documents=documents) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json, text/json" + + # Construct URL + url = self.entities_linking.metadata['url'] # type: ignore + path_format_arguments = { + 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if model_version is not None: + query_parameters['model-version'] = self._serialize.query("model_version", model_version, 'str') + if show_stats is not None: + query_parameters['showStats'] = self._serialize.query("show_stats", show_stats, 'bool') + if string_index_type is not None: + query_parameters['stringIndexType'] = self._serialize.query("string_index_type", string_index_type, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_input, 'MultiLanguageBatchInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + deserialized = self._deserialize('EntityLinkingResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + entities_linking.metadata = {'url': '/entities/linking'} # type: ignore + + async def key_phrases( + self, + documents: List["_models.MultiLanguageInput"], + model_version: Optional[str] = None, + show_stats: Optional[bool] = None, + **kwargs + ) -> "_models.KeyPhraseResult": + """Key Phrases. + + The API returns a list of strings denoting the key phrases in the input text. See the :code:`Supported languages in Text Analytics API` for the list of + enabled languages. + + :param documents: The set of documents to process as part of this batch. + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.MultiLanguageInput] + :param model_version: (Optional) This value indicates which model will be used for scoring. If + a model-version is not specified, the API should default to the latest, non-preview version. + :type model_version: str + :param show_stats: (Optional) if set to true, response will contain request and document level + statistics. + :type show_stats: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyPhraseResult, or the result of cls(response) + :rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.KeyPhraseResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyPhraseResult"] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + + _input = _models.MultiLanguageBatchInput(documents=documents) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json, text/json" + + # Construct URL + url = self.key_phrases.metadata['url'] # type: ignore + path_format_arguments = { + 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if model_version is not None: + query_parameters['model-version'] = self._serialize.query("model_version", model_version, 'str') + if show_stats is not None: + query_parameters['showStats'] = self._serialize.query("show_stats", show_stats, 'bool') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_input, 'MultiLanguageBatchInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + deserialized = self._deserialize('KeyPhraseResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + key_phrases.metadata = {'url': '/keyPhrases'} # type: ignore + + async def languages( + self, + documents: List["_models.LanguageInput"], + model_version: Optional[str] = None, + show_stats: Optional[bool] = None, + **kwargs + ) -> "_models.LanguageResult": + """Detect Language. + + The API returns the detected language and a numeric score between 0 and 1. Scores close to 1 + indicate 100% certainty that the identified language is true. See the :code:`Supported languages in Text Analytics API` for the list of + enabled languages. + + :param documents: + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.LanguageInput] + :param model_version: (Optional) This value indicates which model will be used for scoring. If + a model-version is not specified, the API should default to the latest, non-preview version. + :type model_version: str + :param show_stats: (Optional) if set to true, response will contain request and document level + statistics. + :type show_stats: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LanguageResult, or the result of cls(response) + :rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.LanguageResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LanguageResult"] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + + _input = _models.LanguageBatchInput(documents=documents) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json, text/json" + + # Construct URL + url = self.languages.metadata['url'] # type: ignore + path_format_arguments = { + 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if model_version is not None: + query_parameters['model-version'] = self._serialize.query("model_version", model_version, 'str') + if show_stats is not None: + query_parameters['showStats'] = self._serialize.query("show_stats", show_stats, 'bool') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_input, 'LanguageBatchInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + deserialized = self._deserialize('LanguageResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + languages.metadata = {'url': '/languages'} # type: ignore + + async def sentiment( + self, + documents: List["_models.MultiLanguageInput"], + model_version: Optional[str] = None, + show_stats: Optional[bool] = None, + opinion_mining: Optional[bool] = None, + string_index_type: Optional[Union[str, "_models.StringIndexType"]] = "TextElements_v8", + **kwargs + ) -> "_models.SentimentResponse": + """Sentiment. + + The API returns a detailed sentiment analysis for the input text. The analysis is done in + multiple levels of granularity, start from the a document level, down to sentence and key terms + (targets and assessments). + + :param documents: The set of documents to process as part of this batch. + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.MultiLanguageInput] + :param model_version: (Optional) This value indicates which model will be used for scoring. If + a model-version is not specified, the API should default to the latest, non-preview version. + :type model_version: str + :param show_stats: (Optional) if set to true, response will contain request and document level + statistics. + :type show_stats: bool + :param opinion_mining: (Optional) if set to true, response will contain not only sentiment + prediction but also opinion mining (aspect-based sentiment analysis) results. + :type opinion_mining: bool + :param string_index_type: (Optional) Specifies the method used to interpret string offsets. + Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information + see https://aka.ms/text-analytics-offsets. + :type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_4.models.StringIndexType + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SentimentResponse, or the result of cls(response) + :rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.SentimentResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SentimentResponse"] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + + _input = _models.MultiLanguageBatchInput(documents=documents) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json, text/json" + + # Construct URL + url = self.sentiment.metadata['url'] # type: ignore + path_format_arguments = { + 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if model_version is not None: + query_parameters['model-version'] = self._serialize.query("model_version", model_version, 'str') + if show_stats is not None: + query_parameters['showStats'] = self._serialize.query("show_stats", show_stats, 'bool') + if opinion_mining is not None: + query_parameters['opinionMining'] = self._serialize.query("opinion_mining", opinion_mining, 'bool') + if string_index_type is not None: + query_parameters['stringIndexType'] = self._serialize.query("string_index_type", string_index_type, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_input, 'MultiLanguageBatchInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + deserialized = self._deserialize('SentimentResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + sentiment.metadata = {'url': '/sentiment'} # type: ignore diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/models/__init__.py b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/models/__init__.py new file mode 100644 index 000000000000..2cf115784e44 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/models/__init__.py @@ -0,0 +1,255 @@ +# 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 ._models_py3 import AnalyzeBatchInput + from ._models_py3 import AnalyzeJobMetadata + from ._models_py3 import AnalyzeJobState + from ._models_py3 import Components15Gvwi3SchemasTasksstatePropertiesTasksPropertiesEntityrecognitiontasksItemsAllof1 + from ._models_py3 import Components15X8E9LSchemasTasksstatePropertiesTasksPropertiesEntityrecognitionpiitasksItemsAllof1 + from ._models_py3 import Components1D9IzucSchemasTasksstatePropertiesTasksPropertiesKeyphraseextractiontasksItemsAllof1 + from ._models_py3 import ComponentsIfu7BjSchemasTasksstatePropertiesTasksPropertiesEntitylinkingtasksItemsAllof1 + from ._models_py3 import DetectedLanguage + from ._models_py3 import DocumentEntities + from ._models_py3 import DocumentError + from ._models_py3 import DocumentHealthcareEntities + from ._models_py3 import DocumentKeyPhrases + from ._models_py3 import DocumentLanguage + from ._models_py3 import DocumentLinkedEntities + from ._models_py3 import DocumentSentiment + from ._models_py3 import DocumentStatistics + from ._models_py3 import EntitiesResult + from ._models_py3 import EntitiesTask + from ._models_py3 import EntitiesTaskParameters + from ._models_py3 import Entity + from ._models_py3 import EntityLinkingResult + from ._models_py3 import EntityLinkingTask + from ._models_py3 import EntityLinkingTaskParameters + from ._models_py3 import ErrorResponse + from ._models_py3 import HealthcareAssertion + from ._models_py3 import HealthcareEntity + from ._models_py3 import HealthcareEntityLink + from ._models_py3 import HealthcareJobState + from ._models_py3 import HealthcareRelation + from ._models_py3 import HealthcareRelationEntity + from ._models_py3 import HealthcareResult + from ._models_py3 import InnerError + from ._models_py3 import JobDescriptor + from ._models_py3 import JobManifest + from ._models_py3 import JobManifestTasks + from ._models_py3 import JobMetadata + from ._models_py3 import KeyPhraseResult + from ._models_py3 import KeyPhrasesTask + from ._models_py3 import KeyPhrasesTaskParameters + from ._models_py3 import LanguageBatchInput + from ._models_py3 import LanguageInput + from ._models_py3 import LanguageResult + from ._models_py3 import LinkedEntity + from ._models_py3 import Match + from ._models_py3 import MultiLanguageBatchInput + from ._models_py3 import MultiLanguageInput + from ._models_py3 import Pagination + from ._models_py3 import PiiDocumentEntities + from ._models_py3 import PiiResult + from ._models_py3 import PiiTask + from ._models_py3 import PiiTaskParameters + from ._models_py3 import RequestStatistics + from ._models_py3 import SentenceAssessment + from ._models_py3 import SentenceSentiment + from ._models_py3 import SentenceTarget + from ._models_py3 import SentimentConfidenceScorePerLabel + from ._models_py3 import SentimentResponse + from ._models_py3 import TargetConfidenceScoreLabel + from ._models_py3 import TargetRelation + from ._models_py3 import TaskState + from ._models_py3 import TasksState + from ._models_py3 import TasksStateTasks + from ._models_py3 import TasksStateTasksDetails + from ._models_py3 import TasksStateTasksEntityLinkingTasksItem + from ._models_py3 import TasksStateTasksEntityRecognitionPiiTasksItem + from ._models_py3 import TasksStateTasksEntityRecognitionTasksItem + from ._models_py3 import TasksStateTasksKeyPhraseExtractionTasksItem + from ._models_py3 import TextAnalyticsError + from ._models_py3 import TextAnalyticsWarning +except (SyntaxError, ImportError): + from ._models import AnalyzeBatchInput # type: ignore + from ._models import AnalyzeJobMetadata # type: ignore + from ._models import AnalyzeJobState # type: ignore + from ._models import Components15Gvwi3SchemasTasksstatePropertiesTasksPropertiesEntityrecognitiontasksItemsAllof1 # type: ignore + from ._models import Components15X8E9LSchemasTasksstatePropertiesTasksPropertiesEntityrecognitionpiitasksItemsAllof1 # type: ignore + from ._models import Components1D9IzucSchemasTasksstatePropertiesTasksPropertiesKeyphraseextractiontasksItemsAllof1 # type: ignore + from ._models import ComponentsIfu7BjSchemasTasksstatePropertiesTasksPropertiesEntitylinkingtasksItemsAllof1 # type: ignore + from ._models import DetectedLanguage # type: ignore + from ._models import DocumentEntities # type: ignore + from ._models import DocumentError # type: ignore + from ._models import DocumentHealthcareEntities # type: ignore + from ._models import DocumentKeyPhrases # type: ignore + from ._models import DocumentLanguage # type: ignore + from ._models import DocumentLinkedEntities # type: ignore + from ._models import DocumentSentiment # type: ignore + from ._models import DocumentStatistics # type: ignore + from ._models import EntitiesResult # type: ignore + from ._models import EntitiesTask # type: ignore + from ._models import EntitiesTaskParameters # type: ignore + from ._models import Entity # type: ignore + from ._models import EntityLinkingResult # type: ignore + from ._models import EntityLinkingTask # type: ignore + from ._models import EntityLinkingTaskParameters # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import HealthcareAssertion # type: ignore + from ._models import HealthcareEntity # type: ignore + from ._models import HealthcareEntityLink # type: ignore + from ._models import HealthcareJobState # type: ignore + from ._models import HealthcareRelation # type: ignore + from ._models import HealthcareRelationEntity # type: ignore + from ._models import HealthcareResult # type: ignore + from ._models import InnerError # type: ignore + from ._models import JobDescriptor # type: ignore + from ._models import JobManifest # type: ignore + from ._models import JobManifestTasks # type: ignore + from ._models import JobMetadata # type: ignore + from ._models import KeyPhraseResult # type: ignore + from ._models import KeyPhrasesTask # type: ignore + from ._models import KeyPhrasesTaskParameters # type: ignore + from ._models import LanguageBatchInput # type: ignore + from ._models import LanguageInput # type: ignore + from ._models import LanguageResult # type: ignore + from ._models import LinkedEntity # type: ignore + from ._models import Match # type: ignore + from ._models import MultiLanguageBatchInput # type: ignore + from ._models import MultiLanguageInput # type: ignore + from ._models import Pagination # type: ignore + from ._models import PiiDocumentEntities # type: ignore + from ._models import PiiResult # type: ignore + from ._models import PiiTask # type: ignore + from ._models import PiiTaskParameters # type: ignore + from ._models import RequestStatistics # type: ignore + from ._models import SentenceAssessment # type: ignore + from ._models import SentenceSentiment # type: ignore + from ._models import SentenceTarget # type: ignore + from ._models import SentimentConfidenceScorePerLabel # type: ignore + from ._models import SentimentResponse # type: ignore + from ._models import TargetConfidenceScoreLabel # type: ignore + from ._models import TargetRelation # type: ignore + from ._models import TaskState # type: ignore + from ._models import TasksState # type: ignore + from ._models import TasksStateTasks # type: ignore + from ._models import TasksStateTasksDetails # type: ignore + from ._models import TasksStateTasksEntityLinkingTasksItem # type: ignore + from ._models import TasksStateTasksEntityRecognitionPiiTasksItem # type: ignore + from ._models import TasksStateTasksEntityRecognitionTasksItem # type: ignore + from ._models import TasksStateTasksKeyPhraseExtractionTasksItem # type: ignore + from ._models import TextAnalyticsError # type: ignore + from ._models import TextAnalyticsWarning # type: ignore + +from ._text_analytics_client_enums import ( + Association, + Certainty, + Conditionality, + DocumentSentimentValue, + ErrorCodeValue, + InnerErrorCodeValue, + PiiCategory, + PiiTaskParametersDomain, + RelationType, + SentenceSentimentValue, + State, + StringIndexType, + StringIndexTypeResponse, + TargetRelationType, + TokenSentimentValue, + WarningCodeValue, +) + +__all__ = [ + 'AnalyzeBatchInput', + 'AnalyzeJobMetadata', + 'AnalyzeJobState', + 'Components15Gvwi3SchemasTasksstatePropertiesTasksPropertiesEntityrecognitiontasksItemsAllof1', + 'Components15X8E9LSchemasTasksstatePropertiesTasksPropertiesEntityrecognitionpiitasksItemsAllof1', + 'Components1D9IzucSchemasTasksstatePropertiesTasksPropertiesKeyphraseextractiontasksItemsAllof1', + 'ComponentsIfu7BjSchemasTasksstatePropertiesTasksPropertiesEntitylinkingtasksItemsAllof1', + 'DetectedLanguage', + 'DocumentEntities', + 'DocumentError', + 'DocumentHealthcareEntities', + 'DocumentKeyPhrases', + 'DocumentLanguage', + 'DocumentLinkedEntities', + 'DocumentSentiment', + 'DocumentStatistics', + 'EntitiesResult', + 'EntitiesTask', + 'EntitiesTaskParameters', + 'Entity', + 'EntityLinkingResult', + 'EntityLinkingTask', + 'EntityLinkingTaskParameters', + 'ErrorResponse', + 'HealthcareAssertion', + 'HealthcareEntity', + 'HealthcareEntityLink', + 'HealthcareJobState', + 'HealthcareRelation', + 'HealthcareRelationEntity', + 'HealthcareResult', + 'InnerError', + 'JobDescriptor', + 'JobManifest', + 'JobManifestTasks', + 'JobMetadata', + 'KeyPhraseResult', + 'KeyPhrasesTask', + 'KeyPhrasesTaskParameters', + 'LanguageBatchInput', + 'LanguageInput', + 'LanguageResult', + 'LinkedEntity', + 'Match', + 'MultiLanguageBatchInput', + 'MultiLanguageInput', + 'Pagination', + 'PiiDocumentEntities', + 'PiiResult', + 'PiiTask', + 'PiiTaskParameters', + 'RequestStatistics', + 'SentenceAssessment', + 'SentenceSentiment', + 'SentenceTarget', + 'SentimentConfidenceScorePerLabel', + 'SentimentResponse', + 'TargetConfidenceScoreLabel', + 'TargetRelation', + 'TaskState', + 'TasksState', + 'TasksStateTasks', + 'TasksStateTasksDetails', + 'TasksStateTasksEntityLinkingTasksItem', + 'TasksStateTasksEntityRecognitionPiiTasksItem', + 'TasksStateTasksEntityRecognitionTasksItem', + 'TasksStateTasksKeyPhraseExtractionTasksItem', + 'TextAnalyticsError', + 'TextAnalyticsWarning', + 'Association', + 'Certainty', + 'Conditionality', + 'DocumentSentimentValue', + 'ErrorCodeValue', + 'InnerErrorCodeValue', + 'PiiCategory', + 'PiiTaskParametersDomain', + 'RelationType', + 'SentenceSentimentValue', + 'State', + 'StringIndexType', + 'StringIndexTypeResponse', + 'TargetRelationType', + 'TokenSentimentValue', + 'WarningCodeValue', +] diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/models/_models.py b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/models/_models.py new file mode 100644 index 000000000000..d93b1004c4ec --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/models/_models.py @@ -0,0 +1,2524 @@ +# 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 azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class JobManifest(msrest.serialization.Model): + """JobManifest. + + All required parameters must be populated in order to send to Azure. + + :param tasks: Required. The set of tasks to execute on the input documents. Cannot specify the + same task more than once. + :type tasks: ~azure.ai.textanalytics.v3_1_preview_4.models.JobManifestTasks + """ + + _validation = { + 'tasks': {'required': True}, + } + + _attribute_map = { + 'tasks': {'key': 'tasks', 'type': 'JobManifestTasks'}, + } + + def __init__( + self, + **kwargs + ): + super(JobManifest, self).__init__(**kwargs) + self.tasks = kwargs['tasks'] + + +class JobDescriptor(msrest.serialization.Model): + """JobDescriptor. + + :param display_name: Optional display name for the analysis job. + :type display_name: str + """ + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(JobDescriptor, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + + +class AnalyzeBatchInput(JobDescriptor, JobManifest): + """AnalyzeBatchInput. + + All required parameters must be populated in order to send to Azure. + + :param tasks: Required. The set of tasks to execute on the input documents. Cannot specify the + same task more than once. + :type tasks: ~azure.ai.textanalytics.v3_1_preview_4.models.JobManifestTasks + :param display_name: Optional display name for the analysis job. + :type display_name: str + :param analysis_input: Required. Contains a set of input documents to be analyzed by the + service. + :type analysis_input: ~azure.ai.textanalytics.v3_1_preview_4.models.MultiLanguageBatchInput + """ + + _validation = { + 'tasks': {'required': True}, + 'analysis_input': {'required': True}, + } + + _attribute_map = { + 'tasks': {'key': 'tasks', 'type': 'JobManifestTasks'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'analysis_input': {'key': 'analysisInput', 'type': 'MultiLanguageBatchInput'}, + } + + def __init__( + self, + **kwargs + ): + super(AnalyzeBatchInput, self).__init__(**kwargs) + self.tasks = kwargs['tasks'] + self.analysis_input = kwargs['analysis_input'] + self.display_name = kwargs.get('display_name', None) + self.analysis_input = kwargs['analysis_input'] + + +class JobMetadata(msrest.serialization.Model): + """JobMetadata. + + All required parameters must be populated in order to send to Azure. + + :param created_date_time: Required. + :type created_date_time: ~datetime.datetime + :param expiration_date_time: + :type expiration_date_time: ~datetime.datetime + :param job_id: Required. + :type job_id: str + :param last_update_date_time: Required. + :type last_update_date_time: ~datetime.datetime + :param status: Required. Possible values include: "notStarted", "running", "succeeded", + "failed", "rejected", "cancelled", "cancelling", "partiallyCompleted". + :type status: str or ~azure.ai.textanalytics.v3_1_preview_4.models.State + """ + + _validation = { + 'created_date_time': {'required': True}, + 'job_id': {'required': True}, + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'created_date_time': {'key': 'createdDateTime', 'type': 'iso-8601'}, + 'expiration_date_time': {'key': 'expirationDateTime', 'type': 'iso-8601'}, + 'job_id': {'key': 'jobId', 'type': 'str'}, + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(JobMetadata, self).__init__(**kwargs) + self.created_date_time = kwargs['created_date_time'] + self.expiration_date_time = kwargs.get('expiration_date_time', None) + self.job_id = kwargs['job_id'] + self.last_update_date_time = kwargs['last_update_date_time'] + self.status = kwargs['status'] + + +class AnalyzeJobMetadata(JobMetadata): + """AnalyzeJobMetadata. + + All required parameters must be populated in order to send to Azure. + + :param created_date_time: Required. + :type created_date_time: ~datetime.datetime + :param expiration_date_time: + :type expiration_date_time: ~datetime.datetime + :param job_id: Required. + :type job_id: str + :param last_update_date_time: Required. + :type last_update_date_time: ~datetime.datetime + :param status: Required. Possible values include: "notStarted", "running", "succeeded", + "failed", "rejected", "cancelled", "cancelling", "partiallyCompleted". + :type status: str or ~azure.ai.textanalytics.v3_1_preview_4.models.State + :param display_name: + :type display_name: str + """ + + _validation = { + 'created_date_time': {'required': True}, + 'job_id': {'required': True}, + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'created_date_time': {'key': 'createdDateTime', 'type': 'iso-8601'}, + 'expiration_date_time': {'key': 'expirationDateTime', 'type': 'iso-8601'}, + 'job_id': {'key': 'jobId', 'type': 'str'}, + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'status': {'key': 'status', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AnalyzeJobMetadata, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + + +class Pagination(msrest.serialization.Model): + """Pagination. + + :param next_link: + :type next_link: str + """ + + _attribute_map = { + 'next_link': {'key': '@nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Pagination, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + + +class TasksState(msrest.serialization.Model): + """TasksState. + + All required parameters must be populated in order to send to Azure. + + :param tasks: Required. + :type tasks: ~azure.ai.textanalytics.v3_1_preview_4.models.TasksStateTasks + """ + + _validation = { + 'tasks': {'required': True}, + } + + _attribute_map = { + 'tasks': {'key': 'tasks', 'type': 'TasksStateTasks'}, + } + + def __init__( + self, + **kwargs + ): + super(TasksState, self).__init__(**kwargs) + self.tasks = kwargs['tasks'] + + +class AnalyzeJobState(AnalyzeJobMetadata, TasksState, Pagination): + """AnalyzeJobState. + + All required parameters must be populated in order to send to Azure. + + :param next_link: + :type next_link: str + :param tasks: Required. + :type tasks: ~azure.ai.textanalytics.v3_1_preview_4.models.TasksStateTasks + :param created_date_time: Required. + :type created_date_time: ~datetime.datetime + :param expiration_date_time: + :type expiration_date_time: ~datetime.datetime + :param job_id: Required. + :type job_id: str + :param last_update_date_time: Required. + :type last_update_date_time: ~datetime.datetime + :param status: Required. Possible values include: "notStarted", "running", "succeeded", + "failed", "rejected", "cancelled", "cancelling", "partiallyCompleted". + :type status: str or ~azure.ai.textanalytics.v3_1_preview_4.models.State + :param display_name: + :type display_name: str + :param errors: + :type errors: list[~azure.ai.textanalytics.v3_1_preview_4.models.TextAnalyticsError] + :param statistics: if showStats=true was specified in the request this field will contain + information about the request payload. + :type statistics: ~azure.ai.textanalytics.v3_1_preview_4.models.RequestStatistics + """ + + _validation = { + 'tasks': {'required': True}, + 'created_date_time': {'required': True}, + 'job_id': {'required': True}, + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'next_link': {'key': '@nextLink', 'type': 'str'}, + 'tasks': {'key': 'tasks', 'type': 'TasksStateTasks'}, + 'created_date_time': {'key': 'createdDateTime', 'type': 'iso-8601'}, + 'expiration_date_time': {'key': 'expirationDateTime', 'type': 'iso-8601'}, + 'job_id': {'key': 'jobId', 'type': 'str'}, + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'status': {'key': 'status', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'errors': {'key': 'errors', 'type': '[TextAnalyticsError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + } + + def __init__( + self, + **kwargs + ): + super(AnalyzeJobState, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.tasks = kwargs['tasks'] + self.errors = kwargs.get('errors', None) + self.statistics = kwargs.get('statistics', None) + self.next_link = kwargs.get('next_link', None) + self.created_date_time = kwargs['created_date_time'] + self.expiration_date_time = kwargs.get('expiration_date_time', None) + self.job_id = kwargs['job_id'] + self.last_update_date_time = kwargs['last_update_date_time'] + self.status = kwargs['status'] + self.display_name = kwargs.get('display_name', None) + self.errors = kwargs.get('errors', None) + self.statistics = kwargs.get('statistics', None) + self.tasks = kwargs['tasks'] + self.created_date_time = kwargs['created_date_time'] + self.expiration_date_time = kwargs.get('expiration_date_time', None) + self.job_id = kwargs['job_id'] + self.last_update_date_time = kwargs['last_update_date_time'] + self.status = kwargs['status'] + self.display_name = kwargs.get('display_name', None) + self.errors = kwargs.get('errors', None) + self.statistics = kwargs.get('statistics', None) + + +class Components15Gvwi3SchemasTasksstatePropertiesTasksPropertiesEntityrecognitiontasksItemsAllof1(msrest.serialization.Model): + """Components15Gvwi3SchemasTasksstatePropertiesTasksPropertiesEntityrecognitiontasksItemsAllof1. + + :param results: + :type results: ~azure.ai.textanalytics.v3_1_preview_4.models.EntitiesResult + """ + + _attribute_map = { + 'results': {'key': 'results', 'type': 'EntitiesResult'}, + } + + def __init__( + self, + **kwargs + ): + super(Components15Gvwi3SchemasTasksstatePropertiesTasksPropertiesEntityrecognitiontasksItemsAllof1, self).__init__(**kwargs) + self.results = kwargs.get('results', None) + + +class Components15X8E9LSchemasTasksstatePropertiesTasksPropertiesEntityrecognitionpiitasksItemsAllof1(msrest.serialization.Model): + """Components15X8E9LSchemasTasksstatePropertiesTasksPropertiesEntityrecognitionpiitasksItemsAllof1. + + :param results: + :type results: ~azure.ai.textanalytics.v3_1_preview_4.models.PiiResult + """ + + _attribute_map = { + 'results': {'key': 'results', 'type': 'PiiResult'}, + } + + def __init__( + self, + **kwargs + ): + super(Components15X8E9LSchemasTasksstatePropertiesTasksPropertiesEntityrecognitionpiitasksItemsAllof1, self).__init__(**kwargs) + self.results = kwargs.get('results', None) + + +class Components1D9IzucSchemasTasksstatePropertiesTasksPropertiesKeyphraseextractiontasksItemsAllof1(msrest.serialization.Model): + """Components1D9IzucSchemasTasksstatePropertiesTasksPropertiesKeyphraseextractiontasksItemsAllof1. + + :param results: + :type results: ~azure.ai.textanalytics.v3_1_preview_4.models.KeyPhraseResult + """ + + _attribute_map = { + 'results': {'key': 'results', 'type': 'KeyPhraseResult'}, + } + + def __init__( + self, + **kwargs + ): + super(Components1D9IzucSchemasTasksstatePropertiesTasksPropertiesKeyphraseextractiontasksItemsAllof1, self).__init__(**kwargs) + self.results = kwargs.get('results', None) + + +class ComponentsIfu7BjSchemasTasksstatePropertiesTasksPropertiesEntitylinkingtasksItemsAllof1(msrest.serialization.Model): + """ComponentsIfu7BjSchemasTasksstatePropertiesTasksPropertiesEntitylinkingtasksItemsAllof1. + + :param results: + :type results: ~azure.ai.textanalytics.v3_1_preview_4.models.EntityLinkingResult + """ + + _attribute_map = { + 'results': {'key': 'results', 'type': 'EntityLinkingResult'}, + } + + def __init__( + self, + **kwargs + ): + super(ComponentsIfu7BjSchemasTasksstatePropertiesTasksPropertiesEntitylinkingtasksItemsAllof1, self).__init__(**kwargs) + self.results = kwargs.get('results', None) + + +class DetectedLanguage(msrest.serialization.Model): + """DetectedLanguage. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Long name of a detected language (e.g. English, French). + :type name: str + :param iso6391_name: Required. A two letter representation of the detected language according + to the ISO 639-1 standard (e.g. en, fr). + :type iso6391_name: str + :param confidence_score: Required. A confidence score between 0 and 1. Scores close to 1 + indicate 100% certainty that the identified language is true. + :type confidence_score: float + """ + + _validation = { + 'name': {'required': True}, + 'iso6391_name': {'required': True}, + 'confidence_score': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'iso6391_name': {'key': 'iso6391Name', 'type': 'str'}, + 'confidence_score': {'key': 'confidenceScore', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(DetectedLanguage, self).__init__(**kwargs) + self.name = kwargs['name'] + self.iso6391_name = kwargs['iso6391_name'] + self.confidence_score = kwargs['confidence_score'] + + +class DocumentEntities(msrest.serialization.Model): + """DocumentEntities. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param entities: Required. Recognized entities in the document. + :type entities: list[~azure.ai.textanalytics.v3_1_preview_4.models.Entity] + :param warnings: Required. Warnings encountered while processing document. + :type warnings: list[~azure.ai.textanalytics.v3_1_preview_4.models.TextAnalyticsWarning] + :param statistics: if showStats=true was specified in the request this field will contain + information about the document payload. + :type statistics: ~azure.ai.textanalytics.v3_1_preview_4.models.DocumentStatistics + """ + + _validation = { + 'id': {'required': True}, + 'entities': {'required': True}, + 'warnings': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'entities': {'key': 'entities', 'type': '[Entity]'}, + 'warnings': {'key': 'warnings', 'type': '[TextAnalyticsWarning]'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + } + + def __init__( + self, + **kwargs + ): + super(DocumentEntities, self).__init__(**kwargs) + self.id = kwargs['id'] + self.entities = kwargs['entities'] + self.warnings = kwargs['warnings'] + self.statistics = kwargs.get('statistics', None) + + +class DocumentError(msrest.serialization.Model): + """DocumentError. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Document Id. + :type id: str + :param error: Required. Document Error. + :type error: ~azure.ai.textanalytics.v3_1_preview_4.models.TextAnalyticsError + """ + + _validation = { + 'id': {'required': True}, + 'error': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'TextAnalyticsError'}, + } + + def __init__( + self, + **kwargs + ): + super(DocumentError, self).__init__(**kwargs) + self.id = kwargs['id'] + self.error = kwargs['error'] + + +class DocumentHealthcareEntities(msrest.serialization.Model): + """DocumentHealthcareEntities. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param entities: Required. Healthcare entities. + :type entities: list[~azure.ai.textanalytics.v3_1_preview_4.models.HealthcareEntity] + :param relations: Required. Healthcare entity relations. + :type relations: list[~azure.ai.textanalytics.v3_1_preview_4.models.HealthcareRelation] + :param warnings: Required. Warnings encountered while processing document. + :type warnings: list[~azure.ai.textanalytics.v3_1_preview_4.models.TextAnalyticsWarning] + :param statistics: if showStats=true was specified in the request this field will contain + information about the document payload. + :type statistics: ~azure.ai.textanalytics.v3_1_preview_4.models.DocumentStatistics + """ + + _validation = { + 'id': {'required': True}, + 'entities': {'required': True}, + 'relations': {'required': True}, + 'warnings': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'entities': {'key': 'entities', 'type': '[HealthcareEntity]'}, + 'relations': {'key': 'relations', 'type': '[HealthcareRelation]'}, + 'warnings': {'key': 'warnings', 'type': '[TextAnalyticsWarning]'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + } + + def __init__( + self, + **kwargs + ): + super(DocumentHealthcareEntities, self).__init__(**kwargs) + self.id = kwargs['id'] + self.entities = kwargs['entities'] + self.relations = kwargs['relations'] + self.warnings = kwargs['warnings'] + self.statistics = kwargs.get('statistics', None) + + +class DocumentKeyPhrases(msrest.serialization.Model): + """DocumentKeyPhrases. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param key_phrases: Required. A list of representative words or phrases. The number of key + phrases returned is proportional to the number of words in the input document. + :type key_phrases: list[str] + :param warnings: Required. Warnings encountered while processing document. + :type warnings: list[~azure.ai.textanalytics.v3_1_preview_4.models.TextAnalyticsWarning] + :param statistics: if showStats=true was specified in the request this field will contain + information about the document payload. + :type statistics: ~azure.ai.textanalytics.v3_1_preview_4.models.DocumentStatistics + """ + + _validation = { + 'id': {'required': True}, + 'key_phrases': {'required': True}, + 'warnings': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'key_phrases': {'key': 'keyPhrases', 'type': '[str]'}, + 'warnings': {'key': 'warnings', 'type': '[TextAnalyticsWarning]'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + } + + def __init__( + self, + **kwargs + ): + super(DocumentKeyPhrases, self).__init__(**kwargs) + self.id = kwargs['id'] + self.key_phrases = kwargs['key_phrases'] + self.warnings = kwargs['warnings'] + self.statistics = kwargs.get('statistics', None) + + +class DocumentLanguage(msrest.serialization.Model): + """DocumentLanguage. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param detected_language: Required. Detected Language. + :type detected_language: ~azure.ai.textanalytics.v3_1_preview_4.models.DetectedLanguage + :param warnings: Required. Warnings encountered while processing document. + :type warnings: list[~azure.ai.textanalytics.v3_1_preview_4.models.TextAnalyticsWarning] + :param statistics: if showStats=true was specified in the request this field will contain + information about the document payload. + :type statistics: ~azure.ai.textanalytics.v3_1_preview_4.models.DocumentStatistics + """ + + _validation = { + 'id': {'required': True}, + 'detected_language': {'required': True}, + 'warnings': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'detected_language': {'key': 'detectedLanguage', 'type': 'DetectedLanguage'}, + 'warnings': {'key': 'warnings', 'type': '[TextAnalyticsWarning]'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + } + + def __init__( + self, + **kwargs + ): + super(DocumentLanguage, self).__init__(**kwargs) + self.id = kwargs['id'] + self.detected_language = kwargs['detected_language'] + self.warnings = kwargs['warnings'] + self.statistics = kwargs.get('statistics', None) + + +class DocumentLinkedEntities(msrest.serialization.Model): + """DocumentLinkedEntities. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param entities: Required. Recognized well known entities in the document. + :type entities: list[~azure.ai.textanalytics.v3_1_preview_4.models.LinkedEntity] + :param warnings: Required. Warnings encountered while processing document. + :type warnings: list[~azure.ai.textanalytics.v3_1_preview_4.models.TextAnalyticsWarning] + :param statistics: if showStats=true was specified in the request this field will contain + information about the document payload. + :type statistics: ~azure.ai.textanalytics.v3_1_preview_4.models.DocumentStatistics + """ + + _validation = { + 'id': {'required': True}, + 'entities': {'required': True}, + 'warnings': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'entities': {'key': 'entities', 'type': '[LinkedEntity]'}, + 'warnings': {'key': 'warnings', 'type': '[TextAnalyticsWarning]'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + } + + def __init__( + self, + **kwargs + ): + super(DocumentLinkedEntities, self).__init__(**kwargs) + self.id = kwargs['id'] + self.entities = kwargs['entities'] + self.warnings = kwargs['warnings'] + self.statistics = kwargs.get('statistics', None) + + +class DocumentSentiment(msrest.serialization.Model): + """DocumentSentiment. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param sentiment: Required. Predicted sentiment for document (Negative, Neutral, Positive, or + Mixed). Possible values include: "positive", "neutral", "negative", "mixed". + :type sentiment: str or ~azure.ai.textanalytics.v3_1_preview_4.models.DocumentSentimentValue + :param statistics: if showStats=true was specified in the request this field will contain + information about the document payload. + :type statistics: ~azure.ai.textanalytics.v3_1_preview_4.models.DocumentStatistics + :param confidence_scores: Required. Document level sentiment confidence scores between 0 and 1 + for each sentiment class. + :type confidence_scores: + ~azure.ai.textanalytics.v3_1_preview_4.models.SentimentConfidenceScorePerLabel + :param sentences: Required. Sentence level sentiment analysis. + :type sentences: list[~azure.ai.textanalytics.v3_1_preview_4.models.SentenceSentiment] + :param warnings: Required. Warnings encountered while processing document. + :type warnings: list[~azure.ai.textanalytics.v3_1_preview_4.models.TextAnalyticsWarning] + """ + + _validation = { + 'id': {'required': True}, + 'sentiment': {'required': True}, + 'confidence_scores': {'required': True}, + 'sentences': {'required': True}, + 'warnings': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'sentiment': {'key': 'sentiment', 'type': 'str'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + 'confidence_scores': {'key': 'confidenceScores', 'type': 'SentimentConfidenceScorePerLabel'}, + 'sentences': {'key': 'sentences', 'type': '[SentenceSentiment]'}, + 'warnings': {'key': 'warnings', 'type': '[TextAnalyticsWarning]'}, + } + + def __init__( + self, + **kwargs + ): + super(DocumentSentiment, self).__init__(**kwargs) + self.id = kwargs['id'] + self.sentiment = kwargs['sentiment'] + self.statistics = kwargs.get('statistics', None) + self.confidence_scores = kwargs['confidence_scores'] + self.sentences = kwargs['sentences'] + self.warnings = kwargs['warnings'] + + +class DocumentStatistics(msrest.serialization.Model): + """if showStats=true was specified in the request this field will contain information about the document payload. + + All required parameters must be populated in order to send to Azure. + + :param characters_count: Required. Number of text elements recognized in the document. + :type characters_count: int + :param transactions_count: Required. Number of transactions for the document. + :type transactions_count: int + """ + + _validation = { + 'characters_count': {'required': True}, + 'transactions_count': {'required': True}, + } + + _attribute_map = { + 'characters_count': {'key': 'charactersCount', 'type': 'int'}, + 'transactions_count': {'key': 'transactionsCount', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(DocumentStatistics, self).__init__(**kwargs) + self.characters_count = kwargs['characters_count'] + self.transactions_count = kwargs['transactions_count'] + + +class EntitiesResult(msrest.serialization.Model): + """EntitiesResult. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. Response by document. + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.DocumentEntities] + :param errors: Required. Errors by document id. + :type errors: list[~azure.ai.textanalytics.v3_1_preview_4.models.DocumentError] + :param statistics: if showStats=true was specified in the request this field will contain + information about the request payload. + :type statistics: ~azure.ai.textanalytics.v3_1_preview_4.models.RequestStatistics + :param model_version: Required. This field indicates which model is used for scoring. + :type model_version: str + """ + + _validation = { + 'documents': {'required': True}, + 'errors': {'required': True}, + 'model_version': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[DocumentEntities]'}, + 'errors': {'key': 'errors', 'type': '[DocumentError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + 'model_version': {'key': 'modelVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EntitiesResult, self).__init__(**kwargs) + self.documents = kwargs['documents'] + self.errors = kwargs['errors'] + self.statistics = kwargs.get('statistics', None) + self.model_version = kwargs['model_version'] + + +class EntitiesTask(msrest.serialization.Model): + """EntitiesTask. + + :param parameters: + :type parameters: ~azure.ai.textanalytics.v3_1_preview_4.models.EntitiesTaskParameters + """ + + _attribute_map = { + 'parameters': {'key': 'parameters', 'type': 'EntitiesTaskParameters'}, + } + + def __init__( + self, + **kwargs + ): + super(EntitiesTask, self).__init__(**kwargs) + self.parameters = kwargs.get('parameters', None) + + +class EntitiesTaskParameters(msrest.serialization.Model): + """EntitiesTaskParameters. + + :param model_version: + :type model_version: str + :param string_index_type: Possible values include: "TextElements_v8", "UnicodeCodePoint", + "Utf16CodeUnit". Default value: "TextElements_v8". + :type string_index_type: str or + ~azure.ai.textanalytics.v3_1_preview_4.models.StringIndexTypeResponse + """ + + _attribute_map = { + 'model_version': {'key': 'model-version', 'type': 'str'}, + 'string_index_type': {'key': 'stringIndexType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EntitiesTaskParameters, self).__init__(**kwargs) + self.model_version = kwargs.get('model_version', "latest") + self.string_index_type = kwargs.get('string_index_type', "TextElements_v8") + + +class Entity(msrest.serialization.Model): + """Entity. + + All required parameters must be populated in order to send to Azure. + + :param text: Required. Entity text as appears in the request. + :type text: str + :param category: Required. Entity type. + :type category: str + :param subcategory: (Optional) Entity sub type. + :type subcategory: str + :param offset: Required. Start position for the entity text. Use of different 'stringIndexType' + values can affect the offset returned. + :type offset: int + :param length: Required. Length for the entity text. Use of different 'stringIndexType' values + can affect the length returned. + :type length: int + :param confidence_score: Required. Confidence score between 0 and 1 of the extracted entity. + :type confidence_score: float + """ + + _validation = { + 'text': {'required': True}, + 'category': {'required': True}, + 'offset': {'required': True}, + 'length': {'required': True}, + 'confidence_score': {'required': True}, + } + + _attribute_map = { + 'text': {'key': 'text', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'subcategory': {'key': 'subcategory', 'type': 'str'}, + 'offset': {'key': 'offset', 'type': 'int'}, + 'length': {'key': 'length', 'type': 'int'}, + 'confidence_score': {'key': 'confidenceScore', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(Entity, self).__init__(**kwargs) + self.text = kwargs['text'] + self.category = kwargs['category'] + self.subcategory = kwargs.get('subcategory', None) + self.offset = kwargs['offset'] + self.length = kwargs['length'] + self.confidence_score = kwargs['confidence_score'] + + +class EntityLinkingResult(msrest.serialization.Model): + """EntityLinkingResult. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. Response by document. + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.DocumentLinkedEntities] + :param errors: Required. Errors by document id. + :type errors: list[~azure.ai.textanalytics.v3_1_preview_4.models.DocumentError] + :param statistics: if showStats=true was specified in the request this field will contain + information about the request payload. + :type statistics: ~azure.ai.textanalytics.v3_1_preview_4.models.RequestStatistics + :param model_version: Required. This field indicates which model is used for scoring. + :type model_version: str + """ + + _validation = { + 'documents': {'required': True}, + 'errors': {'required': True}, + 'model_version': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[DocumentLinkedEntities]'}, + 'errors': {'key': 'errors', 'type': '[DocumentError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + 'model_version': {'key': 'modelVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EntityLinkingResult, self).__init__(**kwargs) + self.documents = kwargs['documents'] + self.errors = kwargs['errors'] + self.statistics = kwargs.get('statistics', None) + self.model_version = kwargs['model_version'] + + +class EntityLinkingTask(msrest.serialization.Model): + """EntityLinkingTask. + + :param parameters: + :type parameters: ~azure.ai.textanalytics.v3_1_preview_4.models.EntityLinkingTaskParameters + """ + + _attribute_map = { + 'parameters': {'key': 'parameters', 'type': 'EntityLinkingTaskParameters'}, + } + + def __init__( + self, + **kwargs + ): + super(EntityLinkingTask, self).__init__(**kwargs) + self.parameters = kwargs.get('parameters', None) + + +class EntityLinkingTaskParameters(msrest.serialization.Model): + """EntityLinkingTaskParameters. + + :param model_version: + :type model_version: str + :param string_index_type: Possible values include: "TextElements_v8", "UnicodeCodePoint", + "Utf16CodeUnit". Default value: "TextElements_v8". + :type string_index_type: str or + ~azure.ai.textanalytics.v3_1_preview_4.models.StringIndexTypeResponse + """ + + _attribute_map = { + 'model_version': {'key': 'model-version', 'type': 'str'}, + 'string_index_type': {'key': 'stringIndexType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EntityLinkingTaskParameters, self).__init__(**kwargs) + self.model_version = kwargs.get('model_version', "latest") + self.string_index_type = kwargs.get('string_index_type', "TextElements_v8") + + +class ErrorResponse(msrest.serialization.Model): + """ErrorResponse. + + All required parameters must be populated in order to send to Azure. + + :param error: Required. Document Error. + :type error: ~azure.ai.textanalytics.v3_1_preview_4.models.TextAnalyticsError + """ + + _validation = { + 'error': {'required': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'TextAnalyticsError'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs['error'] + + +class HealthcareAssertion(msrest.serialization.Model): + """HealthcareAssertion. + + :param conditionality: Describes any conditionality on the entity. Possible values include: + "Hypothetical", "Conditional". + :type conditionality: str or ~azure.ai.textanalytics.v3_1_preview_4.models.Conditionality + :param certainty: Describes the entities certainty and polarity. Possible values include: + "Positive", "Positive Possible", "Neutral Possible", "Negative Possible", "Negative". + :type certainty: str or ~azure.ai.textanalytics.v3_1_preview_4.models.Certainty + :param association: Describes if the entity is the subject of the text or if it describes + someone else. Possible values include: "subject", "other". + :type association: str or ~azure.ai.textanalytics.v3_1_preview_4.models.Association + """ + + _attribute_map = { + 'conditionality': {'key': 'conditionality', 'type': 'str'}, + 'certainty': {'key': 'certainty', 'type': 'str'}, + 'association': {'key': 'association', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(HealthcareAssertion, self).__init__(**kwargs) + self.conditionality = kwargs.get('conditionality', None) + self.certainty = kwargs.get('certainty', None) + self.association = kwargs.get('association', None) + + +class HealthcareEntity(Entity): + """HealthcareEntity. + + All required parameters must be populated in order to send to Azure. + + :param text: Required. Entity text as appears in the request. + :type text: str + :param category: Required. Entity type. + :type category: str + :param subcategory: (Optional) Entity sub type. + :type subcategory: str + :param offset: Required. Start position for the entity text. Use of different 'stringIndexType' + values can affect the offset returned. + :type offset: int + :param length: Required. Length for the entity text. Use of different 'stringIndexType' values + can affect the length returned. + :type length: int + :param confidence_score: Required. Confidence score between 0 and 1 of the extracted entity. + :type confidence_score: float + :param assertion: + :type assertion: ~azure.ai.textanalytics.v3_1_preview_4.models.HealthcareAssertion + :param name: Preferred name for the entity. Example: 'histologically' would have a 'name' of + 'histologic'. + :type name: str + :param links: Entity references in known data sources. + :type links: list[~azure.ai.textanalytics.v3_1_preview_4.models.HealthcareEntityLink] + """ + + _validation = { + 'text': {'required': True}, + 'category': {'required': True}, + 'offset': {'required': True}, + 'length': {'required': True}, + 'confidence_score': {'required': True}, + } + + _attribute_map = { + 'text': {'key': 'text', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'subcategory': {'key': 'subcategory', 'type': 'str'}, + 'offset': {'key': 'offset', 'type': 'int'}, + 'length': {'key': 'length', 'type': 'int'}, + 'confidence_score': {'key': 'confidenceScore', 'type': 'float'}, + 'assertion': {'key': 'assertion', 'type': 'HealthcareAssertion'}, + 'name': {'key': 'name', 'type': 'str'}, + 'links': {'key': 'links', 'type': '[HealthcareEntityLink]'}, + } + + def __init__( + self, + **kwargs + ): + super(HealthcareEntity, self).__init__(**kwargs) + self.assertion = kwargs.get('assertion', None) + self.name = kwargs.get('name', None) + self.links = kwargs.get('links', None) + + +class HealthcareEntityLink(msrest.serialization.Model): + """HealthcareEntityLink. + + All required parameters must be populated in order to send to Azure. + + :param data_source: Required. Entity Catalog. Examples include: UMLS, CHV, MSH, etc. + :type data_source: str + :param id: Required. Entity id in the given source catalog. + :type id: str + """ + + _validation = { + 'data_source': {'required': True}, + 'id': {'required': True}, + } + + _attribute_map = { + 'data_source': {'key': 'dataSource', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(HealthcareEntityLink, self).__init__(**kwargs) + self.data_source = kwargs['data_source'] + self.id = kwargs['id'] + + +class HealthcareJobState(JobMetadata, Pagination): + """HealthcareJobState. + + All required parameters must be populated in order to send to Azure. + + :param next_link: + :type next_link: str + :param created_date_time: Required. + :type created_date_time: ~datetime.datetime + :param expiration_date_time: + :type expiration_date_time: ~datetime.datetime + :param job_id: Required. + :type job_id: str + :param last_update_date_time: Required. + :type last_update_date_time: ~datetime.datetime + :param status: Required. Possible values include: "notStarted", "running", "succeeded", + "failed", "rejected", "cancelled", "cancelling", "partiallyCompleted". + :type status: str or ~azure.ai.textanalytics.v3_1_preview_4.models.State + :param results: + :type results: ~azure.ai.textanalytics.v3_1_preview_4.models.HealthcareResult + :param errors: + :type errors: list[~azure.ai.textanalytics.v3_1_preview_4.models.TextAnalyticsError] + """ + + _validation = { + 'created_date_time': {'required': True}, + 'job_id': {'required': True}, + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'next_link': {'key': '@nextLink', 'type': 'str'}, + 'created_date_time': {'key': 'createdDateTime', 'type': 'iso-8601'}, + 'expiration_date_time': {'key': 'expirationDateTime', 'type': 'iso-8601'}, + 'job_id': {'key': 'jobId', 'type': 'str'}, + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'status': {'key': 'status', 'type': 'str'}, + 'results': {'key': 'results', 'type': 'HealthcareResult'}, + 'errors': {'key': 'errors', 'type': '[TextAnalyticsError]'}, + } + + def __init__( + self, + **kwargs + ): + super(HealthcareJobState, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.results = kwargs.get('results', None) + self.errors = kwargs.get('errors', None) + self.created_date_time = kwargs['created_date_time'] + self.expiration_date_time = kwargs.get('expiration_date_time', None) + self.job_id = kwargs['job_id'] + self.last_update_date_time = kwargs['last_update_date_time'] + self.status = kwargs['status'] + self.results = kwargs.get('results', None) + self.errors = kwargs.get('errors', None) + + +class HealthcareRelation(msrest.serialization.Model): + """Every relation is an entity graph of a certain relationType, where all entities are connected and have specific roles within the relation context. + + All required parameters must be populated in order to send to Azure. + + :param relation_type: Required. Type of relation. Examples include: ``DosageOfMedication`` or + 'FrequencyOfMedication', etc. Possible values include: "Abbreviation", + "DirectionOfBodyStructure", "DirectionOfCondition", "DirectionOfExamination", + "DirectionOfTreatment", "DosageOfMedication", "FormOfMedication", "FrequencyOfMedication", + "FrequencyOfTreatment", "QualifierOfCondition", "RelationOfExamination", "RouteOfMedication", + "TimeOfCondition", "TimeOfEvent", "TimeOfExamination", "TimeOfMedication", "TimeOfTreatment", + "UnitOfCondition", "UnitOfExamination", "ValueOfCondition", "ValueOfExamination". + :type relation_type: str or ~azure.ai.textanalytics.v3_1_preview_4.models.RelationType + :param entities: Required. The entities in the relation. + :type entities: list[~azure.ai.textanalytics.v3_1_preview_4.models.HealthcareRelationEntity] + """ + + _validation = { + 'relation_type': {'required': True}, + 'entities': {'required': True}, + } + + _attribute_map = { + 'relation_type': {'key': 'relationType', 'type': 'str'}, + 'entities': {'key': 'entities', 'type': '[HealthcareRelationEntity]'}, + } + + def __init__( + self, + **kwargs + ): + super(HealthcareRelation, self).__init__(**kwargs) + self.relation_type = kwargs['relation_type'] + self.entities = kwargs['entities'] + + +class HealthcareRelationEntity(msrest.serialization.Model): + """HealthcareRelationEntity. + + All required parameters must be populated in order to send to Azure. + + :param ref: Required. Reference link object, using a JSON pointer RFC 6901 (URI Fragment + Identifier Representation), pointing to the entity . + :type ref: str + :param role: Required. Role of entity in the relationship. For example: 'CD20-positive diffuse + large B-cell lymphoma' has the following entities with their roles in parenthesis: CD20 + (GeneOrProtein), Positive (Expression), diffuse large B-cell lymphoma (Diagnosis). + :type role: str + """ + + _validation = { + 'ref': {'required': True}, + 'role': {'required': True}, + } + + _attribute_map = { + 'ref': {'key': 'ref', 'type': 'str'}, + 'role': {'key': 'role', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(HealthcareRelationEntity, self).__init__(**kwargs) + self.ref = kwargs['ref'] + self.role = kwargs['role'] + + +class HealthcareResult(msrest.serialization.Model): + """HealthcareResult. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. Response by document. + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.DocumentHealthcareEntities] + :param errors: Required. Errors by document id. + :type errors: list[~azure.ai.textanalytics.v3_1_preview_4.models.DocumentError] + :param statistics: if showStats=true was specified in the request this field will contain + information about the request payload. + :type statistics: ~azure.ai.textanalytics.v3_1_preview_4.models.RequestStatistics + :param model_version: Required. This field indicates which model is used for scoring. + :type model_version: str + """ + + _validation = { + 'documents': {'required': True}, + 'errors': {'required': True}, + 'model_version': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[DocumentHealthcareEntities]'}, + 'errors': {'key': 'errors', 'type': '[DocumentError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + 'model_version': {'key': 'modelVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(HealthcareResult, self).__init__(**kwargs) + self.documents = kwargs['documents'] + self.errors = kwargs['errors'] + self.statistics = kwargs.get('statistics', None) + self.model_version = kwargs['model_version'] + + +class InnerError(msrest.serialization.Model): + """InnerError. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. Error code. Possible values include: "InvalidParameterValue", + "InvalidRequestBodyFormat", "EmptyRequest", "MissingInputRecords", "InvalidDocument", + "ModelVersionIncorrect", "InvalidDocumentBatch", "UnsupportedLanguageCode", + "InvalidCountryHint". + :type code: str or ~azure.ai.textanalytics.v3_1_preview_4.models.InnerErrorCodeValue + :param message: Required. Error message. + :type message: str + :param details: Error details. + :type details: dict[str, str] + :param target: Error target. + :type target: str + :param innererror: Inner error contains more specific information. + :type innererror: ~azure.ai.textanalytics.v3_1_preview_4.models.InnerError + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': '{str}'}, + 'target': {'key': 'target', 'type': 'str'}, + 'innererror': {'key': 'innererror', 'type': 'InnerError'}, + } + + def __init__( + self, + **kwargs + ): + super(InnerError, self).__init__(**kwargs) + self.code = kwargs['code'] + self.message = kwargs['message'] + self.details = kwargs.get('details', None) + self.target = kwargs.get('target', None) + self.innererror = kwargs.get('innererror', None) + + +class JobManifestTasks(msrest.serialization.Model): + """The set of tasks to execute on the input documents. Cannot specify the same task more than once. + + :param entity_recognition_tasks: + :type entity_recognition_tasks: + list[~azure.ai.textanalytics.v3_1_preview_4.models.EntitiesTask] + :param entity_recognition_pii_tasks: + :type entity_recognition_pii_tasks: list[~azure.ai.textanalytics.v3_1_preview_4.models.PiiTask] + :param key_phrase_extraction_tasks: + :type key_phrase_extraction_tasks: + list[~azure.ai.textanalytics.v3_1_preview_4.models.KeyPhrasesTask] + :param entity_linking_tasks: + :type entity_linking_tasks: + list[~azure.ai.textanalytics.v3_1_preview_4.models.EntityLinkingTask] + """ + + _attribute_map = { + 'entity_recognition_tasks': {'key': 'entityRecognitionTasks', 'type': '[EntitiesTask]'}, + 'entity_recognition_pii_tasks': {'key': 'entityRecognitionPiiTasks', 'type': '[PiiTask]'}, + 'key_phrase_extraction_tasks': {'key': 'keyPhraseExtractionTasks', 'type': '[KeyPhrasesTask]'}, + 'entity_linking_tasks': {'key': 'entityLinkingTasks', 'type': '[EntityLinkingTask]'}, + } + + def __init__( + self, + **kwargs + ): + super(JobManifestTasks, self).__init__(**kwargs) + self.entity_recognition_tasks = kwargs.get('entity_recognition_tasks', None) + self.entity_recognition_pii_tasks = kwargs.get('entity_recognition_pii_tasks', None) + self.key_phrase_extraction_tasks = kwargs.get('key_phrase_extraction_tasks', None) + self.entity_linking_tasks = kwargs.get('entity_linking_tasks', None) + + +class KeyPhraseResult(msrest.serialization.Model): + """KeyPhraseResult. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. Response by document. + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.DocumentKeyPhrases] + :param errors: Required. Errors by document id. + :type errors: list[~azure.ai.textanalytics.v3_1_preview_4.models.DocumentError] + :param statistics: if showStats=true was specified in the request this field will contain + information about the request payload. + :type statistics: ~azure.ai.textanalytics.v3_1_preview_4.models.RequestStatistics + :param model_version: Required. This field indicates which model is used for scoring. + :type model_version: str + """ + + _validation = { + 'documents': {'required': True}, + 'errors': {'required': True}, + 'model_version': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[DocumentKeyPhrases]'}, + 'errors': {'key': 'errors', 'type': '[DocumentError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + 'model_version': {'key': 'modelVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(KeyPhraseResult, self).__init__(**kwargs) + self.documents = kwargs['documents'] + self.errors = kwargs['errors'] + self.statistics = kwargs.get('statistics', None) + self.model_version = kwargs['model_version'] + + +class KeyPhrasesTask(msrest.serialization.Model): + """KeyPhrasesTask. + + :param parameters: + :type parameters: ~azure.ai.textanalytics.v3_1_preview_4.models.KeyPhrasesTaskParameters + """ + + _attribute_map = { + 'parameters': {'key': 'parameters', 'type': 'KeyPhrasesTaskParameters'}, + } + + def __init__( + self, + **kwargs + ): + super(KeyPhrasesTask, self).__init__(**kwargs) + self.parameters = kwargs.get('parameters', None) + + +class KeyPhrasesTaskParameters(msrest.serialization.Model): + """KeyPhrasesTaskParameters. + + :param model_version: + :type model_version: str + """ + + _attribute_map = { + 'model_version': {'key': 'model-version', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(KeyPhrasesTaskParameters, self).__init__(**kwargs) + self.model_version = kwargs.get('model_version', "latest") + + +class LanguageBatchInput(msrest.serialization.Model): + """LanguageBatchInput. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.LanguageInput] + """ + + _validation = { + 'documents': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[LanguageInput]'}, + } + + def __init__( + self, + **kwargs + ): + super(LanguageBatchInput, self).__init__(**kwargs) + self.documents = kwargs['documents'] + + +class LanguageInput(msrest.serialization.Model): + """LanguageInput. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param text: Required. + :type text: str + :param country_hint: + :type country_hint: str + """ + + _validation = { + 'id': {'required': True}, + 'text': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'text': {'key': 'text', 'type': 'str'}, + 'country_hint': {'key': 'countryHint', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LanguageInput, self).__init__(**kwargs) + self.id = kwargs['id'] + self.text = kwargs['text'] + self.country_hint = kwargs.get('country_hint', None) + + +class LanguageResult(msrest.serialization.Model): + """LanguageResult. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. Response by document. + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.DocumentLanguage] + :param errors: Required. Errors by document id. + :type errors: list[~azure.ai.textanalytics.v3_1_preview_4.models.DocumentError] + :param statistics: if showStats=true was specified in the request this field will contain + information about the request payload. + :type statistics: ~azure.ai.textanalytics.v3_1_preview_4.models.RequestStatistics + :param model_version: Required. This field indicates which model is used for scoring. + :type model_version: str + """ + + _validation = { + 'documents': {'required': True}, + 'errors': {'required': True}, + 'model_version': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[DocumentLanguage]'}, + 'errors': {'key': 'errors', 'type': '[DocumentError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + 'model_version': {'key': 'modelVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LanguageResult, self).__init__(**kwargs) + self.documents = kwargs['documents'] + self.errors = kwargs['errors'] + self.statistics = kwargs.get('statistics', None) + self.model_version = kwargs['model_version'] + + +class LinkedEntity(msrest.serialization.Model): + """LinkedEntity. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Entity Linking formal name. + :type name: str + :param matches: Required. List of instances this entity appears in the text. + :type matches: list[~azure.ai.textanalytics.v3_1_preview_4.models.Match] + :param language: Required. Language used in the data source. + :type language: str + :param id: Unique identifier of the recognized entity from the data source. + :type id: str + :param url: Required. URL for the entity's page from the data source. + :type url: str + :param data_source: Required. Data source used to extract entity linking, such as Wiki/Bing + etc. + :type data_source: str + :param bing_id: Bing Entity Search API unique identifier of the recognized entity. + :type bing_id: str + """ + + _validation = { + 'name': {'required': True}, + 'matches': {'required': True}, + 'language': {'required': True}, + 'url': {'required': True}, + 'data_source': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'matches': {'key': 'matches', 'type': '[Match]'}, + 'language': {'key': 'language', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'data_source': {'key': 'dataSource', 'type': 'str'}, + 'bing_id': {'key': 'bingId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LinkedEntity, self).__init__(**kwargs) + self.name = kwargs['name'] + self.matches = kwargs['matches'] + self.language = kwargs['language'] + self.id = kwargs.get('id', None) + self.url = kwargs['url'] + self.data_source = kwargs['data_source'] + self.bing_id = kwargs.get('bing_id', None) + + +class Match(msrest.serialization.Model): + """Match. + + All required parameters must be populated in order to send to Azure. + + :param confidence_score: Required. If a well known item is recognized, a decimal number + denoting the confidence level between 0 and 1 will be returned. + :type confidence_score: float + :param text: Required. Entity text as appears in the request. + :type text: str + :param offset: Required. Start position for the entity match text. + :type offset: int + :param length: Required. Length for the entity match text. + :type length: int + """ + + _validation = { + 'confidence_score': {'required': True}, + 'text': {'required': True}, + 'offset': {'required': True}, + 'length': {'required': True}, + } + + _attribute_map = { + 'confidence_score': {'key': 'confidenceScore', 'type': 'float'}, + 'text': {'key': 'text', 'type': 'str'}, + 'offset': {'key': 'offset', 'type': 'int'}, + 'length': {'key': 'length', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(Match, self).__init__(**kwargs) + self.confidence_score = kwargs['confidence_score'] + self.text = kwargs['text'] + self.offset = kwargs['offset'] + self.length = kwargs['length'] + + +class MultiLanguageBatchInput(msrest.serialization.Model): + """Contains a set of input documents to be analyzed by the service. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. The set of documents to process as part of this batch. + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.MultiLanguageInput] + """ + + _validation = { + 'documents': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[MultiLanguageInput]'}, + } + + def __init__( + self, + **kwargs + ): + super(MultiLanguageBatchInput, self).__init__(**kwargs) + self.documents = kwargs['documents'] + + +class MultiLanguageInput(msrest.serialization.Model): + """Contains an input document to be analyzed by the service. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. A unique, non-empty document identifier. + :type id: str + :param text: Required. The input text to process. + :type text: str + :param language: (Optional) This is the 2 letter ISO 639-1 representation of a language. For + example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as + default. + :type language: str + """ + + _validation = { + 'id': {'required': True}, + 'text': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'text': {'key': 'text', 'type': 'str'}, + 'language': {'key': 'language', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MultiLanguageInput, self).__init__(**kwargs) + self.id = kwargs['id'] + self.text = kwargs['text'] + self.language = kwargs.get('language', None) + + +class PiiDocumentEntities(msrest.serialization.Model): + """PiiDocumentEntities. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param redacted_text: Required. Returns redacted text. + :type redacted_text: str + :param entities: Required. Recognized entities in the document. + :type entities: list[~azure.ai.textanalytics.v3_1_preview_4.models.Entity] + :param warnings: Required. Warnings encountered while processing document. + :type warnings: list[~azure.ai.textanalytics.v3_1_preview_4.models.TextAnalyticsWarning] + :param statistics: if showStats=true was specified in the request this field will contain + information about the document payload. + :type statistics: ~azure.ai.textanalytics.v3_1_preview_4.models.DocumentStatistics + """ + + _validation = { + 'id': {'required': True}, + 'redacted_text': {'required': True}, + 'entities': {'required': True}, + 'warnings': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'redacted_text': {'key': 'redactedText', 'type': 'str'}, + 'entities': {'key': 'entities', 'type': '[Entity]'}, + 'warnings': {'key': 'warnings', 'type': '[TextAnalyticsWarning]'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + } + + def __init__( + self, + **kwargs + ): + super(PiiDocumentEntities, self).__init__(**kwargs) + self.id = kwargs['id'] + self.redacted_text = kwargs['redacted_text'] + self.entities = kwargs['entities'] + self.warnings = kwargs['warnings'] + self.statistics = kwargs.get('statistics', None) + + +class PiiResult(msrest.serialization.Model): + """PiiResult. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. Response by document. + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.PiiDocumentEntities] + :param errors: Required. Errors by document id. + :type errors: list[~azure.ai.textanalytics.v3_1_preview_4.models.DocumentError] + :param statistics: if showStats=true was specified in the request this field will contain + information about the request payload. + :type statistics: ~azure.ai.textanalytics.v3_1_preview_4.models.RequestStatistics + :param model_version: Required. This field indicates which model is used for scoring. + :type model_version: str + """ + + _validation = { + 'documents': {'required': True}, + 'errors': {'required': True}, + 'model_version': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[PiiDocumentEntities]'}, + 'errors': {'key': 'errors', 'type': '[DocumentError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + 'model_version': {'key': 'modelVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PiiResult, self).__init__(**kwargs) + self.documents = kwargs['documents'] + self.errors = kwargs['errors'] + self.statistics = kwargs.get('statistics', None) + self.model_version = kwargs['model_version'] + + +class PiiTask(msrest.serialization.Model): + """PiiTask. + + :param parameters: + :type parameters: ~azure.ai.textanalytics.v3_1_preview_4.models.PiiTaskParameters + """ + + _attribute_map = { + 'parameters': {'key': 'parameters', 'type': 'PiiTaskParameters'}, + } + + def __init__( + self, + **kwargs + ): + super(PiiTask, self).__init__(**kwargs) + self.parameters = kwargs.get('parameters', None) + + +class PiiTaskParameters(msrest.serialization.Model): + """PiiTaskParameters. + + :param domain: Possible values include: "phi", "none". Default value: "none". + :type domain: str or ~azure.ai.textanalytics.v3_1_preview_4.models.PiiTaskParametersDomain + :param model_version: + :type model_version: str + :param pii_categories: (Optional) describes the PII categories to return. + :type pii_categories: list[str or ~azure.ai.textanalytics.v3_1_preview_4.models.PiiCategory] + :param string_index_type: Possible values include: "TextElements_v8", "UnicodeCodePoint", + "Utf16CodeUnit". Default value: "TextElements_v8". + :type string_index_type: str or + ~azure.ai.textanalytics.v3_1_preview_4.models.StringIndexTypeResponse + """ + + _validation = { + 'pii_categories': {'unique': True}, + } + + _attribute_map = { + 'domain': {'key': 'domain', 'type': 'str'}, + 'model_version': {'key': 'model-version', 'type': 'str'}, + 'pii_categories': {'key': 'piiCategories', 'type': '[str]'}, + 'string_index_type': {'key': 'stringIndexType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PiiTaskParameters, self).__init__(**kwargs) + self.domain = kwargs.get('domain', "none") + self.model_version = kwargs.get('model_version', "latest") + self.pii_categories = kwargs.get('pii_categories', None) + self.string_index_type = kwargs.get('string_index_type', "TextElements_v8") + + +class RequestStatistics(msrest.serialization.Model): + """if showStats=true was specified in the request this field will contain information about the request payload. + + All required parameters must be populated in order to send to Azure. + + :param documents_count: Required. Number of documents submitted in the request. + :type documents_count: int + :param valid_documents_count: Required. Number of valid documents. This excludes empty, over- + size limit or non-supported languages documents. + :type valid_documents_count: int + :param erroneous_documents_count: Required. Number of invalid documents. This includes empty, + over-size limit or non-supported languages documents. + :type erroneous_documents_count: int + :param transactions_count: Required. Number of transactions for the request. + :type transactions_count: long + """ + + _validation = { + 'documents_count': {'required': True}, + 'valid_documents_count': {'required': True}, + 'erroneous_documents_count': {'required': True}, + 'transactions_count': {'required': True}, + } + + _attribute_map = { + 'documents_count': {'key': 'documentsCount', 'type': 'int'}, + 'valid_documents_count': {'key': 'validDocumentsCount', 'type': 'int'}, + 'erroneous_documents_count': {'key': 'erroneousDocumentsCount', 'type': 'int'}, + 'transactions_count': {'key': 'transactionsCount', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(RequestStatistics, self).__init__(**kwargs) + self.documents_count = kwargs['documents_count'] + self.valid_documents_count = kwargs['valid_documents_count'] + self.erroneous_documents_count = kwargs['erroneous_documents_count'] + self.transactions_count = kwargs['transactions_count'] + + +class SentenceAssessment(msrest.serialization.Model): + """SentenceAssessment. + + All required parameters must be populated in order to send to Azure. + + :param sentiment: Required. Assessment sentiment in the sentence. Possible values include: + "positive", "mixed", "negative". + :type sentiment: str or ~azure.ai.textanalytics.v3_1_preview_4.models.TokenSentimentValue + :param confidence_scores: Required. Assessment sentiment confidence scores in the sentence. + :type confidence_scores: + ~azure.ai.textanalytics.v3_1_preview_4.models.TargetConfidenceScoreLabel + :param offset: Required. The assessment offset from the start of the sentence. + :type offset: int + :param length: Required. The length of the assessment. + :type length: int + :param text: Required. The assessment text detected. + :type text: str + :param is_negated: Required. The indicator representing if the assessment is negated. + :type is_negated: bool + """ + + _validation = { + 'sentiment': {'required': True}, + 'confidence_scores': {'required': True}, + 'offset': {'required': True}, + 'length': {'required': True}, + 'text': {'required': True}, + 'is_negated': {'required': True}, + } + + _attribute_map = { + 'sentiment': {'key': 'sentiment', 'type': 'str'}, + 'confidence_scores': {'key': 'confidenceScores', 'type': 'TargetConfidenceScoreLabel'}, + 'offset': {'key': 'offset', 'type': 'int'}, + 'length': {'key': 'length', 'type': 'int'}, + 'text': {'key': 'text', 'type': 'str'}, + 'is_negated': {'key': 'isNegated', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(SentenceAssessment, self).__init__(**kwargs) + self.sentiment = kwargs['sentiment'] + self.confidence_scores = kwargs['confidence_scores'] + self.offset = kwargs['offset'] + self.length = kwargs['length'] + self.text = kwargs['text'] + self.is_negated = kwargs['is_negated'] + + +class SentenceSentiment(msrest.serialization.Model): + """SentenceSentiment. + + All required parameters must be populated in order to send to Azure. + + :param text: Required. The sentence text. + :type text: str + :param sentiment: Required. The predicted Sentiment for the sentence. Possible values include: + "positive", "neutral", "negative". + :type sentiment: str or ~azure.ai.textanalytics.v3_1_preview_4.models.SentenceSentimentValue + :param confidence_scores: Required. The sentiment confidence score between 0 and 1 for the + sentence for all classes. + :type confidence_scores: + ~azure.ai.textanalytics.v3_1_preview_4.models.SentimentConfidenceScorePerLabel + :param offset: Required. The sentence offset from the start of the document. + :type offset: int + :param length: Required. The length of the sentence. + :type length: int + :param targets: The array of sentence targets for the sentence. + :type targets: list[~azure.ai.textanalytics.v3_1_preview_4.models.SentenceTarget] + :param assessments: The array of assessments for the sentence. + :type assessments: list[~azure.ai.textanalytics.v3_1_preview_4.models.SentenceAssessment] + """ + + _validation = { + 'text': {'required': True}, + 'sentiment': {'required': True}, + 'confidence_scores': {'required': True}, + 'offset': {'required': True}, + 'length': {'required': True}, + } + + _attribute_map = { + 'text': {'key': 'text', 'type': 'str'}, + 'sentiment': {'key': 'sentiment', 'type': 'str'}, + 'confidence_scores': {'key': 'confidenceScores', 'type': 'SentimentConfidenceScorePerLabel'}, + 'offset': {'key': 'offset', 'type': 'int'}, + 'length': {'key': 'length', 'type': 'int'}, + 'targets': {'key': 'targets', 'type': '[SentenceTarget]'}, + 'assessments': {'key': 'assessments', 'type': '[SentenceAssessment]'}, + } + + def __init__( + self, + **kwargs + ): + super(SentenceSentiment, self).__init__(**kwargs) + self.text = kwargs['text'] + self.sentiment = kwargs['sentiment'] + self.confidence_scores = kwargs['confidence_scores'] + self.offset = kwargs['offset'] + self.length = kwargs['length'] + self.targets = kwargs.get('targets', None) + self.assessments = kwargs.get('assessments', None) + + +class SentenceTarget(msrest.serialization.Model): + """SentenceTarget. + + All required parameters must be populated in order to send to Azure. + + :param sentiment: Required. Targeted sentiment in the sentence. Possible values include: + "positive", "mixed", "negative". + :type sentiment: str or ~azure.ai.textanalytics.v3_1_preview_4.models.TokenSentimentValue + :param confidence_scores: Required. Target sentiment confidence scores for the target in the + sentence. + :type confidence_scores: + ~azure.ai.textanalytics.v3_1_preview_4.models.TargetConfidenceScoreLabel + :param offset: Required. The target offset from the start of the sentence. + :type offset: int + :param length: Required. The length of the target. + :type length: int + :param text: Required. The target text detected. + :type text: str + :param relations: Required. The array of either assessment or target objects which is related + to the target. + :type relations: list[~azure.ai.textanalytics.v3_1_preview_4.models.TargetRelation] + """ + + _validation = { + 'sentiment': {'required': True}, + 'confidence_scores': {'required': True}, + 'offset': {'required': True}, + 'length': {'required': True}, + 'text': {'required': True}, + 'relations': {'required': True}, + } + + _attribute_map = { + 'sentiment': {'key': 'sentiment', 'type': 'str'}, + 'confidence_scores': {'key': 'confidenceScores', 'type': 'TargetConfidenceScoreLabel'}, + 'offset': {'key': 'offset', 'type': 'int'}, + 'length': {'key': 'length', 'type': 'int'}, + 'text': {'key': 'text', 'type': 'str'}, + 'relations': {'key': 'relations', 'type': '[TargetRelation]'}, + } + + def __init__( + self, + **kwargs + ): + super(SentenceTarget, self).__init__(**kwargs) + self.sentiment = kwargs['sentiment'] + self.confidence_scores = kwargs['confidence_scores'] + self.offset = kwargs['offset'] + self.length = kwargs['length'] + self.text = kwargs['text'] + self.relations = kwargs['relations'] + + +class SentimentConfidenceScorePerLabel(msrest.serialization.Model): + """Represents the confidence scores between 0 and 1 across all sentiment classes: positive, neutral, negative. + + All required parameters must be populated in order to send to Azure. + + :param positive: Required. + :type positive: float + :param neutral: Required. + :type neutral: float + :param negative: Required. + :type negative: float + """ + + _validation = { + 'positive': {'required': True}, + 'neutral': {'required': True}, + 'negative': {'required': True}, + } + + _attribute_map = { + 'positive': {'key': 'positive', 'type': 'float'}, + 'neutral': {'key': 'neutral', 'type': 'float'}, + 'negative': {'key': 'negative', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(SentimentConfidenceScorePerLabel, self).__init__(**kwargs) + self.positive = kwargs['positive'] + self.neutral = kwargs['neutral'] + self.negative = kwargs['negative'] + + +class SentimentResponse(msrest.serialization.Model): + """SentimentResponse. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. Sentiment analysis per document. + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.DocumentSentiment] + :param errors: Required. Errors by document id. + :type errors: list[~azure.ai.textanalytics.v3_1_preview_4.models.DocumentError] + :param statistics: if showStats=true was specified in the request this field will contain + information about the request payload. + :type statistics: ~azure.ai.textanalytics.v3_1_preview_4.models.RequestStatistics + :param model_version: Required. This field indicates which model is used for scoring. + :type model_version: str + """ + + _validation = { + 'documents': {'required': True}, + 'errors': {'required': True}, + 'model_version': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[DocumentSentiment]'}, + 'errors': {'key': 'errors', 'type': '[DocumentError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + 'model_version': {'key': 'modelVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SentimentResponse, self).__init__(**kwargs) + self.documents = kwargs['documents'] + self.errors = kwargs['errors'] + self.statistics = kwargs.get('statistics', None) + self.model_version = kwargs['model_version'] + + +class TargetConfidenceScoreLabel(msrest.serialization.Model): + """Represents the confidence scores across all sentiment classes: positive, neutral, negative. + + All required parameters must be populated in order to send to Azure. + + :param positive: Required. + :type positive: float + :param negative: Required. + :type negative: float + """ + + _validation = { + 'positive': {'required': True}, + 'negative': {'required': True}, + } + + _attribute_map = { + 'positive': {'key': 'positive', 'type': 'float'}, + 'negative': {'key': 'negative', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(TargetConfidenceScoreLabel, self).__init__(**kwargs) + self.positive = kwargs['positive'] + self.negative = kwargs['negative'] + + +class TargetRelation(msrest.serialization.Model): + """TargetRelation. + + All required parameters must be populated in order to send to Azure. + + :param relation_type: Required. The type related to the target. Possible values include: + "assessment", "target". + :type relation_type: str or ~azure.ai.textanalytics.v3_1_preview_4.models.TargetRelationType + :param ref: Required. The JSON pointer indicating the linked object. + :type ref: str + """ + + _validation = { + 'relation_type': {'required': True}, + 'ref': {'required': True}, + } + + _attribute_map = { + 'relation_type': {'key': 'relationType', 'type': 'str'}, + 'ref': {'key': 'ref', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TargetRelation, self).__init__(**kwargs) + self.relation_type = kwargs['relation_type'] + self.ref = kwargs['ref'] + + +class TasksStateTasks(msrest.serialization.Model): + """TasksStateTasks. + + All required parameters must be populated in order to send to Azure. + + :param details: + :type details: ~azure.ai.textanalytics.v3_1_preview_4.models.TasksStateTasksDetails + :param completed: Required. + :type completed: int + :param failed: Required. + :type failed: int + :param in_progress: Required. + :type in_progress: int + :param total: Required. + :type total: int + :param entity_recognition_tasks: + :type entity_recognition_tasks: + list[~azure.ai.textanalytics.v3_1_preview_4.models.TasksStateTasksEntityRecognitionTasksItem] + :param entity_recognition_pii_tasks: + :type entity_recognition_pii_tasks: + list[~azure.ai.textanalytics.v3_1_preview_4.models.TasksStateTasksEntityRecognitionPiiTasksItem] + :param key_phrase_extraction_tasks: + :type key_phrase_extraction_tasks: + list[~azure.ai.textanalytics.v3_1_preview_4.models.TasksStateTasksKeyPhraseExtractionTasksItem] + :param entity_linking_tasks: + :type entity_linking_tasks: + list[~azure.ai.textanalytics.v3_1_preview_4.models.TasksStateTasksEntityLinkingTasksItem] + """ + + _validation = { + 'completed': {'required': True}, + 'failed': {'required': True}, + 'in_progress': {'required': True}, + 'total': {'required': True}, + } + + _attribute_map = { + 'details': {'key': 'details', 'type': 'TasksStateTasksDetails'}, + 'completed': {'key': 'completed', 'type': 'int'}, + 'failed': {'key': 'failed', 'type': 'int'}, + 'in_progress': {'key': 'inProgress', 'type': 'int'}, + 'total': {'key': 'total', 'type': 'int'}, + 'entity_recognition_tasks': {'key': 'entityRecognitionTasks', 'type': '[TasksStateTasksEntityRecognitionTasksItem]'}, + 'entity_recognition_pii_tasks': {'key': 'entityRecognitionPiiTasks', 'type': '[TasksStateTasksEntityRecognitionPiiTasksItem]'}, + 'key_phrase_extraction_tasks': {'key': 'keyPhraseExtractionTasks', 'type': '[TasksStateTasksKeyPhraseExtractionTasksItem]'}, + 'entity_linking_tasks': {'key': 'entityLinkingTasks', 'type': '[TasksStateTasksEntityLinkingTasksItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(TasksStateTasks, self).__init__(**kwargs) + self.details = kwargs.get('details', None) + self.completed = kwargs['completed'] + self.failed = kwargs['failed'] + self.in_progress = kwargs['in_progress'] + self.total = kwargs['total'] + self.entity_recognition_tasks = kwargs.get('entity_recognition_tasks', None) + self.entity_recognition_pii_tasks = kwargs.get('entity_recognition_pii_tasks', None) + self.key_phrase_extraction_tasks = kwargs.get('key_phrase_extraction_tasks', None) + self.entity_linking_tasks = kwargs.get('entity_linking_tasks', None) + + +class TaskState(msrest.serialization.Model): + """TaskState. + + All required parameters must be populated in order to send to Azure. + + :param last_update_date_time: Required. + :type last_update_date_time: ~datetime.datetime + :param name: + :type name: str + :param status: Required. Possible values include: "notStarted", "running", "succeeded", + "failed", "rejected", "cancelled", "cancelling", "partiallyCompleted". + :type status: str or ~azure.ai.textanalytics.v3_1_preview_4.models.State + """ + + _validation = { + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TaskState, self).__init__(**kwargs) + self.last_update_date_time = kwargs['last_update_date_time'] + self.name = kwargs.get('name', None) + self.status = kwargs['status'] + + +class TasksStateTasksDetails(TaskState): + """TasksStateTasksDetails. + + All required parameters must be populated in order to send to Azure. + + :param last_update_date_time: Required. + :type last_update_date_time: ~datetime.datetime + :param name: + :type name: str + :param status: Required. Possible values include: "notStarted", "running", "succeeded", + "failed", "rejected", "cancelled", "cancelling", "partiallyCompleted". + :type status: str or ~azure.ai.textanalytics.v3_1_preview_4.models.State + """ + + _validation = { + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TasksStateTasksDetails, self).__init__(**kwargs) + + +class TasksStateTasksEntityLinkingTasksItem(TaskState, ComponentsIfu7BjSchemasTasksstatePropertiesTasksPropertiesEntitylinkingtasksItemsAllof1): + """TasksStateTasksEntityLinkingTasksItem. + + All required parameters must be populated in order to send to Azure. + + :param results: + :type results: ~azure.ai.textanalytics.v3_1_preview_4.models.EntityLinkingResult + :param last_update_date_time: Required. + :type last_update_date_time: ~datetime.datetime + :param name: + :type name: str + :param status: Required. Possible values include: "notStarted", "running", "succeeded", + "failed", "rejected", "cancelled", "cancelling", "partiallyCompleted". + :type status: str or ~azure.ai.textanalytics.v3_1_preview_4.models.State + """ + + _validation = { + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'results': {'key': 'results', 'type': 'EntityLinkingResult'}, + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TasksStateTasksEntityLinkingTasksItem, self).__init__(**kwargs) + self.results = kwargs.get('results', None) + self.last_update_date_time = kwargs['last_update_date_time'] + self.name = kwargs.get('name', None) + self.status = kwargs['status'] + + +class TasksStateTasksEntityRecognitionPiiTasksItem(TaskState, Components15X8E9LSchemasTasksstatePropertiesTasksPropertiesEntityrecognitionpiitasksItemsAllof1): + """TasksStateTasksEntityRecognitionPiiTasksItem. + + All required parameters must be populated in order to send to Azure. + + :param results: + :type results: ~azure.ai.textanalytics.v3_1_preview_4.models.PiiResult + :param last_update_date_time: Required. + :type last_update_date_time: ~datetime.datetime + :param name: + :type name: str + :param status: Required. Possible values include: "notStarted", "running", "succeeded", + "failed", "rejected", "cancelled", "cancelling", "partiallyCompleted". + :type status: str or ~azure.ai.textanalytics.v3_1_preview_4.models.State + """ + + _validation = { + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'results': {'key': 'results', 'type': 'PiiResult'}, + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TasksStateTasksEntityRecognitionPiiTasksItem, self).__init__(**kwargs) + self.results = kwargs.get('results', None) + self.last_update_date_time = kwargs['last_update_date_time'] + self.name = kwargs.get('name', None) + self.status = kwargs['status'] + + +class TasksStateTasksEntityRecognitionTasksItem(TaskState, Components15Gvwi3SchemasTasksstatePropertiesTasksPropertiesEntityrecognitiontasksItemsAllof1): + """TasksStateTasksEntityRecognitionTasksItem. + + All required parameters must be populated in order to send to Azure. + + :param results: + :type results: ~azure.ai.textanalytics.v3_1_preview_4.models.EntitiesResult + :param last_update_date_time: Required. + :type last_update_date_time: ~datetime.datetime + :param name: + :type name: str + :param status: Required. Possible values include: "notStarted", "running", "succeeded", + "failed", "rejected", "cancelled", "cancelling", "partiallyCompleted". + :type status: str or ~azure.ai.textanalytics.v3_1_preview_4.models.State + """ + + _validation = { + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'results': {'key': 'results', 'type': 'EntitiesResult'}, + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TasksStateTasksEntityRecognitionTasksItem, self).__init__(**kwargs) + self.results = kwargs.get('results', None) + self.last_update_date_time = kwargs['last_update_date_time'] + self.name = kwargs.get('name', None) + self.status = kwargs['status'] + + +class TasksStateTasksKeyPhraseExtractionTasksItem(TaskState, Components1D9IzucSchemasTasksstatePropertiesTasksPropertiesKeyphraseextractiontasksItemsAllof1): + """TasksStateTasksKeyPhraseExtractionTasksItem. + + All required parameters must be populated in order to send to Azure. + + :param results: + :type results: ~azure.ai.textanalytics.v3_1_preview_4.models.KeyPhraseResult + :param last_update_date_time: Required. + :type last_update_date_time: ~datetime.datetime + :param name: + :type name: str + :param status: Required. Possible values include: "notStarted", "running", "succeeded", + "failed", "rejected", "cancelled", "cancelling", "partiallyCompleted". + :type status: str or ~azure.ai.textanalytics.v3_1_preview_4.models.State + """ + + _validation = { + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'results': {'key': 'results', 'type': 'KeyPhraseResult'}, + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TasksStateTasksKeyPhraseExtractionTasksItem, self).__init__(**kwargs) + self.results = kwargs.get('results', None) + self.last_update_date_time = kwargs['last_update_date_time'] + self.name = kwargs.get('name', None) + self.status = kwargs['status'] + + +class TextAnalyticsError(msrest.serialization.Model): + """TextAnalyticsError. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. Error code. Possible values include: "InvalidRequest", + "InvalidArgument", "InternalServerError", "ServiceUnavailable", "NotFound". + :type code: str or ~azure.ai.textanalytics.v3_1_preview_4.models.ErrorCodeValue + :param message: Required. Error message. + :type message: str + :param target: Error target. + :type target: str + :param innererror: Inner error contains more specific information. + :type innererror: ~azure.ai.textanalytics.v3_1_preview_4.models.InnerError + :param details: Details about specific errors that led to this reported error. + :type details: list[~azure.ai.textanalytics.v3_1_preview_4.models.TextAnalyticsError] + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'innererror': {'key': 'innererror', 'type': 'InnerError'}, + 'details': {'key': 'details', 'type': '[TextAnalyticsError]'}, + } + + def __init__( + self, + **kwargs + ): + super(TextAnalyticsError, self).__init__(**kwargs) + self.code = kwargs['code'] + self.message = kwargs['message'] + self.target = kwargs.get('target', None) + self.innererror = kwargs.get('innererror', None) + self.details = kwargs.get('details', None) + + +class TextAnalyticsWarning(msrest.serialization.Model): + """TextAnalyticsWarning. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. Error code. Possible values include: "LongWordsInDocument", + "DocumentTruncated". + :type code: str or ~azure.ai.textanalytics.v3_1_preview_4.models.WarningCodeValue + :param message: Required. Warning message. + :type message: str + :param target_ref: A JSON pointer reference indicating the target object. + :type target_ref: str + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target_ref': {'key': 'targetRef', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TextAnalyticsWarning, self).__init__(**kwargs) + self.code = kwargs['code'] + self.message = kwargs['message'] + self.target_ref = kwargs.get('target_ref', None) diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/models/_models_py3.py b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/models/_models_py3.py new file mode 100644 index 000000000000..f3074ced5e21 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/models/_models_py3.py @@ -0,0 +1,2840 @@ +# 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. +# -------------------------------------------------------------------------- + +import datetime +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._text_analytics_client_enums import * + + +class JobManifest(msrest.serialization.Model): + """JobManifest. + + All required parameters must be populated in order to send to Azure. + + :param tasks: Required. The set of tasks to execute on the input documents. Cannot specify the + same task more than once. + :type tasks: ~azure.ai.textanalytics.v3_1_preview_4.models.JobManifestTasks + """ + + _validation = { + 'tasks': {'required': True}, + } + + _attribute_map = { + 'tasks': {'key': 'tasks', 'type': 'JobManifestTasks'}, + } + + def __init__( + self, + *, + tasks: "JobManifestTasks", + **kwargs + ): + super(JobManifest, self).__init__(**kwargs) + self.tasks = tasks + + +class JobDescriptor(msrest.serialization.Model): + """JobDescriptor. + + :param display_name: Optional display name for the analysis job. + :type display_name: str + """ + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + **kwargs + ): + super(JobDescriptor, self).__init__(**kwargs) + self.display_name = display_name + + +class AnalyzeBatchInput(JobDescriptor, JobManifest): + """AnalyzeBatchInput. + + All required parameters must be populated in order to send to Azure. + + :param tasks: Required. The set of tasks to execute on the input documents. Cannot specify the + same task more than once. + :type tasks: ~azure.ai.textanalytics.v3_1_preview_4.models.JobManifestTasks + :param display_name: Optional display name for the analysis job. + :type display_name: str + :param analysis_input: Required. Contains a set of input documents to be analyzed by the + service. + :type analysis_input: ~azure.ai.textanalytics.v3_1_preview_4.models.MultiLanguageBatchInput + """ + + _validation = { + 'tasks': {'required': True}, + 'analysis_input': {'required': True}, + } + + _attribute_map = { + 'tasks': {'key': 'tasks', 'type': 'JobManifestTasks'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'analysis_input': {'key': 'analysisInput', 'type': 'MultiLanguageBatchInput'}, + } + + def __init__( + self, + *, + tasks: "JobManifestTasks", + analysis_input: "MultiLanguageBatchInput", + display_name: Optional[str] = None, + **kwargs + ): + super(AnalyzeBatchInput, self).__init__(display_name=display_name, tasks=tasks, **kwargs) + self.tasks = tasks + self.analysis_input = analysis_input + self.display_name = display_name + self.analysis_input = analysis_input + + +class JobMetadata(msrest.serialization.Model): + """JobMetadata. + + All required parameters must be populated in order to send to Azure. + + :param created_date_time: Required. + :type created_date_time: ~datetime.datetime + :param expiration_date_time: + :type expiration_date_time: ~datetime.datetime + :param job_id: Required. + :type job_id: str + :param last_update_date_time: Required. + :type last_update_date_time: ~datetime.datetime + :param status: Required. Possible values include: "notStarted", "running", "succeeded", + "failed", "rejected", "cancelled", "cancelling", "partiallyCompleted". + :type status: str or ~azure.ai.textanalytics.v3_1_preview_4.models.State + """ + + _validation = { + 'created_date_time': {'required': True}, + 'job_id': {'required': True}, + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'created_date_time': {'key': 'createdDateTime', 'type': 'iso-8601'}, + 'expiration_date_time': {'key': 'expirationDateTime', 'type': 'iso-8601'}, + 'job_id': {'key': 'jobId', 'type': 'str'}, + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + *, + created_date_time: datetime.datetime, + job_id: str, + last_update_date_time: datetime.datetime, + status: Union[str, "State"], + expiration_date_time: Optional[datetime.datetime] = None, + **kwargs + ): + super(JobMetadata, self).__init__(**kwargs) + self.created_date_time = created_date_time + self.expiration_date_time = expiration_date_time + self.job_id = job_id + self.last_update_date_time = last_update_date_time + self.status = status + + +class AnalyzeJobMetadata(JobMetadata): + """AnalyzeJobMetadata. + + All required parameters must be populated in order to send to Azure. + + :param created_date_time: Required. + :type created_date_time: ~datetime.datetime + :param expiration_date_time: + :type expiration_date_time: ~datetime.datetime + :param job_id: Required. + :type job_id: str + :param last_update_date_time: Required. + :type last_update_date_time: ~datetime.datetime + :param status: Required. Possible values include: "notStarted", "running", "succeeded", + "failed", "rejected", "cancelled", "cancelling", "partiallyCompleted". + :type status: str or ~azure.ai.textanalytics.v3_1_preview_4.models.State + :param display_name: + :type display_name: str + """ + + _validation = { + 'created_date_time': {'required': True}, + 'job_id': {'required': True}, + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'created_date_time': {'key': 'createdDateTime', 'type': 'iso-8601'}, + 'expiration_date_time': {'key': 'expirationDateTime', 'type': 'iso-8601'}, + 'job_id': {'key': 'jobId', 'type': 'str'}, + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'status': {'key': 'status', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + } + + def __init__( + self, + *, + created_date_time: datetime.datetime, + job_id: str, + last_update_date_time: datetime.datetime, + status: Union[str, "State"], + expiration_date_time: Optional[datetime.datetime] = None, + display_name: Optional[str] = None, + **kwargs + ): + super(AnalyzeJobMetadata, self).__init__(created_date_time=created_date_time, expiration_date_time=expiration_date_time, job_id=job_id, last_update_date_time=last_update_date_time, status=status, **kwargs) + self.display_name = display_name + + +class Pagination(msrest.serialization.Model): + """Pagination. + + :param next_link: + :type next_link: str + """ + + _attribute_map = { + 'next_link': {'key': '@nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + **kwargs + ): + super(Pagination, self).__init__(**kwargs) + self.next_link = next_link + + +class TasksState(msrest.serialization.Model): + """TasksState. + + All required parameters must be populated in order to send to Azure. + + :param tasks: Required. + :type tasks: ~azure.ai.textanalytics.v3_1_preview_4.models.TasksStateTasks + """ + + _validation = { + 'tasks': {'required': True}, + } + + _attribute_map = { + 'tasks': {'key': 'tasks', 'type': 'TasksStateTasks'}, + } + + def __init__( + self, + *, + tasks: "TasksStateTasks", + **kwargs + ): + super(TasksState, self).__init__(**kwargs) + self.tasks = tasks + + +class AnalyzeJobState(AnalyzeJobMetadata, TasksState, Pagination): + """AnalyzeJobState. + + All required parameters must be populated in order to send to Azure. + + :param next_link: + :type next_link: str + :param tasks: Required. + :type tasks: ~azure.ai.textanalytics.v3_1_preview_4.models.TasksStateTasks + :param created_date_time: Required. + :type created_date_time: ~datetime.datetime + :param expiration_date_time: + :type expiration_date_time: ~datetime.datetime + :param job_id: Required. + :type job_id: str + :param last_update_date_time: Required. + :type last_update_date_time: ~datetime.datetime + :param status: Required. Possible values include: "notStarted", "running", "succeeded", + "failed", "rejected", "cancelled", "cancelling", "partiallyCompleted". + :type status: str or ~azure.ai.textanalytics.v3_1_preview_4.models.State + :param display_name: + :type display_name: str + :param errors: + :type errors: list[~azure.ai.textanalytics.v3_1_preview_4.models.TextAnalyticsError] + :param statistics: if showStats=true was specified in the request this field will contain + information about the request payload. + :type statistics: ~azure.ai.textanalytics.v3_1_preview_4.models.RequestStatistics + """ + + _validation = { + 'tasks': {'required': True}, + 'created_date_time': {'required': True}, + 'job_id': {'required': True}, + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'next_link': {'key': '@nextLink', 'type': 'str'}, + 'tasks': {'key': 'tasks', 'type': 'TasksStateTasks'}, + 'created_date_time': {'key': 'createdDateTime', 'type': 'iso-8601'}, + 'expiration_date_time': {'key': 'expirationDateTime', 'type': 'iso-8601'}, + 'job_id': {'key': 'jobId', 'type': 'str'}, + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'status': {'key': 'status', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'errors': {'key': 'errors', 'type': '[TextAnalyticsError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + } + + def __init__( + self, + *, + tasks: "TasksStateTasks", + created_date_time: datetime.datetime, + job_id: str, + last_update_date_time: datetime.datetime, + status: Union[str, "State"], + next_link: Optional[str] = None, + expiration_date_time: Optional[datetime.datetime] = None, + display_name: Optional[str] = None, + errors: Optional[List["TextAnalyticsError"]] = None, + statistics: Optional["RequestStatistics"] = None, + **kwargs + ): + super(AnalyzeJobState, self).__init__(created_date_time=created_date_time, expiration_date_time=expiration_date_time, job_id=job_id, last_update_date_time=last_update_date_time, status=status, display_name=display_name, tasks=tasks, next_link=next_link, **kwargs) + self.next_link = next_link + self.tasks = tasks + self.errors = errors + self.statistics = statistics + self.next_link = next_link + self.created_date_time = created_date_time + self.expiration_date_time = expiration_date_time + self.job_id = job_id + self.last_update_date_time = last_update_date_time + self.status = status + self.display_name = display_name + self.errors = errors + self.statistics = statistics + self.tasks = tasks + self.created_date_time = created_date_time + self.expiration_date_time = expiration_date_time + self.job_id = job_id + self.last_update_date_time = last_update_date_time + self.status = status + self.display_name = display_name + self.errors = errors + self.statistics = statistics + + +class Components15Gvwi3SchemasTasksstatePropertiesTasksPropertiesEntityrecognitiontasksItemsAllof1(msrest.serialization.Model): + """Components15Gvwi3SchemasTasksstatePropertiesTasksPropertiesEntityrecognitiontasksItemsAllof1. + + :param results: + :type results: ~azure.ai.textanalytics.v3_1_preview_4.models.EntitiesResult + """ + + _attribute_map = { + 'results': {'key': 'results', 'type': 'EntitiesResult'}, + } + + def __init__( + self, + *, + results: Optional["EntitiesResult"] = None, + **kwargs + ): + super(Components15Gvwi3SchemasTasksstatePropertiesTasksPropertiesEntityrecognitiontasksItemsAllof1, self).__init__(**kwargs) + self.results = results + + +class Components15X8E9LSchemasTasksstatePropertiesTasksPropertiesEntityrecognitionpiitasksItemsAllof1(msrest.serialization.Model): + """Components15X8E9LSchemasTasksstatePropertiesTasksPropertiesEntityrecognitionpiitasksItemsAllof1. + + :param results: + :type results: ~azure.ai.textanalytics.v3_1_preview_4.models.PiiResult + """ + + _attribute_map = { + 'results': {'key': 'results', 'type': 'PiiResult'}, + } + + def __init__( + self, + *, + results: Optional["PiiResult"] = None, + **kwargs + ): + super(Components15X8E9LSchemasTasksstatePropertiesTasksPropertiesEntityrecognitionpiitasksItemsAllof1, self).__init__(**kwargs) + self.results = results + + +class Components1D9IzucSchemasTasksstatePropertiesTasksPropertiesKeyphraseextractiontasksItemsAllof1(msrest.serialization.Model): + """Components1D9IzucSchemasTasksstatePropertiesTasksPropertiesKeyphraseextractiontasksItemsAllof1. + + :param results: + :type results: ~azure.ai.textanalytics.v3_1_preview_4.models.KeyPhraseResult + """ + + _attribute_map = { + 'results': {'key': 'results', 'type': 'KeyPhraseResult'}, + } + + def __init__( + self, + *, + results: Optional["KeyPhraseResult"] = None, + **kwargs + ): + super(Components1D9IzucSchemasTasksstatePropertiesTasksPropertiesKeyphraseextractiontasksItemsAllof1, self).__init__(**kwargs) + self.results = results + + +class ComponentsIfu7BjSchemasTasksstatePropertiesTasksPropertiesEntitylinkingtasksItemsAllof1(msrest.serialization.Model): + """ComponentsIfu7BjSchemasTasksstatePropertiesTasksPropertiesEntitylinkingtasksItemsAllof1. + + :param results: + :type results: ~azure.ai.textanalytics.v3_1_preview_4.models.EntityLinkingResult + """ + + _attribute_map = { + 'results': {'key': 'results', 'type': 'EntityLinkingResult'}, + } + + def __init__( + self, + *, + results: Optional["EntityLinkingResult"] = None, + **kwargs + ): + super(ComponentsIfu7BjSchemasTasksstatePropertiesTasksPropertiesEntitylinkingtasksItemsAllof1, self).__init__(**kwargs) + self.results = results + + +class DetectedLanguage(msrest.serialization.Model): + """DetectedLanguage. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Long name of a detected language (e.g. English, French). + :type name: str + :param iso6391_name: Required. A two letter representation of the detected language according + to the ISO 639-1 standard (e.g. en, fr). + :type iso6391_name: str + :param confidence_score: Required. A confidence score between 0 and 1. Scores close to 1 + indicate 100% certainty that the identified language is true. + :type confidence_score: float + """ + + _validation = { + 'name': {'required': True}, + 'iso6391_name': {'required': True}, + 'confidence_score': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'iso6391_name': {'key': 'iso6391Name', 'type': 'str'}, + 'confidence_score': {'key': 'confidenceScore', 'type': 'float'}, + } + + def __init__( + self, + *, + name: str, + iso6391_name: str, + confidence_score: float, + **kwargs + ): + super(DetectedLanguage, self).__init__(**kwargs) + self.name = name + self.iso6391_name = iso6391_name + self.confidence_score = confidence_score + + +class DocumentEntities(msrest.serialization.Model): + """DocumentEntities. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param entities: Required. Recognized entities in the document. + :type entities: list[~azure.ai.textanalytics.v3_1_preview_4.models.Entity] + :param warnings: Required. Warnings encountered while processing document. + :type warnings: list[~azure.ai.textanalytics.v3_1_preview_4.models.TextAnalyticsWarning] + :param statistics: if showStats=true was specified in the request this field will contain + information about the document payload. + :type statistics: ~azure.ai.textanalytics.v3_1_preview_4.models.DocumentStatistics + """ + + _validation = { + 'id': {'required': True}, + 'entities': {'required': True}, + 'warnings': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'entities': {'key': 'entities', 'type': '[Entity]'}, + 'warnings': {'key': 'warnings', 'type': '[TextAnalyticsWarning]'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + } + + def __init__( + self, + *, + id: str, + entities: List["Entity"], + warnings: List["TextAnalyticsWarning"], + statistics: Optional["DocumentStatistics"] = None, + **kwargs + ): + super(DocumentEntities, self).__init__(**kwargs) + self.id = id + self.entities = entities + self.warnings = warnings + self.statistics = statistics + + +class DocumentError(msrest.serialization.Model): + """DocumentError. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Document Id. + :type id: str + :param error: Required. Document Error. + :type error: ~azure.ai.textanalytics.v3_1_preview_4.models.TextAnalyticsError + """ + + _validation = { + 'id': {'required': True}, + 'error': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'TextAnalyticsError'}, + } + + def __init__( + self, + *, + id: str, + error: "TextAnalyticsError", + **kwargs + ): + super(DocumentError, self).__init__(**kwargs) + self.id = id + self.error = error + + +class DocumentHealthcareEntities(msrest.serialization.Model): + """DocumentHealthcareEntities. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param entities: Required. Healthcare entities. + :type entities: list[~azure.ai.textanalytics.v3_1_preview_4.models.HealthcareEntity] + :param relations: Required. Healthcare entity relations. + :type relations: list[~azure.ai.textanalytics.v3_1_preview_4.models.HealthcareRelation] + :param warnings: Required. Warnings encountered while processing document. + :type warnings: list[~azure.ai.textanalytics.v3_1_preview_4.models.TextAnalyticsWarning] + :param statistics: if showStats=true was specified in the request this field will contain + information about the document payload. + :type statistics: ~azure.ai.textanalytics.v3_1_preview_4.models.DocumentStatistics + """ + + _validation = { + 'id': {'required': True}, + 'entities': {'required': True}, + 'relations': {'required': True}, + 'warnings': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'entities': {'key': 'entities', 'type': '[HealthcareEntity]'}, + 'relations': {'key': 'relations', 'type': '[HealthcareRelation]'}, + 'warnings': {'key': 'warnings', 'type': '[TextAnalyticsWarning]'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + } + + def __init__( + self, + *, + id: str, + entities: List["HealthcareEntity"], + relations: List["HealthcareRelation"], + warnings: List["TextAnalyticsWarning"], + statistics: Optional["DocumentStatistics"] = None, + **kwargs + ): + super(DocumentHealthcareEntities, self).__init__(**kwargs) + self.id = id + self.entities = entities + self.relations = relations + self.warnings = warnings + self.statistics = statistics + + +class DocumentKeyPhrases(msrest.serialization.Model): + """DocumentKeyPhrases. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param key_phrases: Required. A list of representative words or phrases. The number of key + phrases returned is proportional to the number of words in the input document. + :type key_phrases: list[str] + :param warnings: Required. Warnings encountered while processing document. + :type warnings: list[~azure.ai.textanalytics.v3_1_preview_4.models.TextAnalyticsWarning] + :param statistics: if showStats=true was specified in the request this field will contain + information about the document payload. + :type statistics: ~azure.ai.textanalytics.v3_1_preview_4.models.DocumentStatistics + """ + + _validation = { + 'id': {'required': True}, + 'key_phrases': {'required': True}, + 'warnings': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'key_phrases': {'key': 'keyPhrases', 'type': '[str]'}, + 'warnings': {'key': 'warnings', 'type': '[TextAnalyticsWarning]'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + } + + def __init__( + self, + *, + id: str, + key_phrases: List[str], + warnings: List["TextAnalyticsWarning"], + statistics: Optional["DocumentStatistics"] = None, + **kwargs + ): + super(DocumentKeyPhrases, self).__init__(**kwargs) + self.id = id + self.key_phrases = key_phrases + self.warnings = warnings + self.statistics = statistics + + +class DocumentLanguage(msrest.serialization.Model): + """DocumentLanguage. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param detected_language: Required. Detected Language. + :type detected_language: ~azure.ai.textanalytics.v3_1_preview_4.models.DetectedLanguage + :param warnings: Required. Warnings encountered while processing document. + :type warnings: list[~azure.ai.textanalytics.v3_1_preview_4.models.TextAnalyticsWarning] + :param statistics: if showStats=true was specified in the request this field will contain + information about the document payload. + :type statistics: ~azure.ai.textanalytics.v3_1_preview_4.models.DocumentStatistics + """ + + _validation = { + 'id': {'required': True}, + 'detected_language': {'required': True}, + 'warnings': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'detected_language': {'key': 'detectedLanguage', 'type': 'DetectedLanguage'}, + 'warnings': {'key': 'warnings', 'type': '[TextAnalyticsWarning]'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + } + + def __init__( + self, + *, + id: str, + detected_language: "DetectedLanguage", + warnings: List["TextAnalyticsWarning"], + statistics: Optional["DocumentStatistics"] = None, + **kwargs + ): + super(DocumentLanguage, self).__init__(**kwargs) + self.id = id + self.detected_language = detected_language + self.warnings = warnings + self.statistics = statistics + + +class DocumentLinkedEntities(msrest.serialization.Model): + """DocumentLinkedEntities. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param entities: Required. Recognized well known entities in the document. + :type entities: list[~azure.ai.textanalytics.v3_1_preview_4.models.LinkedEntity] + :param warnings: Required. Warnings encountered while processing document. + :type warnings: list[~azure.ai.textanalytics.v3_1_preview_4.models.TextAnalyticsWarning] + :param statistics: if showStats=true was specified in the request this field will contain + information about the document payload. + :type statistics: ~azure.ai.textanalytics.v3_1_preview_4.models.DocumentStatistics + """ + + _validation = { + 'id': {'required': True}, + 'entities': {'required': True}, + 'warnings': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'entities': {'key': 'entities', 'type': '[LinkedEntity]'}, + 'warnings': {'key': 'warnings', 'type': '[TextAnalyticsWarning]'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + } + + def __init__( + self, + *, + id: str, + entities: List["LinkedEntity"], + warnings: List["TextAnalyticsWarning"], + statistics: Optional["DocumentStatistics"] = None, + **kwargs + ): + super(DocumentLinkedEntities, self).__init__(**kwargs) + self.id = id + self.entities = entities + self.warnings = warnings + self.statistics = statistics + + +class DocumentSentiment(msrest.serialization.Model): + """DocumentSentiment. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param sentiment: Required. Predicted sentiment for document (Negative, Neutral, Positive, or + Mixed). Possible values include: "positive", "neutral", "negative", "mixed". + :type sentiment: str or ~azure.ai.textanalytics.v3_1_preview_4.models.DocumentSentimentValue + :param statistics: if showStats=true was specified in the request this field will contain + information about the document payload. + :type statistics: ~azure.ai.textanalytics.v3_1_preview_4.models.DocumentStatistics + :param confidence_scores: Required. Document level sentiment confidence scores between 0 and 1 + for each sentiment class. + :type confidence_scores: + ~azure.ai.textanalytics.v3_1_preview_4.models.SentimentConfidenceScorePerLabel + :param sentences: Required. Sentence level sentiment analysis. + :type sentences: list[~azure.ai.textanalytics.v3_1_preview_4.models.SentenceSentiment] + :param warnings: Required. Warnings encountered while processing document. + :type warnings: list[~azure.ai.textanalytics.v3_1_preview_4.models.TextAnalyticsWarning] + """ + + _validation = { + 'id': {'required': True}, + 'sentiment': {'required': True}, + 'confidence_scores': {'required': True}, + 'sentences': {'required': True}, + 'warnings': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'sentiment': {'key': 'sentiment', 'type': 'str'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + 'confidence_scores': {'key': 'confidenceScores', 'type': 'SentimentConfidenceScorePerLabel'}, + 'sentences': {'key': 'sentences', 'type': '[SentenceSentiment]'}, + 'warnings': {'key': 'warnings', 'type': '[TextAnalyticsWarning]'}, + } + + def __init__( + self, + *, + id: str, + sentiment: Union[str, "DocumentSentimentValue"], + confidence_scores: "SentimentConfidenceScorePerLabel", + sentences: List["SentenceSentiment"], + warnings: List["TextAnalyticsWarning"], + statistics: Optional["DocumentStatistics"] = None, + **kwargs + ): + super(DocumentSentiment, self).__init__(**kwargs) + self.id = id + self.sentiment = sentiment + self.statistics = statistics + self.confidence_scores = confidence_scores + self.sentences = sentences + self.warnings = warnings + + +class DocumentStatistics(msrest.serialization.Model): + """if showStats=true was specified in the request this field will contain information about the document payload. + + All required parameters must be populated in order to send to Azure. + + :param characters_count: Required. Number of text elements recognized in the document. + :type characters_count: int + :param transactions_count: Required. Number of transactions for the document. + :type transactions_count: int + """ + + _validation = { + 'characters_count': {'required': True}, + 'transactions_count': {'required': True}, + } + + _attribute_map = { + 'characters_count': {'key': 'charactersCount', 'type': 'int'}, + 'transactions_count': {'key': 'transactionsCount', 'type': 'int'}, + } + + def __init__( + self, + *, + characters_count: int, + transactions_count: int, + **kwargs + ): + super(DocumentStatistics, self).__init__(**kwargs) + self.characters_count = characters_count + self.transactions_count = transactions_count + + +class EntitiesResult(msrest.serialization.Model): + """EntitiesResult. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. Response by document. + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.DocumentEntities] + :param errors: Required. Errors by document id. + :type errors: list[~azure.ai.textanalytics.v3_1_preview_4.models.DocumentError] + :param statistics: if showStats=true was specified in the request this field will contain + information about the request payload. + :type statistics: ~azure.ai.textanalytics.v3_1_preview_4.models.RequestStatistics + :param model_version: Required. This field indicates which model is used for scoring. + :type model_version: str + """ + + _validation = { + 'documents': {'required': True}, + 'errors': {'required': True}, + 'model_version': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[DocumentEntities]'}, + 'errors': {'key': 'errors', 'type': '[DocumentError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + 'model_version': {'key': 'modelVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + documents: List["DocumentEntities"], + errors: List["DocumentError"], + model_version: str, + statistics: Optional["RequestStatistics"] = None, + **kwargs + ): + super(EntitiesResult, self).__init__(**kwargs) + self.documents = documents + self.errors = errors + self.statistics = statistics + self.model_version = model_version + + +class EntitiesTask(msrest.serialization.Model): + """EntitiesTask. + + :param parameters: + :type parameters: ~azure.ai.textanalytics.v3_1_preview_4.models.EntitiesTaskParameters + """ + + _attribute_map = { + 'parameters': {'key': 'parameters', 'type': 'EntitiesTaskParameters'}, + } + + def __init__( + self, + *, + parameters: Optional["EntitiesTaskParameters"] = None, + **kwargs + ): + super(EntitiesTask, self).__init__(**kwargs) + self.parameters = parameters + + +class EntitiesTaskParameters(msrest.serialization.Model): + """EntitiesTaskParameters. + + :param model_version: + :type model_version: str + :param string_index_type: Possible values include: "TextElements_v8", "UnicodeCodePoint", + "Utf16CodeUnit". Default value: "TextElements_v8". + :type string_index_type: str or + ~azure.ai.textanalytics.v3_1_preview_4.models.StringIndexTypeResponse + """ + + _attribute_map = { + 'model_version': {'key': 'model-version', 'type': 'str'}, + 'string_index_type': {'key': 'stringIndexType', 'type': 'str'}, + } + + def __init__( + self, + *, + model_version: Optional[str] = "latest", + string_index_type: Optional[Union[str, "StringIndexTypeResponse"]] = "TextElements_v8", + **kwargs + ): + super(EntitiesTaskParameters, self).__init__(**kwargs) + self.model_version = model_version + self.string_index_type = string_index_type + + +class Entity(msrest.serialization.Model): + """Entity. + + All required parameters must be populated in order to send to Azure. + + :param text: Required. Entity text as appears in the request. + :type text: str + :param category: Required. Entity type. + :type category: str + :param subcategory: (Optional) Entity sub type. + :type subcategory: str + :param offset: Required. Start position for the entity text. Use of different 'stringIndexType' + values can affect the offset returned. + :type offset: int + :param length: Required. Length for the entity text. Use of different 'stringIndexType' values + can affect the length returned. + :type length: int + :param confidence_score: Required. Confidence score between 0 and 1 of the extracted entity. + :type confidence_score: float + """ + + _validation = { + 'text': {'required': True}, + 'category': {'required': True}, + 'offset': {'required': True}, + 'length': {'required': True}, + 'confidence_score': {'required': True}, + } + + _attribute_map = { + 'text': {'key': 'text', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'subcategory': {'key': 'subcategory', 'type': 'str'}, + 'offset': {'key': 'offset', 'type': 'int'}, + 'length': {'key': 'length', 'type': 'int'}, + 'confidence_score': {'key': 'confidenceScore', 'type': 'float'}, + } + + def __init__( + self, + *, + text: str, + category: str, + offset: int, + length: int, + confidence_score: float, + subcategory: Optional[str] = None, + **kwargs + ): + super(Entity, self).__init__(**kwargs) + self.text = text + self.category = category + self.subcategory = subcategory + self.offset = offset + self.length = length + self.confidence_score = confidence_score + + +class EntityLinkingResult(msrest.serialization.Model): + """EntityLinkingResult. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. Response by document. + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.DocumentLinkedEntities] + :param errors: Required. Errors by document id. + :type errors: list[~azure.ai.textanalytics.v3_1_preview_4.models.DocumentError] + :param statistics: if showStats=true was specified in the request this field will contain + information about the request payload. + :type statistics: ~azure.ai.textanalytics.v3_1_preview_4.models.RequestStatistics + :param model_version: Required. This field indicates which model is used for scoring. + :type model_version: str + """ + + _validation = { + 'documents': {'required': True}, + 'errors': {'required': True}, + 'model_version': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[DocumentLinkedEntities]'}, + 'errors': {'key': 'errors', 'type': '[DocumentError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + 'model_version': {'key': 'modelVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + documents: List["DocumentLinkedEntities"], + errors: List["DocumentError"], + model_version: str, + statistics: Optional["RequestStatistics"] = None, + **kwargs + ): + super(EntityLinkingResult, self).__init__(**kwargs) + self.documents = documents + self.errors = errors + self.statistics = statistics + self.model_version = model_version + + +class EntityLinkingTask(msrest.serialization.Model): + """EntityLinkingTask. + + :param parameters: + :type parameters: ~azure.ai.textanalytics.v3_1_preview_4.models.EntityLinkingTaskParameters + """ + + _attribute_map = { + 'parameters': {'key': 'parameters', 'type': 'EntityLinkingTaskParameters'}, + } + + def __init__( + self, + *, + parameters: Optional["EntityLinkingTaskParameters"] = None, + **kwargs + ): + super(EntityLinkingTask, self).__init__(**kwargs) + self.parameters = parameters + + +class EntityLinkingTaskParameters(msrest.serialization.Model): + """EntityLinkingTaskParameters. + + :param model_version: + :type model_version: str + :param string_index_type: Possible values include: "TextElements_v8", "UnicodeCodePoint", + "Utf16CodeUnit". Default value: "TextElements_v8". + :type string_index_type: str or + ~azure.ai.textanalytics.v3_1_preview_4.models.StringIndexTypeResponse + """ + + _attribute_map = { + 'model_version': {'key': 'model-version', 'type': 'str'}, + 'string_index_type': {'key': 'stringIndexType', 'type': 'str'}, + } + + def __init__( + self, + *, + model_version: Optional[str] = "latest", + string_index_type: Optional[Union[str, "StringIndexTypeResponse"]] = "TextElements_v8", + **kwargs + ): + super(EntityLinkingTaskParameters, self).__init__(**kwargs) + self.model_version = model_version + self.string_index_type = string_index_type + + +class ErrorResponse(msrest.serialization.Model): + """ErrorResponse. + + All required parameters must be populated in order to send to Azure. + + :param error: Required. Document Error. + :type error: ~azure.ai.textanalytics.v3_1_preview_4.models.TextAnalyticsError + """ + + _validation = { + 'error': {'required': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'TextAnalyticsError'}, + } + + def __init__( + self, + *, + error: "TextAnalyticsError", + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class HealthcareAssertion(msrest.serialization.Model): + """HealthcareAssertion. + + :param conditionality: Describes any conditionality on the entity. Possible values include: + "Hypothetical", "Conditional". + :type conditionality: str or ~azure.ai.textanalytics.v3_1_preview_4.models.Conditionality + :param certainty: Describes the entities certainty and polarity. Possible values include: + "Positive", "Positive Possible", "Neutral Possible", "Negative Possible", "Negative". + :type certainty: str or ~azure.ai.textanalytics.v3_1_preview_4.models.Certainty + :param association: Describes if the entity is the subject of the text or if it describes + someone else. Possible values include: "subject", "other". + :type association: str or ~azure.ai.textanalytics.v3_1_preview_4.models.Association + """ + + _attribute_map = { + 'conditionality': {'key': 'conditionality', 'type': 'str'}, + 'certainty': {'key': 'certainty', 'type': 'str'}, + 'association': {'key': 'association', 'type': 'str'}, + } + + def __init__( + self, + *, + conditionality: Optional[Union[str, "Conditionality"]] = None, + certainty: Optional[Union[str, "Certainty"]] = None, + association: Optional[Union[str, "Association"]] = None, + **kwargs + ): + super(HealthcareAssertion, self).__init__(**kwargs) + self.conditionality = conditionality + self.certainty = certainty + self.association = association + + +class HealthcareEntity(Entity): + """HealthcareEntity. + + All required parameters must be populated in order to send to Azure. + + :param text: Required. Entity text as appears in the request. + :type text: str + :param category: Required. Entity type. + :type category: str + :param subcategory: (Optional) Entity sub type. + :type subcategory: str + :param offset: Required. Start position for the entity text. Use of different 'stringIndexType' + values can affect the offset returned. + :type offset: int + :param length: Required. Length for the entity text. Use of different 'stringIndexType' values + can affect the length returned. + :type length: int + :param confidence_score: Required. Confidence score between 0 and 1 of the extracted entity. + :type confidence_score: float + :param assertion: + :type assertion: ~azure.ai.textanalytics.v3_1_preview_4.models.HealthcareAssertion + :param name: Preferred name for the entity. Example: 'histologically' would have a 'name' of + 'histologic'. + :type name: str + :param links: Entity references in known data sources. + :type links: list[~azure.ai.textanalytics.v3_1_preview_4.models.HealthcareEntityLink] + """ + + _validation = { + 'text': {'required': True}, + 'category': {'required': True}, + 'offset': {'required': True}, + 'length': {'required': True}, + 'confidence_score': {'required': True}, + } + + _attribute_map = { + 'text': {'key': 'text', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'subcategory': {'key': 'subcategory', 'type': 'str'}, + 'offset': {'key': 'offset', 'type': 'int'}, + 'length': {'key': 'length', 'type': 'int'}, + 'confidence_score': {'key': 'confidenceScore', 'type': 'float'}, + 'assertion': {'key': 'assertion', 'type': 'HealthcareAssertion'}, + 'name': {'key': 'name', 'type': 'str'}, + 'links': {'key': 'links', 'type': '[HealthcareEntityLink]'}, + } + + def __init__( + self, + *, + text: str, + category: str, + offset: int, + length: int, + confidence_score: float, + subcategory: Optional[str] = None, + assertion: Optional["HealthcareAssertion"] = None, + name: Optional[str] = None, + links: Optional[List["HealthcareEntityLink"]] = None, + **kwargs + ): + super(HealthcareEntity, self).__init__(text=text, category=category, subcategory=subcategory, offset=offset, length=length, confidence_score=confidence_score, **kwargs) + self.assertion = assertion + self.name = name + self.links = links + + +class HealthcareEntityLink(msrest.serialization.Model): + """HealthcareEntityLink. + + All required parameters must be populated in order to send to Azure. + + :param data_source: Required. Entity Catalog. Examples include: UMLS, CHV, MSH, etc. + :type data_source: str + :param id: Required. Entity id in the given source catalog. + :type id: str + """ + + _validation = { + 'data_source': {'required': True}, + 'id': {'required': True}, + } + + _attribute_map = { + 'data_source': {'key': 'dataSource', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + data_source: str, + id: str, + **kwargs + ): + super(HealthcareEntityLink, self).__init__(**kwargs) + self.data_source = data_source + self.id = id + + +class HealthcareJobState(JobMetadata, Pagination): + """HealthcareJobState. + + All required parameters must be populated in order to send to Azure. + + :param next_link: + :type next_link: str + :param created_date_time: Required. + :type created_date_time: ~datetime.datetime + :param expiration_date_time: + :type expiration_date_time: ~datetime.datetime + :param job_id: Required. + :type job_id: str + :param last_update_date_time: Required. + :type last_update_date_time: ~datetime.datetime + :param status: Required. Possible values include: "notStarted", "running", "succeeded", + "failed", "rejected", "cancelled", "cancelling", "partiallyCompleted". + :type status: str or ~azure.ai.textanalytics.v3_1_preview_4.models.State + :param results: + :type results: ~azure.ai.textanalytics.v3_1_preview_4.models.HealthcareResult + :param errors: + :type errors: list[~azure.ai.textanalytics.v3_1_preview_4.models.TextAnalyticsError] + """ + + _validation = { + 'created_date_time': {'required': True}, + 'job_id': {'required': True}, + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'next_link': {'key': '@nextLink', 'type': 'str'}, + 'created_date_time': {'key': 'createdDateTime', 'type': 'iso-8601'}, + 'expiration_date_time': {'key': 'expirationDateTime', 'type': 'iso-8601'}, + 'job_id': {'key': 'jobId', 'type': 'str'}, + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'status': {'key': 'status', 'type': 'str'}, + 'results': {'key': 'results', 'type': 'HealthcareResult'}, + 'errors': {'key': 'errors', 'type': '[TextAnalyticsError]'}, + } + + def __init__( + self, + *, + created_date_time: datetime.datetime, + job_id: str, + last_update_date_time: datetime.datetime, + status: Union[str, "State"], + next_link: Optional[str] = None, + expiration_date_time: Optional[datetime.datetime] = None, + results: Optional["HealthcareResult"] = None, + errors: Optional[List["TextAnalyticsError"]] = None, + **kwargs + ): + super(HealthcareJobState, self).__init__(created_date_time=created_date_time, expiration_date_time=expiration_date_time, job_id=job_id, last_update_date_time=last_update_date_time, status=status, next_link=next_link, **kwargs) + self.next_link = next_link + self.results = results + self.errors = errors + self.created_date_time = created_date_time + self.expiration_date_time = expiration_date_time + self.job_id = job_id + self.last_update_date_time = last_update_date_time + self.status = status + self.results = results + self.errors = errors + + +class HealthcareRelation(msrest.serialization.Model): + """Every relation is an entity graph of a certain relationType, where all entities are connected and have specific roles within the relation context. + + All required parameters must be populated in order to send to Azure. + + :param relation_type: Required. Type of relation. Examples include: ``DosageOfMedication`` or + 'FrequencyOfMedication', etc. Possible values include: "Abbreviation", + "DirectionOfBodyStructure", "DirectionOfCondition", "DirectionOfExamination", + "DirectionOfTreatment", "DosageOfMedication", "FormOfMedication", "FrequencyOfMedication", + "FrequencyOfTreatment", "QualifierOfCondition", "RelationOfExamination", "RouteOfMedication", + "TimeOfCondition", "TimeOfEvent", "TimeOfExamination", "TimeOfMedication", "TimeOfTreatment", + "UnitOfCondition", "UnitOfExamination", "ValueOfCondition", "ValueOfExamination". + :type relation_type: str or ~azure.ai.textanalytics.v3_1_preview_4.models.RelationType + :param entities: Required. The entities in the relation. + :type entities: list[~azure.ai.textanalytics.v3_1_preview_4.models.HealthcareRelationEntity] + """ + + _validation = { + 'relation_type': {'required': True}, + 'entities': {'required': True}, + } + + _attribute_map = { + 'relation_type': {'key': 'relationType', 'type': 'str'}, + 'entities': {'key': 'entities', 'type': '[HealthcareRelationEntity]'}, + } + + def __init__( + self, + *, + relation_type: Union[str, "RelationType"], + entities: List["HealthcareRelationEntity"], + **kwargs + ): + super(HealthcareRelation, self).__init__(**kwargs) + self.relation_type = relation_type + self.entities = entities + + +class HealthcareRelationEntity(msrest.serialization.Model): + """HealthcareRelationEntity. + + All required parameters must be populated in order to send to Azure. + + :param ref: Required. Reference link object, using a JSON pointer RFC 6901 (URI Fragment + Identifier Representation), pointing to the entity . + :type ref: str + :param role: Required. Role of entity in the relationship. For example: 'CD20-positive diffuse + large B-cell lymphoma' has the following entities with their roles in parenthesis: CD20 + (GeneOrProtein), Positive (Expression), diffuse large B-cell lymphoma (Diagnosis). + :type role: str + """ + + _validation = { + 'ref': {'required': True}, + 'role': {'required': True}, + } + + _attribute_map = { + 'ref': {'key': 'ref', 'type': 'str'}, + 'role': {'key': 'role', 'type': 'str'}, + } + + def __init__( + self, + *, + ref: str, + role: str, + **kwargs + ): + super(HealthcareRelationEntity, self).__init__(**kwargs) + self.ref = ref + self.role = role + + +class HealthcareResult(msrest.serialization.Model): + """HealthcareResult. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. Response by document. + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.DocumentHealthcareEntities] + :param errors: Required. Errors by document id. + :type errors: list[~azure.ai.textanalytics.v3_1_preview_4.models.DocumentError] + :param statistics: if showStats=true was specified in the request this field will contain + information about the request payload. + :type statistics: ~azure.ai.textanalytics.v3_1_preview_4.models.RequestStatistics + :param model_version: Required. This field indicates which model is used for scoring. + :type model_version: str + """ + + _validation = { + 'documents': {'required': True}, + 'errors': {'required': True}, + 'model_version': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[DocumentHealthcareEntities]'}, + 'errors': {'key': 'errors', 'type': '[DocumentError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + 'model_version': {'key': 'modelVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + documents: List["DocumentHealthcareEntities"], + errors: List["DocumentError"], + model_version: str, + statistics: Optional["RequestStatistics"] = None, + **kwargs + ): + super(HealthcareResult, self).__init__(**kwargs) + self.documents = documents + self.errors = errors + self.statistics = statistics + self.model_version = model_version + + +class InnerError(msrest.serialization.Model): + """InnerError. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. Error code. Possible values include: "InvalidParameterValue", + "InvalidRequestBodyFormat", "EmptyRequest", "MissingInputRecords", "InvalidDocument", + "ModelVersionIncorrect", "InvalidDocumentBatch", "UnsupportedLanguageCode", + "InvalidCountryHint". + :type code: str or ~azure.ai.textanalytics.v3_1_preview_4.models.InnerErrorCodeValue + :param message: Required. Error message. + :type message: str + :param details: Error details. + :type details: dict[str, str] + :param target: Error target. + :type target: str + :param innererror: Inner error contains more specific information. + :type innererror: ~azure.ai.textanalytics.v3_1_preview_4.models.InnerError + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': '{str}'}, + 'target': {'key': 'target', 'type': 'str'}, + 'innererror': {'key': 'innererror', 'type': 'InnerError'}, + } + + def __init__( + self, + *, + code: Union[str, "InnerErrorCodeValue"], + message: str, + details: Optional[Dict[str, str]] = None, + target: Optional[str] = None, + innererror: Optional["InnerError"] = None, + **kwargs + ): + super(InnerError, self).__init__(**kwargs) + self.code = code + self.message = message + self.details = details + self.target = target + self.innererror = innererror + + +class JobManifestTasks(msrest.serialization.Model): + """The set of tasks to execute on the input documents. Cannot specify the same task more than once. + + :param entity_recognition_tasks: + :type entity_recognition_tasks: + list[~azure.ai.textanalytics.v3_1_preview_4.models.EntitiesTask] + :param entity_recognition_pii_tasks: + :type entity_recognition_pii_tasks: list[~azure.ai.textanalytics.v3_1_preview_4.models.PiiTask] + :param key_phrase_extraction_tasks: + :type key_phrase_extraction_tasks: + list[~azure.ai.textanalytics.v3_1_preview_4.models.KeyPhrasesTask] + :param entity_linking_tasks: + :type entity_linking_tasks: + list[~azure.ai.textanalytics.v3_1_preview_4.models.EntityLinkingTask] + """ + + _attribute_map = { + 'entity_recognition_tasks': {'key': 'entityRecognitionTasks', 'type': '[EntitiesTask]'}, + 'entity_recognition_pii_tasks': {'key': 'entityRecognitionPiiTasks', 'type': '[PiiTask]'}, + 'key_phrase_extraction_tasks': {'key': 'keyPhraseExtractionTasks', 'type': '[KeyPhrasesTask]'}, + 'entity_linking_tasks': {'key': 'entityLinkingTasks', 'type': '[EntityLinkingTask]'}, + } + + def __init__( + self, + *, + entity_recognition_tasks: Optional[List["EntitiesTask"]] = None, + entity_recognition_pii_tasks: Optional[List["PiiTask"]] = None, + key_phrase_extraction_tasks: Optional[List["KeyPhrasesTask"]] = None, + entity_linking_tasks: Optional[List["EntityLinkingTask"]] = None, + **kwargs + ): + super(JobManifestTasks, self).__init__(**kwargs) + self.entity_recognition_tasks = entity_recognition_tasks + self.entity_recognition_pii_tasks = entity_recognition_pii_tasks + self.key_phrase_extraction_tasks = key_phrase_extraction_tasks + self.entity_linking_tasks = entity_linking_tasks + + +class KeyPhraseResult(msrest.serialization.Model): + """KeyPhraseResult. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. Response by document. + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.DocumentKeyPhrases] + :param errors: Required. Errors by document id. + :type errors: list[~azure.ai.textanalytics.v3_1_preview_4.models.DocumentError] + :param statistics: if showStats=true was specified in the request this field will contain + information about the request payload. + :type statistics: ~azure.ai.textanalytics.v3_1_preview_4.models.RequestStatistics + :param model_version: Required. This field indicates which model is used for scoring. + :type model_version: str + """ + + _validation = { + 'documents': {'required': True}, + 'errors': {'required': True}, + 'model_version': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[DocumentKeyPhrases]'}, + 'errors': {'key': 'errors', 'type': '[DocumentError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + 'model_version': {'key': 'modelVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + documents: List["DocumentKeyPhrases"], + errors: List["DocumentError"], + model_version: str, + statistics: Optional["RequestStatistics"] = None, + **kwargs + ): + super(KeyPhraseResult, self).__init__(**kwargs) + self.documents = documents + self.errors = errors + self.statistics = statistics + self.model_version = model_version + + +class KeyPhrasesTask(msrest.serialization.Model): + """KeyPhrasesTask. + + :param parameters: + :type parameters: ~azure.ai.textanalytics.v3_1_preview_4.models.KeyPhrasesTaskParameters + """ + + _attribute_map = { + 'parameters': {'key': 'parameters', 'type': 'KeyPhrasesTaskParameters'}, + } + + def __init__( + self, + *, + parameters: Optional["KeyPhrasesTaskParameters"] = None, + **kwargs + ): + super(KeyPhrasesTask, self).__init__(**kwargs) + self.parameters = parameters + + +class KeyPhrasesTaskParameters(msrest.serialization.Model): + """KeyPhrasesTaskParameters. + + :param model_version: + :type model_version: str + """ + + _attribute_map = { + 'model_version': {'key': 'model-version', 'type': 'str'}, + } + + def __init__( + self, + *, + model_version: Optional[str] = "latest", + **kwargs + ): + super(KeyPhrasesTaskParameters, self).__init__(**kwargs) + self.model_version = model_version + + +class LanguageBatchInput(msrest.serialization.Model): + """LanguageBatchInput. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.LanguageInput] + """ + + _validation = { + 'documents': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[LanguageInput]'}, + } + + def __init__( + self, + *, + documents: List["LanguageInput"], + **kwargs + ): + super(LanguageBatchInput, self).__init__(**kwargs) + self.documents = documents + + +class LanguageInput(msrest.serialization.Model): + """LanguageInput. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param text: Required. + :type text: str + :param country_hint: + :type country_hint: str + """ + + _validation = { + 'id': {'required': True}, + 'text': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'text': {'key': 'text', 'type': 'str'}, + 'country_hint': {'key': 'countryHint', 'type': 'str'}, + } + + def __init__( + self, + *, + id: str, + text: str, + country_hint: Optional[str] = None, + **kwargs + ): + super(LanguageInput, self).__init__(**kwargs) + self.id = id + self.text = text + self.country_hint = country_hint + + +class LanguageResult(msrest.serialization.Model): + """LanguageResult. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. Response by document. + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.DocumentLanguage] + :param errors: Required. Errors by document id. + :type errors: list[~azure.ai.textanalytics.v3_1_preview_4.models.DocumentError] + :param statistics: if showStats=true was specified in the request this field will contain + information about the request payload. + :type statistics: ~azure.ai.textanalytics.v3_1_preview_4.models.RequestStatistics + :param model_version: Required. This field indicates which model is used for scoring. + :type model_version: str + """ + + _validation = { + 'documents': {'required': True}, + 'errors': {'required': True}, + 'model_version': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[DocumentLanguage]'}, + 'errors': {'key': 'errors', 'type': '[DocumentError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + 'model_version': {'key': 'modelVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + documents: List["DocumentLanguage"], + errors: List["DocumentError"], + model_version: str, + statistics: Optional["RequestStatistics"] = None, + **kwargs + ): + super(LanguageResult, self).__init__(**kwargs) + self.documents = documents + self.errors = errors + self.statistics = statistics + self.model_version = model_version + + +class LinkedEntity(msrest.serialization.Model): + """LinkedEntity. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Entity Linking formal name. + :type name: str + :param matches: Required. List of instances this entity appears in the text. + :type matches: list[~azure.ai.textanalytics.v3_1_preview_4.models.Match] + :param language: Required. Language used in the data source. + :type language: str + :param id: Unique identifier of the recognized entity from the data source. + :type id: str + :param url: Required. URL for the entity's page from the data source. + :type url: str + :param data_source: Required. Data source used to extract entity linking, such as Wiki/Bing + etc. + :type data_source: str + :param bing_id: Bing Entity Search API unique identifier of the recognized entity. + :type bing_id: str + """ + + _validation = { + 'name': {'required': True}, + 'matches': {'required': True}, + 'language': {'required': True}, + 'url': {'required': True}, + 'data_source': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'matches': {'key': 'matches', 'type': '[Match]'}, + 'language': {'key': 'language', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'data_source': {'key': 'dataSource', 'type': 'str'}, + 'bing_id': {'key': 'bingId', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + matches: List["Match"], + language: str, + url: str, + data_source: str, + id: Optional[str] = None, + bing_id: Optional[str] = None, + **kwargs + ): + super(LinkedEntity, self).__init__(**kwargs) + self.name = name + self.matches = matches + self.language = language + self.id = id + self.url = url + self.data_source = data_source + self.bing_id = bing_id + + +class Match(msrest.serialization.Model): + """Match. + + All required parameters must be populated in order to send to Azure. + + :param confidence_score: Required. If a well known item is recognized, a decimal number + denoting the confidence level between 0 and 1 will be returned. + :type confidence_score: float + :param text: Required. Entity text as appears in the request. + :type text: str + :param offset: Required. Start position for the entity match text. + :type offset: int + :param length: Required. Length for the entity match text. + :type length: int + """ + + _validation = { + 'confidence_score': {'required': True}, + 'text': {'required': True}, + 'offset': {'required': True}, + 'length': {'required': True}, + } + + _attribute_map = { + 'confidence_score': {'key': 'confidenceScore', 'type': 'float'}, + 'text': {'key': 'text', 'type': 'str'}, + 'offset': {'key': 'offset', 'type': 'int'}, + 'length': {'key': 'length', 'type': 'int'}, + } + + def __init__( + self, + *, + confidence_score: float, + text: str, + offset: int, + length: int, + **kwargs + ): + super(Match, self).__init__(**kwargs) + self.confidence_score = confidence_score + self.text = text + self.offset = offset + self.length = length + + +class MultiLanguageBatchInput(msrest.serialization.Model): + """Contains a set of input documents to be analyzed by the service. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. The set of documents to process as part of this batch. + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.MultiLanguageInput] + """ + + _validation = { + 'documents': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[MultiLanguageInput]'}, + } + + def __init__( + self, + *, + documents: List["MultiLanguageInput"], + **kwargs + ): + super(MultiLanguageBatchInput, self).__init__(**kwargs) + self.documents = documents + + +class MultiLanguageInput(msrest.serialization.Model): + """Contains an input document to be analyzed by the service. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. A unique, non-empty document identifier. + :type id: str + :param text: Required. The input text to process. + :type text: str + :param language: (Optional) This is the 2 letter ISO 639-1 representation of a language. For + example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as + default. + :type language: str + """ + + _validation = { + 'id': {'required': True}, + 'text': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'text': {'key': 'text', 'type': 'str'}, + 'language': {'key': 'language', 'type': 'str'}, + } + + def __init__( + self, + *, + id: str, + text: str, + language: Optional[str] = None, + **kwargs + ): + super(MultiLanguageInput, self).__init__(**kwargs) + self.id = id + self.text = text + self.language = language + + +class PiiDocumentEntities(msrest.serialization.Model): + """PiiDocumentEntities. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param redacted_text: Required. Returns redacted text. + :type redacted_text: str + :param entities: Required. Recognized entities in the document. + :type entities: list[~azure.ai.textanalytics.v3_1_preview_4.models.Entity] + :param warnings: Required. Warnings encountered while processing document. + :type warnings: list[~azure.ai.textanalytics.v3_1_preview_4.models.TextAnalyticsWarning] + :param statistics: if showStats=true was specified in the request this field will contain + information about the document payload. + :type statistics: ~azure.ai.textanalytics.v3_1_preview_4.models.DocumentStatistics + """ + + _validation = { + 'id': {'required': True}, + 'redacted_text': {'required': True}, + 'entities': {'required': True}, + 'warnings': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'redacted_text': {'key': 'redactedText', 'type': 'str'}, + 'entities': {'key': 'entities', 'type': '[Entity]'}, + 'warnings': {'key': 'warnings', 'type': '[TextAnalyticsWarning]'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + } + + def __init__( + self, + *, + id: str, + redacted_text: str, + entities: List["Entity"], + warnings: List["TextAnalyticsWarning"], + statistics: Optional["DocumentStatistics"] = None, + **kwargs + ): + super(PiiDocumentEntities, self).__init__(**kwargs) + self.id = id + self.redacted_text = redacted_text + self.entities = entities + self.warnings = warnings + self.statistics = statistics + + +class PiiResult(msrest.serialization.Model): + """PiiResult. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. Response by document. + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.PiiDocumentEntities] + :param errors: Required. Errors by document id. + :type errors: list[~azure.ai.textanalytics.v3_1_preview_4.models.DocumentError] + :param statistics: if showStats=true was specified in the request this field will contain + information about the request payload. + :type statistics: ~azure.ai.textanalytics.v3_1_preview_4.models.RequestStatistics + :param model_version: Required. This field indicates which model is used for scoring. + :type model_version: str + """ + + _validation = { + 'documents': {'required': True}, + 'errors': {'required': True}, + 'model_version': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[PiiDocumentEntities]'}, + 'errors': {'key': 'errors', 'type': '[DocumentError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + 'model_version': {'key': 'modelVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + documents: List["PiiDocumentEntities"], + errors: List["DocumentError"], + model_version: str, + statistics: Optional["RequestStatistics"] = None, + **kwargs + ): + super(PiiResult, self).__init__(**kwargs) + self.documents = documents + self.errors = errors + self.statistics = statistics + self.model_version = model_version + + +class PiiTask(msrest.serialization.Model): + """PiiTask. + + :param parameters: + :type parameters: ~azure.ai.textanalytics.v3_1_preview_4.models.PiiTaskParameters + """ + + _attribute_map = { + 'parameters': {'key': 'parameters', 'type': 'PiiTaskParameters'}, + } + + def __init__( + self, + *, + parameters: Optional["PiiTaskParameters"] = None, + **kwargs + ): + super(PiiTask, self).__init__(**kwargs) + self.parameters = parameters + + +class PiiTaskParameters(msrest.serialization.Model): + """PiiTaskParameters. + + :param domain: Possible values include: "phi", "none". Default value: "none". + :type domain: str or ~azure.ai.textanalytics.v3_1_preview_4.models.PiiTaskParametersDomain + :param model_version: + :type model_version: str + :param pii_categories: (Optional) describes the PII categories to return. + :type pii_categories: list[str or ~azure.ai.textanalytics.v3_1_preview_4.models.PiiCategory] + :param string_index_type: Possible values include: "TextElements_v8", "UnicodeCodePoint", + "Utf16CodeUnit". Default value: "TextElements_v8". + :type string_index_type: str or + ~azure.ai.textanalytics.v3_1_preview_4.models.StringIndexTypeResponse + """ + + _validation = { + 'pii_categories': {'unique': True}, + } + + _attribute_map = { + 'domain': {'key': 'domain', 'type': 'str'}, + 'model_version': {'key': 'model-version', 'type': 'str'}, + 'pii_categories': {'key': 'piiCategories', 'type': '[str]'}, + 'string_index_type': {'key': 'stringIndexType', 'type': 'str'}, + } + + def __init__( + self, + *, + domain: Optional[Union[str, "PiiTaskParametersDomain"]] = "none", + model_version: Optional[str] = "latest", + pii_categories: Optional[List[Union[str, "PiiCategory"]]] = None, + string_index_type: Optional[Union[str, "StringIndexTypeResponse"]] = "TextElements_v8", + **kwargs + ): + super(PiiTaskParameters, self).__init__(**kwargs) + self.domain = domain + self.model_version = model_version + self.pii_categories = pii_categories + self.string_index_type = string_index_type + + +class RequestStatistics(msrest.serialization.Model): + """if showStats=true was specified in the request this field will contain information about the request payload. + + All required parameters must be populated in order to send to Azure. + + :param documents_count: Required. Number of documents submitted in the request. + :type documents_count: int + :param valid_documents_count: Required. Number of valid documents. This excludes empty, over- + size limit or non-supported languages documents. + :type valid_documents_count: int + :param erroneous_documents_count: Required. Number of invalid documents. This includes empty, + over-size limit or non-supported languages documents. + :type erroneous_documents_count: int + :param transactions_count: Required. Number of transactions for the request. + :type transactions_count: long + """ + + _validation = { + 'documents_count': {'required': True}, + 'valid_documents_count': {'required': True}, + 'erroneous_documents_count': {'required': True}, + 'transactions_count': {'required': True}, + } + + _attribute_map = { + 'documents_count': {'key': 'documentsCount', 'type': 'int'}, + 'valid_documents_count': {'key': 'validDocumentsCount', 'type': 'int'}, + 'erroneous_documents_count': {'key': 'erroneousDocumentsCount', 'type': 'int'}, + 'transactions_count': {'key': 'transactionsCount', 'type': 'long'}, + } + + def __init__( + self, + *, + documents_count: int, + valid_documents_count: int, + erroneous_documents_count: int, + transactions_count: int, + **kwargs + ): + super(RequestStatistics, self).__init__(**kwargs) + self.documents_count = documents_count + self.valid_documents_count = valid_documents_count + self.erroneous_documents_count = erroneous_documents_count + self.transactions_count = transactions_count + + +class SentenceAssessment(msrest.serialization.Model): + """SentenceAssessment. + + All required parameters must be populated in order to send to Azure. + + :param sentiment: Required. Assessment sentiment in the sentence. Possible values include: + "positive", "mixed", "negative". + :type sentiment: str or ~azure.ai.textanalytics.v3_1_preview_4.models.TokenSentimentValue + :param confidence_scores: Required. Assessment sentiment confidence scores in the sentence. + :type confidence_scores: + ~azure.ai.textanalytics.v3_1_preview_4.models.TargetConfidenceScoreLabel + :param offset: Required. The assessment offset from the start of the sentence. + :type offset: int + :param length: Required. The length of the assessment. + :type length: int + :param text: Required. The assessment text detected. + :type text: str + :param is_negated: Required. The indicator representing if the assessment is negated. + :type is_negated: bool + """ + + _validation = { + 'sentiment': {'required': True}, + 'confidence_scores': {'required': True}, + 'offset': {'required': True}, + 'length': {'required': True}, + 'text': {'required': True}, + 'is_negated': {'required': True}, + } + + _attribute_map = { + 'sentiment': {'key': 'sentiment', 'type': 'str'}, + 'confidence_scores': {'key': 'confidenceScores', 'type': 'TargetConfidenceScoreLabel'}, + 'offset': {'key': 'offset', 'type': 'int'}, + 'length': {'key': 'length', 'type': 'int'}, + 'text': {'key': 'text', 'type': 'str'}, + 'is_negated': {'key': 'isNegated', 'type': 'bool'}, + } + + def __init__( + self, + *, + sentiment: Union[str, "TokenSentimentValue"], + confidence_scores: "TargetConfidenceScoreLabel", + offset: int, + length: int, + text: str, + is_negated: bool, + **kwargs + ): + super(SentenceAssessment, self).__init__(**kwargs) + self.sentiment = sentiment + self.confidence_scores = confidence_scores + self.offset = offset + self.length = length + self.text = text + self.is_negated = is_negated + + +class SentenceSentiment(msrest.serialization.Model): + """SentenceSentiment. + + All required parameters must be populated in order to send to Azure. + + :param text: Required. The sentence text. + :type text: str + :param sentiment: Required. The predicted Sentiment for the sentence. Possible values include: + "positive", "neutral", "negative". + :type sentiment: str or ~azure.ai.textanalytics.v3_1_preview_4.models.SentenceSentimentValue + :param confidence_scores: Required. The sentiment confidence score between 0 and 1 for the + sentence for all classes. + :type confidence_scores: + ~azure.ai.textanalytics.v3_1_preview_4.models.SentimentConfidenceScorePerLabel + :param offset: Required. The sentence offset from the start of the document. + :type offset: int + :param length: Required. The length of the sentence. + :type length: int + :param targets: The array of sentence targets for the sentence. + :type targets: list[~azure.ai.textanalytics.v3_1_preview_4.models.SentenceTarget] + :param assessments: The array of assessments for the sentence. + :type assessments: list[~azure.ai.textanalytics.v3_1_preview_4.models.SentenceAssessment] + """ + + _validation = { + 'text': {'required': True}, + 'sentiment': {'required': True}, + 'confidence_scores': {'required': True}, + 'offset': {'required': True}, + 'length': {'required': True}, + } + + _attribute_map = { + 'text': {'key': 'text', 'type': 'str'}, + 'sentiment': {'key': 'sentiment', 'type': 'str'}, + 'confidence_scores': {'key': 'confidenceScores', 'type': 'SentimentConfidenceScorePerLabel'}, + 'offset': {'key': 'offset', 'type': 'int'}, + 'length': {'key': 'length', 'type': 'int'}, + 'targets': {'key': 'targets', 'type': '[SentenceTarget]'}, + 'assessments': {'key': 'assessments', 'type': '[SentenceAssessment]'}, + } + + def __init__( + self, + *, + text: str, + sentiment: Union[str, "SentenceSentimentValue"], + confidence_scores: "SentimentConfidenceScorePerLabel", + offset: int, + length: int, + targets: Optional[List["SentenceTarget"]] = None, + assessments: Optional[List["SentenceAssessment"]] = None, + **kwargs + ): + super(SentenceSentiment, self).__init__(**kwargs) + self.text = text + self.sentiment = sentiment + self.confidence_scores = confidence_scores + self.offset = offset + self.length = length + self.targets = targets + self.assessments = assessments + + +class SentenceTarget(msrest.serialization.Model): + """SentenceTarget. + + All required parameters must be populated in order to send to Azure. + + :param sentiment: Required. Targeted sentiment in the sentence. Possible values include: + "positive", "mixed", "negative". + :type sentiment: str or ~azure.ai.textanalytics.v3_1_preview_4.models.TokenSentimentValue + :param confidence_scores: Required. Target sentiment confidence scores for the target in the + sentence. + :type confidence_scores: + ~azure.ai.textanalytics.v3_1_preview_4.models.TargetConfidenceScoreLabel + :param offset: Required. The target offset from the start of the sentence. + :type offset: int + :param length: Required. The length of the target. + :type length: int + :param text: Required. The target text detected. + :type text: str + :param relations: Required. The array of either assessment or target objects which is related + to the target. + :type relations: list[~azure.ai.textanalytics.v3_1_preview_4.models.TargetRelation] + """ + + _validation = { + 'sentiment': {'required': True}, + 'confidence_scores': {'required': True}, + 'offset': {'required': True}, + 'length': {'required': True}, + 'text': {'required': True}, + 'relations': {'required': True}, + } + + _attribute_map = { + 'sentiment': {'key': 'sentiment', 'type': 'str'}, + 'confidence_scores': {'key': 'confidenceScores', 'type': 'TargetConfidenceScoreLabel'}, + 'offset': {'key': 'offset', 'type': 'int'}, + 'length': {'key': 'length', 'type': 'int'}, + 'text': {'key': 'text', 'type': 'str'}, + 'relations': {'key': 'relations', 'type': '[TargetRelation]'}, + } + + def __init__( + self, + *, + sentiment: Union[str, "TokenSentimentValue"], + confidence_scores: "TargetConfidenceScoreLabel", + offset: int, + length: int, + text: str, + relations: List["TargetRelation"], + **kwargs + ): + super(SentenceTarget, self).__init__(**kwargs) + self.sentiment = sentiment + self.confidence_scores = confidence_scores + self.offset = offset + self.length = length + self.text = text + self.relations = relations + + +class SentimentConfidenceScorePerLabel(msrest.serialization.Model): + """Represents the confidence scores between 0 and 1 across all sentiment classes: positive, neutral, negative. + + All required parameters must be populated in order to send to Azure. + + :param positive: Required. + :type positive: float + :param neutral: Required. + :type neutral: float + :param negative: Required. + :type negative: float + """ + + _validation = { + 'positive': {'required': True}, + 'neutral': {'required': True}, + 'negative': {'required': True}, + } + + _attribute_map = { + 'positive': {'key': 'positive', 'type': 'float'}, + 'neutral': {'key': 'neutral', 'type': 'float'}, + 'negative': {'key': 'negative', 'type': 'float'}, + } + + def __init__( + self, + *, + positive: float, + neutral: float, + negative: float, + **kwargs + ): + super(SentimentConfidenceScorePerLabel, self).__init__(**kwargs) + self.positive = positive + self.neutral = neutral + self.negative = negative + + +class SentimentResponse(msrest.serialization.Model): + """SentimentResponse. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. Sentiment analysis per document. + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.DocumentSentiment] + :param errors: Required. Errors by document id. + :type errors: list[~azure.ai.textanalytics.v3_1_preview_4.models.DocumentError] + :param statistics: if showStats=true was specified in the request this field will contain + information about the request payload. + :type statistics: ~azure.ai.textanalytics.v3_1_preview_4.models.RequestStatistics + :param model_version: Required. This field indicates which model is used for scoring. + :type model_version: str + """ + + _validation = { + 'documents': {'required': True}, + 'errors': {'required': True}, + 'model_version': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[DocumentSentiment]'}, + 'errors': {'key': 'errors', 'type': '[DocumentError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + 'model_version': {'key': 'modelVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + documents: List["DocumentSentiment"], + errors: List["DocumentError"], + model_version: str, + statistics: Optional["RequestStatistics"] = None, + **kwargs + ): + super(SentimentResponse, self).__init__(**kwargs) + self.documents = documents + self.errors = errors + self.statistics = statistics + self.model_version = model_version + + +class TargetConfidenceScoreLabel(msrest.serialization.Model): + """Represents the confidence scores across all sentiment classes: positive, neutral, negative. + + All required parameters must be populated in order to send to Azure. + + :param positive: Required. + :type positive: float + :param negative: Required. + :type negative: float + """ + + _validation = { + 'positive': {'required': True}, + 'negative': {'required': True}, + } + + _attribute_map = { + 'positive': {'key': 'positive', 'type': 'float'}, + 'negative': {'key': 'negative', 'type': 'float'}, + } + + def __init__( + self, + *, + positive: float, + negative: float, + **kwargs + ): + super(TargetConfidenceScoreLabel, self).__init__(**kwargs) + self.positive = positive + self.negative = negative + + +class TargetRelation(msrest.serialization.Model): + """TargetRelation. + + All required parameters must be populated in order to send to Azure. + + :param relation_type: Required. The type related to the target. Possible values include: + "assessment", "target". + :type relation_type: str or ~azure.ai.textanalytics.v3_1_preview_4.models.TargetRelationType + :param ref: Required. The JSON pointer indicating the linked object. + :type ref: str + """ + + _validation = { + 'relation_type': {'required': True}, + 'ref': {'required': True}, + } + + _attribute_map = { + 'relation_type': {'key': 'relationType', 'type': 'str'}, + 'ref': {'key': 'ref', 'type': 'str'}, + } + + def __init__( + self, + *, + relation_type: Union[str, "TargetRelationType"], + ref: str, + **kwargs + ): + super(TargetRelation, self).__init__(**kwargs) + self.relation_type = relation_type + self.ref = ref + + +class TasksStateTasks(msrest.serialization.Model): + """TasksStateTasks. + + All required parameters must be populated in order to send to Azure. + + :param details: + :type details: ~azure.ai.textanalytics.v3_1_preview_4.models.TasksStateTasksDetails + :param completed: Required. + :type completed: int + :param failed: Required. + :type failed: int + :param in_progress: Required. + :type in_progress: int + :param total: Required. + :type total: int + :param entity_recognition_tasks: + :type entity_recognition_tasks: + list[~azure.ai.textanalytics.v3_1_preview_4.models.TasksStateTasksEntityRecognitionTasksItem] + :param entity_recognition_pii_tasks: + :type entity_recognition_pii_tasks: + list[~azure.ai.textanalytics.v3_1_preview_4.models.TasksStateTasksEntityRecognitionPiiTasksItem] + :param key_phrase_extraction_tasks: + :type key_phrase_extraction_tasks: + list[~azure.ai.textanalytics.v3_1_preview_4.models.TasksStateTasksKeyPhraseExtractionTasksItem] + :param entity_linking_tasks: + :type entity_linking_tasks: + list[~azure.ai.textanalytics.v3_1_preview_4.models.TasksStateTasksEntityLinkingTasksItem] + """ + + _validation = { + 'completed': {'required': True}, + 'failed': {'required': True}, + 'in_progress': {'required': True}, + 'total': {'required': True}, + } + + _attribute_map = { + 'details': {'key': 'details', 'type': 'TasksStateTasksDetails'}, + 'completed': {'key': 'completed', 'type': 'int'}, + 'failed': {'key': 'failed', 'type': 'int'}, + 'in_progress': {'key': 'inProgress', 'type': 'int'}, + 'total': {'key': 'total', 'type': 'int'}, + 'entity_recognition_tasks': {'key': 'entityRecognitionTasks', 'type': '[TasksStateTasksEntityRecognitionTasksItem]'}, + 'entity_recognition_pii_tasks': {'key': 'entityRecognitionPiiTasks', 'type': '[TasksStateTasksEntityRecognitionPiiTasksItem]'}, + 'key_phrase_extraction_tasks': {'key': 'keyPhraseExtractionTasks', 'type': '[TasksStateTasksKeyPhraseExtractionTasksItem]'}, + 'entity_linking_tasks': {'key': 'entityLinkingTasks', 'type': '[TasksStateTasksEntityLinkingTasksItem]'}, + } + + def __init__( + self, + *, + completed: int, + failed: int, + in_progress: int, + total: int, + details: Optional["TasksStateTasksDetails"] = None, + entity_recognition_tasks: Optional[List["TasksStateTasksEntityRecognitionTasksItem"]] = None, + entity_recognition_pii_tasks: Optional[List["TasksStateTasksEntityRecognitionPiiTasksItem"]] = None, + key_phrase_extraction_tasks: Optional[List["TasksStateTasksKeyPhraseExtractionTasksItem"]] = None, + entity_linking_tasks: Optional[List["TasksStateTasksEntityLinkingTasksItem"]] = None, + **kwargs + ): + super(TasksStateTasks, self).__init__(**kwargs) + self.details = details + self.completed = completed + self.failed = failed + self.in_progress = in_progress + self.total = total + self.entity_recognition_tasks = entity_recognition_tasks + self.entity_recognition_pii_tasks = entity_recognition_pii_tasks + self.key_phrase_extraction_tasks = key_phrase_extraction_tasks + self.entity_linking_tasks = entity_linking_tasks + + +class TaskState(msrest.serialization.Model): + """TaskState. + + All required parameters must be populated in order to send to Azure. + + :param last_update_date_time: Required. + :type last_update_date_time: ~datetime.datetime + :param name: + :type name: str + :param status: Required. Possible values include: "notStarted", "running", "succeeded", + "failed", "rejected", "cancelled", "cancelling", "partiallyCompleted". + :type status: str or ~azure.ai.textanalytics.v3_1_preview_4.models.State + """ + + _validation = { + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + *, + last_update_date_time: datetime.datetime, + status: Union[str, "State"], + name: Optional[str] = None, + **kwargs + ): + super(TaskState, self).__init__(**kwargs) + self.last_update_date_time = last_update_date_time + self.name = name + self.status = status + + +class TasksStateTasksDetails(TaskState): + """TasksStateTasksDetails. + + All required parameters must be populated in order to send to Azure. + + :param last_update_date_time: Required. + :type last_update_date_time: ~datetime.datetime + :param name: + :type name: str + :param status: Required. Possible values include: "notStarted", "running", "succeeded", + "failed", "rejected", "cancelled", "cancelling", "partiallyCompleted". + :type status: str or ~azure.ai.textanalytics.v3_1_preview_4.models.State + """ + + _validation = { + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + *, + last_update_date_time: datetime.datetime, + status: Union[str, "State"], + name: Optional[str] = None, + **kwargs + ): + super(TasksStateTasksDetails, self).__init__(last_update_date_time=last_update_date_time, name=name, status=status, **kwargs) + + +class TasksStateTasksEntityLinkingTasksItem(TaskState, ComponentsIfu7BjSchemasTasksstatePropertiesTasksPropertiesEntitylinkingtasksItemsAllof1): + """TasksStateTasksEntityLinkingTasksItem. + + All required parameters must be populated in order to send to Azure. + + :param results: + :type results: ~azure.ai.textanalytics.v3_1_preview_4.models.EntityLinkingResult + :param last_update_date_time: Required. + :type last_update_date_time: ~datetime.datetime + :param name: + :type name: str + :param status: Required. Possible values include: "notStarted", "running", "succeeded", + "failed", "rejected", "cancelled", "cancelling", "partiallyCompleted". + :type status: str or ~azure.ai.textanalytics.v3_1_preview_4.models.State + """ + + _validation = { + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'results': {'key': 'results', 'type': 'EntityLinkingResult'}, + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + *, + last_update_date_time: datetime.datetime, + status: Union[str, "State"], + results: Optional["EntityLinkingResult"] = None, + name: Optional[str] = None, + **kwargs + ): + super(TasksStateTasksEntityLinkingTasksItem, self).__init__(last_update_date_time=last_update_date_time, name=name, status=status, results=results, **kwargs) + self.results = results + self.last_update_date_time = last_update_date_time + self.name = name + self.status = status + + +class TasksStateTasksEntityRecognitionPiiTasksItem(TaskState, Components15X8E9LSchemasTasksstatePropertiesTasksPropertiesEntityrecognitionpiitasksItemsAllof1): + """TasksStateTasksEntityRecognitionPiiTasksItem. + + All required parameters must be populated in order to send to Azure. + + :param results: + :type results: ~azure.ai.textanalytics.v3_1_preview_4.models.PiiResult + :param last_update_date_time: Required. + :type last_update_date_time: ~datetime.datetime + :param name: + :type name: str + :param status: Required. Possible values include: "notStarted", "running", "succeeded", + "failed", "rejected", "cancelled", "cancelling", "partiallyCompleted". + :type status: str or ~azure.ai.textanalytics.v3_1_preview_4.models.State + """ + + _validation = { + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'results': {'key': 'results', 'type': 'PiiResult'}, + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + *, + last_update_date_time: datetime.datetime, + status: Union[str, "State"], + results: Optional["PiiResult"] = None, + name: Optional[str] = None, + **kwargs + ): + super(TasksStateTasksEntityRecognitionPiiTasksItem, self).__init__(last_update_date_time=last_update_date_time, name=name, status=status, results=results, **kwargs) + self.results = results + self.last_update_date_time = last_update_date_time + self.name = name + self.status = status + + +class TasksStateTasksEntityRecognitionTasksItem(TaskState, Components15Gvwi3SchemasTasksstatePropertiesTasksPropertiesEntityrecognitiontasksItemsAllof1): + """TasksStateTasksEntityRecognitionTasksItem. + + All required parameters must be populated in order to send to Azure. + + :param results: + :type results: ~azure.ai.textanalytics.v3_1_preview_4.models.EntitiesResult + :param last_update_date_time: Required. + :type last_update_date_time: ~datetime.datetime + :param name: + :type name: str + :param status: Required. Possible values include: "notStarted", "running", "succeeded", + "failed", "rejected", "cancelled", "cancelling", "partiallyCompleted". + :type status: str or ~azure.ai.textanalytics.v3_1_preview_4.models.State + """ + + _validation = { + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'results': {'key': 'results', 'type': 'EntitiesResult'}, + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + *, + last_update_date_time: datetime.datetime, + status: Union[str, "State"], + results: Optional["EntitiesResult"] = None, + name: Optional[str] = None, + **kwargs + ): + super(TasksStateTasksEntityRecognitionTasksItem, self).__init__(last_update_date_time=last_update_date_time, name=name, status=status, results=results, **kwargs) + self.results = results + self.last_update_date_time = last_update_date_time + self.name = name + self.status = status + + +class TasksStateTasksKeyPhraseExtractionTasksItem(TaskState, Components1D9IzucSchemasTasksstatePropertiesTasksPropertiesKeyphraseextractiontasksItemsAllof1): + """TasksStateTasksKeyPhraseExtractionTasksItem. + + All required parameters must be populated in order to send to Azure. + + :param results: + :type results: ~azure.ai.textanalytics.v3_1_preview_4.models.KeyPhraseResult + :param last_update_date_time: Required. + :type last_update_date_time: ~datetime.datetime + :param name: + :type name: str + :param status: Required. Possible values include: "notStarted", "running", "succeeded", + "failed", "rejected", "cancelled", "cancelling", "partiallyCompleted". + :type status: str or ~azure.ai.textanalytics.v3_1_preview_4.models.State + """ + + _validation = { + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'results': {'key': 'results', 'type': 'KeyPhraseResult'}, + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + *, + last_update_date_time: datetime.datetime, + status: Union[str, "State"], + results: Optional["KeyPhraseResult"] = None, + name: Optional[str] = None, + **kwargs + ): + super(TasksStateTasksKeyPhraseExtractionTasksItem, self).__init__(last_update_date_time=last_update_date_time, name=name, status=status, results=results, **kwargs) + self.results = results + self.last_update_date_time = last_update_date_time + self.name = name + self.status = status + + +class TextAnalyticsError(msrest.serialization.Model): + """TextAnalyticsError. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. Error code. Possible values include: "InvalidRequest", + "InvalidArgument", "InternalServerError", "ServiceUnavailable", "NotFound". + :type code: str or ~azure.ai.textanalytics.v3_1_preview_4.models.ErrorCodeValue + :param message: Required. Error message. + :type message: str + :param target: Error target. + :type target: str + :param innererror: Inner error contains more specific information. + :type innererror: ~azure.ai.textanalytics.v3_1_preview_4.models.InnerError + :param details: Details about specific errors that led to this reported error. + :type details: list[~azure.ai.textanalytics.v3_1_preview_4.models.TextAnalyticsError] + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'innererror': {'key': 'innererror', 'type': 'InnerError'}, + 'details': {'key': 'details', 'type': '[TextAnalyticsError]'}, + } + + def __init__( + self, + *, + code: Union[str, "ErrorCodeValue"], + message: str, + target: Optional[str] = None, + innererror: Optional["InnerError"] = None, + details: Optional[List["TextAnalyticsError"]] = None, + **kwargs + ): + super(TextAnalyticsError, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.innererror = innererror + self.details = details + + +class TextAnalyticsWarning(msrest.serialization.Model): + """TextAnalyticsWarning. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. Error code. Possible values include: "LongWordsInDocument", + "DocumentTruncated". + :type code: str or ~azure.ai.textanalytics.v3_1_preview_4.models.WarningCodeValue + :param message: Required. Warning message. + :type message: str + :param target_ref: A JSON pointer reference indicating the target object. + :type target_ref: str + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target_ref': {'key': 'targetRef', 'type': 'str'}, + } + + def __init__( + self, + *, + code: Union[str, "WarningCodeValue"], + message: str, + target_ref: Optional[str] = None, + **kwargs + ): + super(TextAnalyticsWarning, self).__init__(**kwargs) + self.code = code + self.message = message + self.target_ref = target_ref diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/models/_text_analytics_client_enums.py b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/models/_text_analytics_client_enums.py new file mode 100644 index 000000000000..227630b77b02 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/models/_text_analytics_client_enums.py @@ -0,0 +1,358 @@ +# 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 enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class Association(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Describes if the entity is the subject of the text or if it describes someone else. + """ + + SUBJECT = "subject" + OTHER = "other" + +class Certainty(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Describes the entities certainty and polarity. + """ + + POSITIVE = "Positive" + POSITIVE_POSSIBLE = "Positive Possible" + NEUTRAL_POSSIBLE = "Neutral Possible" + NEGATIVE_POSSIBLE = "Negative Possible" + NEGATIVE = "Negative" + +class Conditionality(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Describes any conditionality on the entity. + """ + + HYPOTHETICAL = "Hypothetical" + CONDITIONAL = "Conditional" + +class DocumentSentimentValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Predicted sentiment for document (Negative, Neutral, Positive, or Mixed). + """ + + POSITIVE = "positive" + NEUTRAL = "neutral" + NEGATIVE = "negative" + MIXED = "mixed" + +class ErrorCodeValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Error code. + """ + + INVALID_REQUEST = "InvalidRequest" + INVALID_ARGUMENT = "InvalidArgument" + INTERNAL_SERVER_ERROR = "InternalServerError" + SERVICE_UNAVAILABLE = "ServiceUnavailable" + NOT_FOUND = "NotFound" + +class InnerErrorCodeValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Error code. + """ + + INVALID_PARAMETER_VALUE = "InvalidParameterValue" + INVALID_REQUEST_BODY_FORMAT = "InvalidRequestBodyFormat" + EMPTY_REQUEST = "EmptyRequest" + MISSING_INPUT_RECORDS = "MissingInputRecords" + INVALID_DOCUMENT = "InvalidDocument" + MODEL_VERSION_INCORRECT = "ModelVersionIncorrect" + INVALID_DOCUMENT_BATCH = "InvalidDocumentBatch" + UNSUPPORTED_LANGUAGE_CODE = "UnsupportedLanguageCode" + INVALID_COUNTRY_HINT = "InvalidCountryHint" + +class PiiCategory(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + ABA_ROUTING_NUMBER = "ABARoutingNumber" + AR_NATIONAL_IDENTITY_NUMBER = "ARNationalIdentityNumber" + AU_BANK_ACCOUNT_NUMBER = "AUBankAccountNumber" + AU_DRIVERS_LICENSE_NUMBER = "AUDriversLicenseNumber" + AU_MEDICAL_ACCOUNT_NUMBER = "AUMedicalAccountNumber" + AU_PASSPORT_NUMBER = "AUPassportNumber" + AU_TAX_FILE_NUMBER = "AUTaxFileNumber" + AU_BUSINESS_NUMBER = "AUBusinessNumber" + AU_COMPANY_NUMBER = "AUCompanyNumber" + AT_IDENTITY_CARD = "ATIdentityCard" + AT_TAX_IDENTIFICATION_NUMBER = "ATTaxIdentificationNumber" + AT_VALUE_ADDED_TAX_NUMBER = "ATValueAddedTaxNumber" + AZURE_DOCUMENT_DB_AUTH_KEY = "AzureDocumentDBAuthKey" + AZURE_IAAS_DATABASE_CONNECTION_AND_SQL_STRING = "AzureIAASDatabaseConnectionAndSQLString" + AZURE_IO_T_CONNECTION_STRING = "AzureIoTConnectionString" + AZURE_PUBLISH_SETTING_PASSWORD = "AzurePublishSettingPassword" + AZURE_REDIS_CACHE_STRING = "AzureRedisCacheString" + AZURE_SAS = "AzureSAS" + AZURE_SERVICE_BUS_STRING = "AzureServiceBusString" + AZURE_STORAGE_ACCOUNT_KEY = "AzureStorageAccountKey" + AZURE_STORAGE_ACCOUNT_GENERIC = "AzureStorageAccountGeneric" + BE_NATIONAL_NUMBER = "BENationalNumber" + BE_NATIONAL_NUMBER_V2 = "BENationalNumberV2" + BE_VALUE_ADDED_TAX_NUMBER = "BEValueAddedTaxNumber" + BRCPF_NUMBER = "BRCPFNumber" + BR_LEGAL_ENTITY_NUMBER = "BRLegalEntityNumber" + BR_NATIONAL_IDRG = "BRNationalIDRG" + BG_UNIFORM_CIVIL_NUMBER = "BGUniformCivilNumber" + CA_BANK_ACCOUNT_NUMBER = "CABankAccountNumber" + CA_DRIVERS_LICENSE_NUMBER = "CADriversLicenseNumber" + CA_HEALTH_SERVICE_NUMBER = "CAHealthServiceNumber" + CA_PASSPORT_NUMBER = "CAPassportNumber" + CA_PERSONAL_HEALTH_IDENTIFICATION = "CAPersonalHealthIdentification" + CA_SOCIAL_INSURANCE_NUMBER = "CASocialInsuranceNumber" + CL_IDENTITY_CARD_NUMBER = "CLIdentityCardNumber" + CN_RESIDENT_IDENTITY_CARD_NUMBER = "CNResidentIdentityCardNumber" + CREDIT_CARD_NUMBER = "CreditCardNumber" + HR_IDENTITY_CARD_NUMBER = "HRIdentityCardNumber" + HR_NATIONAL_ID_NUMBER = "HRNationalIDNumber" + HR_PERSONAL_IDENTIFICATION_NUMBER = "HRPersonalIdentificationNumber" + HR_PERSONAL_IDENTIFICATION_OIB_NUMBER_V2 = "HRPersonalIdentificationOIBNumberV2" + CY_IDENTITY_CARD = "CYIdentityCard" + CY_TAX_IDENTIFICATION_NUMBER = "CYTaxIdentificationNumber" + CZ_PERSONAL_IDENTITY_NUMBER = "CZPersonalIdentityNumber" + CZ_PERSONAL_IDENTITY_V2 = "CZPersonalIdentityV2" + DK_PERSONAL_IDENTIFICATION_NUMBER = "DKPersonalIdentificationNumber" + DK_PERSONAL_IDENTIFICATION_V2 = "DKPersonalIdentificationV2" + DRUG_ENFORCEMENT_AGENCY_NUMBER = "DrugEnforcementAgencyNumber" + EE_PERSONAL_IDENTIFICATION_CODE = "EEPersonalIdentificationCode" + EU_DEBIT_CARD_NUMBER = "EUDebitCardNumber" + EU_DRIVERS_LICENSE_NUMBER = "EUDriversLicenseNumber" + EUGPS_COORDINATES = "EUGPSCoordinates" + EU_NATIONAL_IDENTIFICATION_NUMBER = "EUNationalIdentificationNumber" + EU_PASSPORT_NUMBER = "EUPassportNumber" + EU_SOCIAL_SECURITY_NUMBER = "EUSocialSecurityNumber" + EU_TAX_IDENTIFICATION_NUMBER = "EUTaxIdentificationNumber" + FI_EUROPEAN_HEALTH_NUMBER = "FIEuropeanHealthNumber" + FI_NATIONAL_ID = "FINationalID" + FI_NATIONAL_IDV2 = "FINationalIDV2" + FI_PASSPORT_NUMBER = "FIPassportNumber" + FR_DRIVERS_LICENSE_NUMBER = "FRDriversLicenseNumber" + FR_HEALTH_INSURANCE_NUMBER = "FRHealthInsuranceNumber" + FR_NATIONAL_ID = "FRNationalID" + FR_PASSPORT_NUMBER = "FRPassportNumber" + FR_SOCIAL_SECURITY_NUMBER = "FRSocialSecurityNumber" + FR_TAX_IDENTIFICATION_NUMBER = "FRTaxIdentificationNumber" + FR_VALUE_ADDED_TAX_NUMBER = "FRValueAddedTaxNumber" + DE_DRIVERS_LICENSE_NUMBER = "DEDriversLicenseNumber" + DE_PASSPORT_NUMBER = "DEPassportNumber" + DE_IDENTITY_CARD_NUMBER = "DEIdentityCardNumber" + DE_TAX_IDENTIFICATION_NUMBER = "DETaxIdentificationNumber" + DE_VALUE_ADDED_NUMBER = "DEValueAddedNumber" + GR_NATIONAL_ID_CARD = "GRNationalIDCard" + GR_NATIONAL_IDV2 = "GRNationalIDV2" + GR_TAX_IDENTIFICATION_NUMBER = "GRTaxIdentificationNumber" + HK_IDENTITY_CARD_NUMBER = "HKIdentityCardNumber" + HU_VALUE_ADDED_NUMBER = "HUValueAddedNumber" + HU_PERSONAL_IDENTIFICATION_NUMBER = "HUPersonalIdentificationNumber" + HU_TAX_IDENTIFICATION_NUMBER = "HUTaxIdentificationNumber" + IN_PERMANENT_ACCOUNT = "INPermanentAccount" + IN_UNIQUE_IDENTIFICATION_NUMBER = "INUniqueIdentificationNumber" + ID_IDENTITY_CARD_NUMBER = "IDIdentityCardNumber" + INTERNATIONAL_BANKING_ACCOUNT_NUMBER = "InternationalBankingAccountNumber" + IE_PERSONAL_PUBLIC_SERVICE_NUMBER = "IEPersonalPublicServiceNumber" + IE_PERSONAL_PUBLIC_SERVICE_NUMBER_V2 = "IEPersonalPublicServiceNumberV2" + IL_BANK_ACCOUNT_NUMBER = "ILBankAccountNumber" + IL_NATIONAL_ID = "ILNationalID" + IT_DRIVERS_LICENSE_NUMBER = "ITDriversLicenseNumber" + IT_FISCAL_CODE = "ITFiscalCode" + IT_VALUE_ADDED_TAX_NUMBER = "ITValueAddedTaxNumber" + JP_BANK_ACCOUNT_NUMBER = "JPBankAccountNumber" + JP_DRIVERS_LICENSE_NUMBER = "JPDriversLicenseNumber" + JP_PASSPORT_NUMBER = "JPPassportNumber" + JP_RESIDENT_REGISTRATION_NUMBER = "JPResidentRegistrationNumber" + JP_SOCIAL_INSURANCE_NUMBER = "JPSocialInsuranceNumber" + JP_MY_NUMBER_CORPORATE = "JPMyNumberCorporate" + JP_MY_NUMBER_PERSONAL = "JPMyNumberPersonal" + JP_RESIDENCE_CARD_NUMBER = "JPResidenceCardNumber" + LV_PERSONAL_CODE = "LVPersonalCode" + LT_PERSONAL_CODE = "LTPersonalCode" + LU_NATIONAL_IDENTIFICATION_NUMBER_NATURAL = "LUNationalIdentificationNumberNatural" + LU_NATIONAL_IDENTIFICATION_NUMBER_NON_NATURAL = "LUNationalIdentificationNumberNonNatural" + MY_IDENTITY_CARD_NUMBER = "MYIdentityCardNumber" + MT_IDENTITY_CARD_NUMBER = "MTIdentityCardNumber" + MT_TAX_ID_NUMBER = "MTTaxIDNumber" + NL_CITIZENS_SERVICE_NUMBER = "NLCitizensServiceNumber" + NL_CITIZENS_SERVICE_NUMBER_V2 = "NLCitizensServiceNumberV2" + NL_TAX_IDENTIFICATION_NUMBER = "NLTaxIdentificationNumber" + NL_VALUE_ADDED_TAX_NUMBER = "NLValueAddedTaxNumber" + NZ_BANK_ACCOUNT_NUMBER = "NZBankAccountNumber" + NZ_DRIVERS_LICENSE_NUMBER = "NZDriversLicenseNumber" + NZ_INLAND_REVENUE_NUMBER = "NZInlandRevenueNumber" + NZ_MINISTRY_OF_HEALTH_NUMBER = "NZMinistryOfHealthNumber" + NZ_SOCIAL_WELFARE_NUMBER = "NZSocialWelfareNumber" + NO_IDENTITY_NUMBER = "NOIdentityNumber" + PH_UNIFIED_MULTI_PURPOSE_ID_NUMBER = "PHUnifiedMultiPurposeIDNumber" + PL_IDENTITY_CARD = "PLIdentityCard" + PL_NATIONAL_ID = "PLNationalID" + PL_NATIONAL_IDV2 = "PLNationalIDV2" + PL_PASSPORT_NUMBER = "PLPassportNumber" + PL_TAX_IDENTIFICATION_NUMBER = "PLTaxIdentificationNumber" + PLREGON_NUMBER = "PLREGONNumber" + PT_CITIZEN_CARD_NUMBER = "PTCitizenCardNumber" + PT_CITIZEN_CARD_NUMBER_V2 = "PTCitizenCardNumberV2" + PT_TAX_IDENTIFICATION_NUMBER = "PTTaxIdentificationNumber" + RO_PERSONAL_NUMERICAL_CODE = "ROPersonalNumericalCode" + RU_PASSPORT_NUMBER_DOMESTIC = "RUPassportNumberDomestic" + RU_PASSPORT_NUMBER_INTERNATIONAL = "RUPassportNumberInternational" + SA_NATIONAL_ID = "SANationalID" + SG_NATIONAL_REGISTRATION_IDENTITY_CARD_NUMBER = "SGNationalRegistrationIdentityCardNumber" + SK_PERSONAL_NUMBER = "SKPersonalNumber" + SI_TAX_IDENTIFICATION_NUMBER = "SITaxIdentificationNumber" + SI_UNIQUE_MASTER_CITIZEN_NUMBER = "SIUniqueMasterCitizenNumber" + ZA_IDENTIFICATION_NUMBER = "ZAIdentificationNumber" + KR_RESIDENT_REGISTRATION_NUMBER = "KRResidentRegistrationNumber" + ESDNI = "ESDNI" + ES_SOCIAL_SECURITY_NUMBER = "ESSocialSecurityNumber" + ES_TAX_IDENTIFICATION_NUMBER = "ESTaxIdentificationNumber" + SQL_SERVER_CONNECTION_STRING = "SQLServerConnectionString" + SE_NATIONAL_ID = "SENationalID" + SE_NATIONAL_IDV2 = "SENationalIDV2" + SE_PASSPORT_NUMBER = "SEPassportNumber" + SE_TAX_IDENTIFICATION_NUMBER = "SETaxIdentificationNumber" + SWIFT_CODE = "SWIFTCode" + CH_SOCIAL_SECURITY_NUMBER = "CHSocialSecurityNumber" + TW_NATIONAL_ID = "TWNationalID" + TW_PASSPORT_NUMBER = "TWPassportNumber" + TW_RESIDENT_CERTIFICATE = "TWResidentCertificate" + TH_POPULATION_IDENTIFICATION_CODE = "THPopulationIdentificationCode" + TR_NATIONAL_IDENTIFICATION_NUMBER = "TRNationalIdentificationNumber" + UK_DRIVERS_LICENSE_NUMBER = "UKDriversLicenseNumber" + UK_ELECTORAL_ROLL_NUMBER = "UKElectoralRollNumber" + UK_NATIONAL_HEALTH_NUMBER = "UKNationalHealthNumber" + UK_NATIONAL_INSURANCE_NUMBER = "UKNationalInsuranceNumber" + UK_UNIQUE_TAXPAYER_NUMBER = "UKUniqueTaxpayerNumber" + USUK_PASSPORT_NUMBER = "USUKPassportNumber" + US_BANK_ACCOUNT_NUMBER = "USBankAccountNumber" + US_DRIVERS_LICENSE_NUMBER = "USDriversLicenseNumber" + US_INDIVIDUAL_TAXPAYER_IDENTIFICATION = "USIndividualTaxpayerIdentification" + US_SOCIAL_SECURITY_NUMBER = "USSocialSecurityNumber" + UA_PASSPORT_NUMBER_DOMESTIC = "UAPassportNumberDomestic" + UA_PASSPORT_NUMBER_INTERNATIONAL = "UAPassportNumberInternational" + ORGANIZATION = "Organization" + EMAIL = "Email" + URL = "URL" + AGE = "Age" + PHONE_NUMBER = "PhoneNumber" + IP_ADDRESS = "IPAddress" + DATE = "Date" + PERSON = "Person" + ADDRESS = "Address" + ALL = "All" + DEFAULT = "Default" + +class PiiTaskParametersDomain(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + PHI = "phi" + NONE = "none" + +class RelationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of relation. Examples include: ``DosageOfMedication`` or 'FrequencyOfMedication', etc. + """ + + ABBREVIATION = "Abbreviation" + DIRECTION_OF_BODY_STRUCTURE = "DirectionOfBodyStructure" + DIRECTION_OF_CONDITION = "DirectionOfCondition" + DIRECTION_OF_EXAMINATION = "DirectionOfExamination" + DIRECTION_OF_TREATMENT = "DirectionOfTreatment" + DOSAGE_OF_MEDICATION = "DosageOfMedication" + FORM_OF_MEDICATION = "FormOfMedication" + FREQUENCY_OF_MEDICATION = "FrequencyOfMedication" + FREQUENCY_OF_TREATMENT = "FrequencyOfTreatment" + QUALIFIER_OF_CONDITION = "QualifierOfCondition" + RELATION_OF_EXAMINATION = "RelationOfExamination" + ROUTE_OF_MEDICATION = "RouteOfMedication" + TIME_OF_CONDITION = "TimeOfCondition" + TIME_OF_EVENT = "TimeOfEvent" + TIME_OF_EXAMINATION = "TimeOfExamination" + TIME_OF_MEDICATION = "TimeOfMedication" + TIME_OF_TREATMENT = "TimeOfTreatment" + UNIT_OF_CONDITION = "UnitOfCondition" + UNIT_OF_EXAMINATION = "UnitOfExamination" + VALUE_OF_CONDITION = "ValueOfCondition" + VALUE_OF_EXAMINATION = "ValueOfExamination" + +class SentenceSentimentValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The predicted Sentiment for the sentence. + """ + + POSITIVE = "positive" + NEUTRAL = "neutral" + NEGATIVE = "negative" + +class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + NOT_STARTED = "notStarted" + RUNNING = "running" + SUCCEEDED = "succeeded" + FAILED = "failed" + REJECTED = "rejected" + CANCELLED = "cancelled" + CANCELLING = "cancelling" + PARTIALLY_COMPLETED = "partiallyCompleted" + +class StringIndexType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Returned offset and length values will correspond to TextElements (Graphemes and Grapheme + #: clusters) confirming to the Unicode 8.0.0 standard. Use this option if your application is + #: written in .Net Framework or .Net Core and you will be using StringInfo. + TEXT_ELEMENTS_V8 = "TextElements_v8" + #: Returned offset and length values will correspond to Unicode code points. Use this option if + #: your application is written in a language that support Unicode, for example Python. + UNICODE_CODE_POINT = "UnicodeCodePoint" + #: Returned offset and length values will correspond to UTF-16 code units. Use this option if your + #: application is written in a language that support Unicode, for example Java, JavaScript. + UTF16_CODE_UNIT = "Utf16CodeUnit" + +class StringIndexTypeResponse(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Returned offset and length values will correspond to TextElements (Graphemes and Grapheme + #: clusters) confirming to the Unicode 8.0.0 standard. Use this option if your application is + #: written in .Net Framework or .Net Core and you will be using StringInfo. + TEXT_ELEMENTS_V8 = "TextElements_v8" + #: Returned offset and length values will correspond to Unicode code points. Use this option if + #: your application is written in a language that support Unicode, for example Python. + UNICODE_CODE_POINT = "UnicodeCodePoint" + #: Returned offset and length values will correspond to UTF-16 code units. Use this option if your + #: application is written in a language that support Unicode, for example Java, JavaScript. + UTF16_CODE_UNIT = "Utf16CodeUnit" + +class TargetRelationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type related to the target. + """ + + ASSESSMENT = "assessment" + TARGET = "target" + +class TokenSentimentValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Targeted sentiment in the sentence. + """ + + POSITIVE = "positive" + MIXED = "mixed" + NEGATIVE = "negative" + +class WarningCodeValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Error code. + """ + + LONG_WORDS_IN_DOCUMENT = "LongWordsInDocument" + DOCUMENT_TRUNCATED = "DocumentTruncated" diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/operations/__init__.py b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/operations/__init__.py new file mode 100644 index 000000000000..4384511c0346 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/operations/__init__.py @@ -0,0 +1,13 @@ +# 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 ._text_analytics_client_operations import TextAnalyticsClientOperationsMixin + +__all__ = [ + 'TextAnalyticsClientOperationsMixin', +] diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/operations/_text_analytics_client_operations.py b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/operations/_text_analytics_client_operations.py new file mode 100644 index 000000000000..58c4d755e5db --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/operations/_text_analytics_client_operations.py @@ -0,0 +1,1081 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from ...._lro import AnalyzeBatchActionsLROPoller, AnalyzeBatchActionsLROPollingMethod, AnalyzeHealthcareEntitiesLROPoller, AnalyzeHealthcareEntitiesLROPollingMethod +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.polling.base_polling import LROBasePolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class TextAnalyticsClientOperationsMixin(object): + + def _analyze_initial( + self, + body=None, # type: Optional["_models.AnalyzeBatchInput"] + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.AnalyzeJobState"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AnalyzeJobState"]] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json, text/json" + + # Construct URL + url = self._analyze_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'AnalyzeBatchInput') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AnalyzeJobState', pipeline_response) + + if response.status_code == 202: + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _analyze_initial.metadata = {'url': '/analyze'} # type: ignore + + def begin_analyze( + self, + body=None, # type: Optional["_models.AnalyzeBatchInput"] + **kwargs # type: Any + ): + # type: (...) -> AnalyzeBatchActionsLROPoller["_models.AnalyzeJobState"] + """Submit analysis job. + + Submit a collection of text documents for analysis. Specify one or more unique tasks to be + executed. + + :param body: Collection of documents to analyze and tasks to execute. + :type body: ~azure.ai.textanalytics.v3_1_preview_4.models.AnalyzeBatchInput + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the AnalyzeBatchActionsLROPollingMethod polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AnalyzeBatchActionsLROPoller that returns either AnalyzeJobState or the result of cls(response) + :rtype: ~...._lro.AnalyzeBatchActionsLROPoller[~azure.ai.textanalytics.v3_1_preview_4.models.AnalyzeJobState] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', False) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AnalyzeJobState"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._analyze_initial( + body=body, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AnalyzeJobState', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + + if polling is True: polling_method = AnalyzeBatchActionsLROPollingMethod(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return AnalyzeBatchActionsLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AnalyzeBatchActionsLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_analyze.metadata = {'url': '/analyze'} # type: ignore + + def analyze_status( + self, + job_id, # type: str + show_stats=None, # type: Optional[bool] + top=20, # type: Optional[int] + skip=0, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> "_models.AnalyzeJobState" + """Get analysis status and results. + + Get the status of an analysis job. A job may consist of one or more tasks. Once all tasks are + completed, the job will transition to the completed state and results will be available for + each task. + + :param job_id: Job ID for Analyze. + :type job_id: str + :param show_stats: (Optional) if set to true, response will contain request and document level + statistics. + :type show_stats: bool + :param top: (Optional) Set the maximum number of results per task. When both $top and $skip are + specified, $skip is applied first. + :type top: int + :param skip: (Optional) Set the number of elements to offset in the response. When both $top + and $skip are specified, $skip is applied first. + :type skip: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AnalyzeJobState, or the result of cls(response) + :rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.AnalyzeJobState + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AnalyzeJobState"] + error_map = { + 401: ClientAuthenticationError, + 409: ResourceExistsError, + 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json, text/json" + + # Construct URL + url = self.analyze_status.metadata['url'] # type: ignore + path_format_arguments = { + 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'jobId': self._serialize.url("job_id", job_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if show_stats is not None: + query_parameters['showStats'] = self._serialize.query("show_stats", show_stats, 'bool') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=50, minimum=1) + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + deserialized = self._deserialize('AnalyzeJobState', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + analyze_status.metadata = {'url': '/analyze/jobs/{jobId}'} # type: ignore + + def health_status( + self, + job_id, # type: str + top=20, # type: Optional[int] + skip=0, # type: Optional[int] + show_stats=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> "_models.HealthcareJobState" + """Get healthcare analysis job status and results. + + Get details of the healthcare prediction job specified by the jobId. + + :param job_id: Job ID. + :type job_id: str + :param top: (Optional) Set the maximum number of results per task. When both $top and $skip are + specified, $skip is applied first. + :type top: int + :param skip: (Optional) Set the number of elements to offset in the response. When both $top + and $skip are specified, $skip is applied first. + :type skip: int + :param show_stats: (Optional) if set to true, response will contain request and document level + statistics. + :type show_stats: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HealthcareJobState, or the result of cls(response) + :rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.HealthcareJobState + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.HealthcareJobState"] + error_map = { + 401: ClientAuthenticationError, + 409: ResourceExistsError, + 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json, text/json" + + # Construct URL + url = self.health_status.metadata['url'] # type: ignore + path_format_arguments = { + 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'jobId': self._serialize.url("job_id", job_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=50, minimum=1) + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) + if show_stats is not None: + query_parameters['showStats'] = self._serialize.query("show_stats", show_stats, 'bool') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + deserialized = self._deserialize('HealthcareJobState', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + health_status.metadata = {'url': '/entities/health/jobs/{jobId}'} # type: ignore + + def _cancel_health_job_initial( + self, + job_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, + 409: ResourceExistsError, + 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json, text/json" + + # Construct URL + url = self._cancel_health_job_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'jobId': self._serialize.url("job_id", job_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _cancel_health_job_initial.metadata = {'url': '/entities/health/jobs/{jobId}'} # type: ignore + + def begin_cancel_health_job( + self, + job_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Cancel healthcare prediction job. + + Cancel healthcare prediction job. + + :param job_id: Job ID. + :type job_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the LROBasePolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', False) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._cancel_health_job_initial( + job_id=job_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'jobId': self._serialize.url("job_id", job_id, 'str'), + } + + if polling is True: polling_method = LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_cancel_health_job.metadata = {'url': '/entities/health/jobs/{jobId}'} # type: ignore + + def _health_initial( + self, + documents, # type: List["_models.MultiLanguageInput"] + model_version=None, # type: Optional[str] + string_index_type="TextElements_v8", # type: Optional[Union[str, "_models.StringIndexType"]] + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.HealthcareJobState"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.HealthcareJobState"]] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + + _input = _models.MultiLanguageBatchInput(documents=documents) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json, text/json" + + # Construct URL + url = self._health_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if model_version is not None: + query_parameters['model-version'] = self._serialize.query("model_version", model_version, 'str') + if string_index_type is not None: + query_parameters['stringIndexType'] = self._serialize.query("string_index_type", string_index_type, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_input, 'MultiLanguageBatchInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('HealthcareJobState', pipeline_response) + + if response.status_code == 202: + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _health_initial.metadata = {'url': '/entities/health/jobs'} # type: ignore + + def begin_health( + self, + documents, # type: List["_models.MultiLanguageInput"] + model_version=None, # type: Optional[str] + string_index_type="TextElements_v8", # type: Optional[Union[str, "_models.StringIndexType"]] + **kwargs # type: Any + ): + # type: (...) -> AnalyzeHealthcareEntitiesLROPoller["_models.HealthcareJobState"] + """Submit healthcare analysis job. + + Start a healthcare analysis job to recognize healthcare related entities (drugs, conditions, + symptoms, etc) and their relations. + + :param documents: The set of documents to process as part of this batch. + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.MultiLanguageInput] + :param model_version: (Optional) This value indicates which model will be used for scoring. If + a model-version is not specified, the API should default to the latest, non-preview version. + :type model_version: str + :param string_index_type: (Optional) Specifies the method used to interpret string offsets. + Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information + see https://aka.ms/text-analytics-offsets. + :type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_4.models.StringIndexType + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the AnalyzeHealthcareEntitiesLROPollingMethod polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AnalyzeHealthcareEntitiesLROPoller that returns either HealthcareJobState or the result of cls(response) + :rtype: ~...._lro.AnalyzeHealthcareEntitiesLROPoller[~azure.ai.textanalytics.v3_1_preview_4.models.HealthcareJobState] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', False) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.HealthcareJobState"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._health_initial( + documents=documents, + model_version=model_version, + string_index_type=string_index_type, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('HealthcareJobState', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + + if polling is True: polling_method = AnalyzeHealthcareEntitiesLROPollingMethod(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return AnalyzeHealthcareEntitiesLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AnalyzeHealthcareEntitiesLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_health.metadata = {'url': '/entities/health/jobs'} # type: ignore + + def entities_recognition_general( + self, + documents, # type: List["_models.MultiLanguageInput"] + model_version=None, # type: Optional[str] + show_stats=None, # type: Optional[bool] + string_index_type="TextElements_v8", # type: Optional[Union[str, "_models.StringIndexType"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.EntitiesResult" + """Named Entity Recognition. + + The API returns a list of general named entities in a given document. For the list of supported + entity types, check :code:`Supported Entity Types in Text + Analytics API`. See the :code:`Supported languages in Text + Analytics API` for the list of enabled languages. + + :param documents: The set of documents to process as part of this batch. + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.MultiLanguageInput] + :param model_version: (Optional) This value indicates which model will be used for scoring. If + a model-version is not specified, the API should default to the latest, non-preview version. + :type model_version: str + :param show_stats: (Optional) if set to true, response will contain request and document level + statistics. + :type show_stats: bool + :param string_index_type: (Optional) Specifies the method used to interpret string offsets. + Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information + see https://aka.ms/text-analytics-offsets. + :type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_4.models.StringIndexType + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EntitiesResult, or the result of cls(response) + :rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.EntitiesResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EntitiesResult"] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + + _input = _models.MultiLanguageBatchInput(documents=documents) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json, text/json" + + # Construct URL + url = self.entities_recognition_general.metadata['url'] # type: ignore + path_format_arguments = { + 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if model_version is not None: + query_parameters['model-version'] = self._serialize.query("model_version", model_version, 'str') + if show_stats is not None: + query_parameters['showStats'] = self._serialize.query("show_stats", show_stats, 'bool') + if string_index_type is not None: + query_parameters['stringIndexType'] = self._serialize.query("string_index_type", string_index_type, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_input, 'MultiLanguageBatchInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + deserialized = self._deserialize('EntitiesResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + entities_recognition_general.metadata = {'url': '/entities/recognition/general'} # type: ignore + + def entities_recognition_pii( + self, + documents, # type: List["_models.MultiLanguageInput"] + model_version=None, # type: Optional[str] + show_stats=None, # type: Optional[bool] + domain=None, # type: Optional[str] + string_index_type="TextElements_v8", # type: Optional[Union[str, "_models.StringIndexType"]] + pii_categories=None, # type: Optional[List[Union[str, "_models.PiiCategory"]]] + **kwargs # type: Any + ): + # type: (...) -> "_models.PiiResult" + """Entities containing personal information. + + The API returns a list of entities with personal information (\"SSN\", \"Bank Account\" etc) in + the document. For the list of supported entity types, check :code:`Supported Entity Types in Text Analytics API`. See the + :code:`Supported languages in Text Analytics API` for the + list of enabled languages. + + :param documents: The set of documents to process as part of this batch. + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.MultiLanguageInput] + :param model_version: (Optional) This value indicates which model will be used for scoring. If + a model-version is not specified, the API should default to the latest, non-preview version. + :type model_version: str + :param show_stats: (Optional) if set to true, response will contain request and document level + statistics. + :type show_stats: bool + :param domain: (Optional) if specified, will set the PII domain to include only a subset of the + entity categories. Possible values include: 'PHI', 'none'. + :type domain: str + :param string_index_type: (Optional) Specifies the method used to interpret string offsets. + Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information + see https://aka.ms/text-analytics-offsets. + :type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_4.models.StringIndexType + :param pii_categories: (Optional) describes the PII categories to return. + :type pii_categories: list[str or ~azure.ai.textanalytics.v3_1_preview_4.models.PiiCategory] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PiiResult, or the result of cls(response) + :rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.PiiResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PiiResult"] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + + _input = _models.MultiLanguageBatchInput(documents=documents) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json, text/json" + + # Construct URL + url = self.entities_recognition_pii.metadata['url'] # type: ignore + path_format_arguments = { + 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if model_version is not None: + query_parameters['model-version'] = self._serialize.query("model_version", model_version, 'str') + if show_stats is not None: + query_parameters['showStats'] = self._serialize.query("show_stats", show_stats, 'bool') + if domain is not None: + query_parameters['domain'] = self._serialize.query("domain", domain, 'str') + if string_index_type is not None: + query_parameters['stringIndexType'] = self._serialize.query("string_index_type", string_index_type, 'str') + if pii_categories is not None: + query_parameters['piiCategories'] = self._serialize.query("pii_categories", pii_categories, '[str]', div=',') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_input, 'MultiLanguageBatchInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + deserialized = self._deserialize('PiiResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + entities_recognition_pii.metadata = {'url': '/entities/recognition/pii'} # type: ignore + + def entities_linking( + self, + documents, # type: List["_models.MultiLanguageInput"] + model_version=None, # type: Optional[str] + show_stats=None, # type: Optional[bool] + string_index_type="TextElements_v8", # type: Optional[Union[str, "_models.StringIndexType"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.EntityLinkingResult" + """Linked entities from a well known knowledge base. + + The API returns a list of recognized entities with links to a well known knowledge base. See + the :code:`Supported languages in Text Analytics API` for + the list of enabled languages. + + :param documents: The set of documents to process as part of this batch. + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.MultiLanguageInput] + :param model_version: (Optional) This value indicates which model will be used for scoring. If + a model-version is not specified, the API should default to the latest, non-preview version. + :type model_version: str + :param show_stats: (Optional) if set to true, response will contain request and document level + statistics. + :type show_stats: bool + :param string_index_type: (Optional) Specifies the method used to interpret string offsets. + Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information + see https://aka.ms/text-analytics-offsets. + :type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_4.models.StringIndexType + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EntityLinkingResult, or the result of cls(response) + :rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.EntityLinkingResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EntityLinkingResult"] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + + _input = _models.MultiLanguageBatchInput(documents=documents) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json, text/json" + + # Construct URL + url = self.entities_linking.metadata['url'] # type: ignore + path_format_arguments = { + 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if model_version is not None: + query_parameters['model-version'] = self._serialize.query("model_version", model_version, 'str') + if show_stats is not None: + query_parameters['showStats'] = self._serialize.query("show_stats", show_stats, 'bool') + if string_index_type is not None: + query_parameters['stringIndexType'] = self._serialize.query("string_index_type", string_index_type, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_input, 'MultiLanguageBatchInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + deserialized = self._deserialize('EntityLinkingResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + entities_linking.metadata = {'url': '/entities/linking'} # type: ignore + + def key_phrases( + self, + documents, # type: List["_models.MultiLanguageInput"] + model_version=None, # type: Optional[str] + show_stats=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> "_models.KeyPhraseResult" + """Key Phrases. + + The API returns a list of strings denoting the key phrases in the input text. See the :code:`Supported languages in Text Analytics API` for the list of + enabled languages. + + :param documents: The set of documents to process as part of this batch. + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.MultiLanguageInput] + :param model_version: (Optional) This value indicates which model will be used for scoring. If + a model-version is not specified, the API should default to the latest, non-preview version. + :type model_version: str + :param show_stats: (Optional) if set to true, response will contain request and document level + statistics. + :type show_stats: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyPhraseResult, or the result of cls(response) + :rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.KeyPhraseResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyPhraseResult"] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + + _input = _models.MultiLanguageBatchInput(documents=documents) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json, text/json" + + # Construct URL + url = self.key_phrases.metadata['url'] # type: ignore + path_format_arguments = { + 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if model_version is not None: + query_parameters['model-version'] = self._serialize.query("model_version", model_version, 'str') + if show_stats is not None: + query_parameters['showStats'] = self._serialize.query("show_stats", show_stats, 'bool') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_input, 'MultiLanguageBatchInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + deserialized = self._deserialize('KeyPhraseResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + key_phrases.metadata = {'url': '/keyPhrases'} # type: ignore + + def languages( + self, + documents, # type: List["_models.LanguageInput"] + model_version=None, # type: Optional[str] + show_stats=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> "_models.LanguageResult" + """Detect Language. + + The API returns the detected language and a numeric score between 0 and 1. Scores close to 1 + indicate 100% certainty that the identified language is true. See the :code:`Supported languages in Text Analytics API` for the list of + enabled languages. + + :param documents: + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.LanguageInput] + :param model_version: (Optional) This value indicates which model will be used for scoring. If + a model-version is not specified, the API should default to the latest, non-preview version. + :type model_version: str + :param show_stats: (Optional) if set to true, response will contain request and document level + statistics. + :type show_stats: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LanguageResult, or the result of cls(response) + :rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.LanguageResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LanguageResult"] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + + _input = _models.LanguageBatchInput(documents=documents) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json, text/json" + + # Construct URL + url = self.languages.metadata['url'] # type: ignore + path_format_arguments = { + 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if model_version is not None: + query_parameters['model-version'] = self._serialize.query("model_version", model_version, 'str') + if show_stats is not None: + query_parameters['showStats'] = self._serialize.query("show_stats", show_stats, 'bool') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_input, 'LanguageBatchInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + deserialized = self._deserialize('LanguageResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + languages.metadata = {'url': '/languages'} # type: ignore + + def sentiment( + self, + documents, # type: List["_models.MultiLanguageInput"] + model_version=None, # type: Optional[str] + show_stats=None, # type: Optional[bool] + opinion_mining=None, # type: Optional[bool] + string_index_type="TextElements_v8", # type: Optional[Union[str, "_models.StringIndexType"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.SentimentResponse" + """Sentiment. + + The API returns a detailed sentiment analysis for the input text. The analysis is done in + multiple levels of granularity, start from the a document level, down to sentence and key terms + (targets and assessments). + + :param documents: The set of documents to process as part of this batch. + :type documents: list[~azure.ai.textanalytics.v3_1_preview_4.models.MultiLanguageInput] + :param model_version: (Optional) This value indicates which model will be used for scoring. If + a model-version is not specified, the API should default to the latest, non-preview version. + :type model_version: str + :param show_stats: (Optional) if set to true, response will contain request and document level + statistics. + :type show_stats: bool + :param opinion_mining: (Optional) if set to true, response will contain not only sentiment + prediction but also opinion mining (aspect-based sentiment analysis) results. + :type opinion_mining: bool + :param string_index_type: (Optional) Specifies the method used to interpret string offsets. + Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information + see https://aka.ms/text-analytics-offsets. + :type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_4.models.StringIndexType + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SentimentResponse, or the result of cls(response) + :rtype: ~azure.ai.textanalytics.v3_1_preview_4.models.SentimentResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SentimentResponse"] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + + _input = _models.MultiLanguageBatchInput(documents=documents) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json, text/json" + + # Construct URL + url = self.sentiment.metadata['url'] # type: ignore + path_format_arguments = { + 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if model_version is not None: + query_parameters['model-version'] = self._serialize.query("model_version", model_version, 'str') + if show_stats is not None: + query_parameters['showStats'] = self._serialize.query("show_stats", show_stats, 'bool') + if opinion_mining is not None: + query_parameters['opinionMining'] = self._serialize.query("opinion_mining", opinion_mining, 'bool') + if string_index_type is not None: + query_parameters['stringIndexType'] = self._serialize.query("string_index_type", string_index_type, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_input, 'MultiLanguageBatchInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + deserialized = self._deserialize('SentimentResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + sentiment.metadata = {'url': '/sentiment'} # type: ignore diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/py.typed b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1_preview_4/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_lro.py b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_lro.py index bd7f33b54ec6..ceb2c66ee5e6 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_lro.py +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_lro.py @@ -186,8 +186,8 @@ class AnalyzeBatchActionsLROPollingMethod(TextAnalyticsLROPollingMethod): @property def _current_body(self): - from ._generated.v3_1_preview_3.models import JobMetadata - return JobMetadata.deserialize(self._pipeline_response) + from ._generated.v3_1_preview_3.models import AnalyzeJobMetadata + return AnalyzeJobMetadata.deserialize(self._pipeline_response) @property def created_on(self):