diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/CHANGELOG.md b/sdk/cognitivelanguage/azure-ai-textanalytics/CHANGELOG.md index 90e255b0ff80..e22991a79196 100644 --- a/sdk/cognitivelanguage/azure-ai-textanalytics/CHANGELOG.md +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 6.0.0b3 (2026-06-08) + +skip changelog generation for data-plane package and please add changelog manually. + ## 6.0.0b2 (2025-11-06) This version of the client library defaults to the service API version `2025-11-15-preview`. diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/_metadata.json b/sdk/cognitivelanguage/azure-ai-textanalytics/_metadata.json index 509044270b48..7f60016c5224 100644 --- a/sdk/cognitivelanguage/azure-ai-textanalytics/_metadata.json +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/_metadata.json @@ -1,3 +1,10 @@ { - "apiVersion": "2025-11-15-preview" + "apiVersion": "2026-05-15-preview", + "apiVersions": { + "Language.Text": "2026-05-15-preview" + }, + "commit": "04869e1f580276ee3e7e51b74dd7e23df50902b8", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "typespec_src": "specification/cognitiveservices/data-plane/LanguageAnalyzeText", + "emitterVersion": "0.63.0" } \ No newline at end of file diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/apiview-properties.json b/sdk/cognitivelanguage/azure-ai-textanalytics/apiview-properties.json index d8345022e36c..1972d8aa7118 100644 --- a/sdk/cognitivelanguage/azure-ai-textanalytics/apiview-properties.json +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/apiview-properties.json @@ -200,5 +200,6 @@ "azure.ai.textanalytics.aio.TextAnalysisClient.begin_analyze_text_job": "Language.Text.analyzeTextSubmitJob", "azure.ai.textanalytics.TextAnalysisClient.begin_cancel_job": "Language.Text.analyzeTextCancelJob", "azure.ai.textanalytics.aio.TextAnalysisClient.begin_cancel_job": "Language.Text.analyzeTextCancelJob" - } + }, + "CrossLanguageVersion": "16251edc0967" } \ No newline at end of file diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/_client.py b/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/_client.py index 21df77db5868..1c9ce86d0537 100644 --- a/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/_client.py +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/_client.py @@ -8,8 +8,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, TYPE_CHECKING, Union -from typing_extensions import Self from azure.core import PipelineClient from azure.core.credentials import AzureKeyCredential @@ -20,6 +20,11 @@ from ._operations import _TextAnalysisClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials import TokenCredential @@ -39,8 +44,9 @@ class TextAnalysisClient(_TextAnalysisClientOperationsMixin): credential type or a token credential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential - :keyword api_version: The API version to use for this operation. Default value is - "2025-11-15-preview". Note that overriding this default value may result in unsupported + :keyword api_version: The API version to use for this operation. Known values are + "2026-05-15-preview" and None. Default value is None. If not set, the operation's default API + version will be used. Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/_configuration.py b/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/_configuration.py index 9b65c7d64d35..f47f98e4a5ca 100644 --- a/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/_configuration.py +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/_configuration.py @@ -30,14 +30,15 @@ class TextAnalysisClientConfiguration: # pylint: disable=too-many-instance-attr credential type or a token credential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential - :keyword api_version: The API version to use for this operation. Default value is - "2025-11-15-preview". Note that overriding this default value may result in unsupported + :keyword api_version: The API version to use for this operation. Known values are + "2026-05-15-preview" and None. Default value is None. If not set, the operation's default API + version will be used. Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2025-11-15-preview") + api_version: str = kwargs.pop("api_version", "2026-05-15-preview") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/_operations/_operations.py b/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/_operations/_operations.py index 361efb3e6a6c..527e20421491 100644 --- a/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/_operations/_operations.py +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/_operations/_operations.py @@ -48,7 +48,7 @@ def build_text_analysis_analyze_text_request(*, show_stats: Optional[bool] = Non _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +78,7 @@ def build_text_analysis_get_job_status_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +109,7 @@ def build_text_analysis_analyze_text_job_request(**kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-15-preview")) # Construct URL _url = "/analyze-text/jobs" @@ -126,7 +126,7 @@ def build_text_analysis_analyze_text_job_request(**kwargs: Any) -> HttpRequest: def build_text_analysis_cancel_job_request(job_id: str, **kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-15-preview")) # Construct URL _url = "/analyze-text/jobs/{jobId}:cancel" path_format_arguments = { @@ -266,6 +266,7 @@ def analyze_text( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -287,7 +288,7 @@ def analyze_text( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.AnalyzeTextResult, response.json()) @@ -354,6 +355,7 @@ def get_job_status( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -375,7 +377,7 @@ def get_job_status( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.AnalyzeTextOperationState, response.json()) @@ -441,6 +443,7 @@ def _analyze_text_job_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -463,7 +466,7 @@ def _analyze_text_job_initial( response_headers = {} response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -647,6 +650,7 @@ def _cancel_job_initial(self, job_id: str, **kwargs: Any) -> Iterator[bytes]: } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -669,7 +673,7 @@ def _cancel_job_initial(self, job_id: str, **kwargs: Any) -> Iterator[bytes]: response_headers = {} response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/_patch.py b/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/_patch.py index 155c134188dd..87676c65a8f0 100644 --- a/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/_patch.py +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/_patch.py @@ -1,4 +1,3 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,334 +7,9 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -import json -from typing import Any, Callable, Dict, IO, Mapping, Optional, TypeVar, Union, cast, overload, Generic, TYPE_CHECKING -from collections.abc import MutableMapping # pylint:disable=import-error -from urllib.parse import urlparse -from azure.core.exceptions import HttpResponseError -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.polling.base_polling import LROBasePolling -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.core.credentials import AzureKeyCredential -from azure.core.paging import ItemPaged -from ._client import TextAnalysisClient as AnalysisTextClientGenerated -from . import models as _models -from .models import AnalyzeTextOperationState, TextActions # convenience re-exports if present -from ._utils.serialization import Serializer - -if TYPE_CHECKING: - from azure.core.credentials import TokenCredential - -JSON = MutableMapping[str, Any] -_Unset: Any = object() -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def _parse_operation_id(op_loc: Optional[str]) -> Optional[str]: - """Extract the operation ID from an Operation-Location URL. - - :param op_loc: The ``Operation-Location`` header value or URL to parse. - If ``None`` or malformed, no ID can be extracted. - :type op_loc: Optional[str] - :return: The trailing path segment as the operation ID, or ``None`` if not found. - :rtype: Optional[str] - """ - if not op_loc: - return None - path = urlparse(op_loc).path.rstrip("/") - if "/" not in path: - return None - return path.rsplit("/", 1)[-1] - - -PollingReturnType_co = TypeVar("PollingReturnType_co", covariant=True) - - -class AnalyzeTextLROPoller(LROPoller[PollingReturnType_co], Generic[PollingReturnType_co]): - """Custom poller that returns PollingReturnType_co and exposes operation metadata.""" - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - self._last_state: Optional[AnalyzeTextOperationState] = None # set by deserializer - - # internal: called by the deserializer to update details() - def _record_state_for_details(self, state: AnalyzeTextOperationState) -> None: - self._last_state = state - - @property - def details(self) -> Mapping[str, Any]: - """Metadata associated with the long-running operation. - - :return: A mapping with keys like ``operation_id`` and, when available, - ``status``, ``job_id``, ``display_name``, ``created_at``, - ``last_updated_at``, ``expires_on``, ``statistics``, - ``errors``, and ``next_link``. - :rtype: Mapping[str, Any] - """ - try: - headers = getattr(self.polling_method(), "_initial_response").http_response.headers # type: ignore[attr-defined] - op_loc = headers.get("Operation-Location") or headers.get("operation-location") - except (AttributeError, TypeError): - op_loc = None - - info: Dict[str, Any] = {"operation_id": _parse_operation_id(op_loc)} - if self._last_state is not None: - s = self._last_state - info.update( - { - "status": s.status, - "job_id": s.job_id, - "display_name": s.display_name, - "created_at": s.created_at, - "last_updated_at": s.last_updated_at, - "expires_on": s.expires_on, - "statistics": s.statistics, - "errors": s.errors, - "next_link": s.next_link, - } - ) - return info - - @classmethod - def from_continuation_token( - cls, - polling_method: PollingMethod[PollingReturnType_co], - continuation_token: str, - **kwargs: Any, - ) -> "AnalyzeTextLROPoller[PollingReturnType_co]": - client, initial_response, deserialization_callback = polling_method.from_continuation_token( - continuation_token, **kwargs - ) - return cls(client, initial_response, deserialization_callback, polling_method) - - -class TextAnalysisClient(AnalysisTextClientGenerated): - def __init__( - self, - endpoint: str, - credential: Union[AzureKeyCredential, "TokenCredential"], - *, - api_version: Optional[str] = None, - **kwargs: Any, - ) -> None: - """Create a TextAnalysisClient. - :param endpoint: Supported Cognitive Services endpoint. - :type endpoint: str - :param credential: Key or token credential. - :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential - :keyword api_version: The API version to use for this operation. Default value is - "2025-05-15-preview". Note that overriding this default value may result in unsupported - behavior. - :paramtype api_version: str` - """ - if api_version is not None: - kwargs["api_version"] = api_version - super().__init__(endpoint=endpoint, credential=credential, **kwargs) - - @overload # type: ignore[override] - def begin_analyze_text_job( - self, - *, - text_input: _models.MultiLanguageTextInput, - actions: list[_models.AnalyzeTextOperationAction], - content_type: str = "application/json", - display_name: Optional[str] = None, - default_language: Optional[str] = None, - cancel_after: Optional[float] = None, - **kwargs: Any, - ) -> AnalyzeTextLROPoller[ItemPaged["TextActions"]]: - """Submit a collection of text documents for analysis. Specify one or more unique tasks to be - executed as a long-running operation. - - :keyword text_input: Contains the input to be analyzed. Required. - :paramtype text_input: ~azure.ai.textanalytics.models.MultiLanguageTextInput - :keyword actions: List of tasks to be performed as part of the LRO. Required. - :paramtype actions: list[~azure.ai.textanalytics.models.AnalyzeTextOperationAction] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword display_name: Name for the task. Default value is None. - :paramtype display_name: str - :keyword default_language: Default language to use for records requesting automatic language - detection. Default value is None. - :paramtype default_language: str - :keyword cancel_after: Optional duration in seconds after which the job will be canceled if not - completed. Default value is None. - :paramtype cancel_after: float - :return: A poller whose ``result()`` yields ``ItemPaged[TextActions]`` and exposes metadata via ``.details``. - :rtype: ~azure.ai.textanalytics.AnalyzeTextLROPoller[ - ~azure.core.paging.ItemPaged[~azure.ai.textanalytics.models.TextActions]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_analyze_text_job( # type: ignore[override] - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AnalyzeTextLROPoller[ItemPaged["TextActions"]]: - """Submit a collection of text documents for analysis. Specify one or more unique tasks to be - executed as a long-running operation. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: A poller whose ``result()`` yields ``ItemPaged[TextActions]`` and exposes metadata via ``.details``. - :rtype: ~azure.ai.textanalytics.AnalyzeTextLROPoller[ - ~azure.core.paging.ItemPaged[~azure.ai.textanalytics.models.TextActions]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_analyze_text_job( # type: ignore[override] - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AnalyzeTextLROPoller[ItemPaged["TextActions"]]: - """Submit a collection of text documents for analysis. Specify one or more unique tasks to be - executed as a long-running operation. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: A poller whose ``result()`` yields ``ItemPaged[TextActions]`` and exposes metadata via ``.details``. - :rtype: ~azure.ai.textanalytics.AnalyzeTextLROPoller[ - ~azure.core.paging.ItemPaged[~azure.ai.textanalytics.models.TextActions]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_analyze_text_job( # type: ignore[override] - self, - body: Union[JSON, IO[bytes]] = _Unset, - *, - text_input: _models.MultiLanguageTextInput = _Unset, - actions: list[_models.AnalyzeTextOperationAction] = _Unset, - display_name: Optional[str] = None, - default_language: Optional[str] = None, - cancel_after: Optional[float] = None, - **kwargs: Any, - ) -> AnalyzeTextLROPoller[ItemPaged["TextActions"]]: - """Submit a collection of text documents for analysis. Specify one or more unique tasks to be - executed as a long-running operation. - - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword text_input: Contains the input to be analyzed. Required. - :paramtype text_input: ~azure.ai.textanalytics.models.MultiLanguageTextInput - :keyword actions: List of tasks to be performed as part of the LRO. Required. - :paramtype actions: list[~azure.ai.textanalytics.models.AnalyzeTextOperationAction] - :keyword display_name: Name for the task. Default value is None. - :paramtype display_name: str - :keyword default_language: Default language to use for records requesting automatic language - detection. Default value is None. - :paramtype default_language: str - :keyword cancel_after: Optional duration in seconds after which the job will be canceled if not - completed. Default value is None. - :paramtype cancel_after: float - :return: A poller whose ``result()`` yields ``ItemPaged[TextActions]`` and exposes metadata via ``.details``. - :rtype: ~azure.ai.textanalytics.AnalyzeTextLROPoller[ - ~azure.core.paging.ItemPaged[~azure.ai.textanalytics.models.TextActions]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - polling: Union[bool, PollingMethod[ItemPaged["TextActions"]]] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - cls: ClsType[ItemPaged["TextActions"]] = kwargs.pop("cls", None) - kwargs.pop("error_map", None) - - path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - def _fetch_state_by_next_link(next_link: str) -> AnalyzeTextOperationState: - req = HttpRequest("GET", next_link) - resp = self._client.send_request(req) # type: ignore[attr-defined] - if resp.status_code != 200: - raise HttpResponseError(response=resp) - data = json.loads(resp.text()) - return AnalyzeTextOperationState(data) - - def _build_pager_from_state(state: AnalyzeTextOperationState) -> ItemPaged["TextActions"]: - def extract_data(s: AnalyzeTextOperationState): - next_link = s.next_link - actions_payload: TextActions = s.actions - return next_link, [actions_payload] - - def get_next(token: Optional[str]) -> Optional[AnalyzeTextOperationState]: - if token is None: # First call → return the initial state - return state - if not token: # No nextLink → stop iteration - return None - return _fetch_state_by_next_link(token) # Fetch next page - - return ItemPaged(get_next, extract_data) - - poller_holder: Dict[str, AnalyzeTextLROPoller[ItemPaged["TextActions"]]] = {} - - def get_long_running_output(pipeline_response: PipelineResponse[HttpRequest, HttpResponse]): - final_response = pipeline_response.http_response - if final_response.status_code == 200: - data = json.loads(final_response.text()) - op_state = AnalyzeTextOperationState(data) - poller_ref = poller_holder["poller"] - poller_ref._record_state_for_details(op_state) # pylint: disable=protected-access - paged = _build_pager_from_state(op_state) - return cls(pipeline_response, paged, {}) if cls else paged - raise HttpResponseError(response=final_response) - - if polling is True: - polling_method: PollingMethod[ItemPaged["TextActions"]] = cast( - PollingMethod[ItemPaged["TextActions"]], - LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs), - ) - elif polling is False: - polling_method = cast(PollingMethod[ItemPaged["TextActions"]], NoPolling()) - else: - polling_method = cast(PollingMethod[ItemPaged["TextActions"]], polling) - - if cont_token: - return AnalyzeTextLROPoller[ItemPaged["TextActions"]].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - ) - - initial_kwargs = dict( # pylint:disable=use-dict-literal - text_input=text_input, - actions=actions, - display_name=display_name, - default_language=default_language, - cancel_after=cancel_after, - content_type=content_type, - cls=lambda x, y, z: x, # passthrough raw pipeline response - headers=_headers, - params=_params, - **kwargs, - ) - if body is not _Unset and body is not None: - initial_kwargs["body"] = body - - raw_result = self._analyze_text_job_initial(**initial_kwargs) - raw_result.http_response.read() # type: ignore[attr-defined] - - lro: AnalyzeTextLROPoller[ItemPaged["TextActions"]] = AnalyzeTextLROPoller( - self._client, raw_result, get_long_running_output, polling_method - ) - poller_holder["poller"] = lro - return lro +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): @@ -345,6 +19,3 @@ def patch_sdk(): you can't accomplish using the techniques described in https://aka.ms/azsdk/python/dpcodegen/python/customize """ - - -__all__ = ["TextAnalysisClient", "AnalyzeTextLROPoller"] diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/_utils/model_base.py b/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/_utils/model_base.py index 097f8197cfd9..bd5b9caf1022 100644 --- a/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/_utils/model_base.py +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -515,6 +520,8 @@ def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: return self._data.setdefault(key, default) def __eq__(self, other: typing.Any) -> bool: + if isinstance(other, _MyMutableMapping): + return self._data == other._data try: other_model = self.__class__(other) except Exception: @@ -583,6 +590,239 @@ def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typin return _serialize(value, rf._format) +# ============================================================================ +# Fast-path scalar deserializer functions for rest_field(deserializer=...) +# These are referenced from rest_field declarations to bypass the generic +# _deserialize -> _deserialize_with_callable chain. +# Only simple/primitive types — no models or container types. +# ============================================================================ + + +def _xml_deser_str(value): + if isinstance(value, ET.Element): + return value.text or "" + return str(value) if value is not None else None + + +def _xml_deser_int(value): + if isinstance(value, ET.Element): + return int(value.text) if value.text else None + return int(value) if value is not None else None + + +def _xml_deser_float(value): + if isinstance(value, ET.Element): + return float(value.text) if value.text else None + return float(value) if value is not None else None + + +def _xml_deser_bool(value): + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + if text in (True, False): + return text + return text.lower() == "true" + + +# pylint: disable=docstring-missing-param +def _xml_deser_bytes(value): + """Deserialize bytes from XML (base64).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_bytes(text) + + +def _xml_deser_bytes_base64url(value): + """Deserialize bytes from XML (base64url).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_bytes_base64(text) + + +def _xml_deser_datetime(value): + """Deserialize a datetime from XML (ISO 8601 / rfc3339).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime(text) + + +def _xml_deser_datetime_rfc7231(value): + """Deserialize a datetime from XML (RFC7231 format).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime_rfc7231(text) + + +def _xml_deser_datetime_unix_timestamp(value): + """Deserialize a datetime from XML (Unix timestamp).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime_unix_timestamp(float(text)) + + +def _xml_deser_date(value): + """Deserialize a date from XML (ISO 8601).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_date(text) + + +def _xml_deser_time(value): + """Deserialize a time from XML (ISO 8601).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_time(text) + + +def _xml_deser_duration(value): + """Deserialize a timedelta from XML (ISO 8601 duration).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_duration(text) + + +def _xml_deser_decimal(value): + """Deserialize a Decimal from XML.""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_decimal(text) + + +def _xml_deser_enum_or_str(enum_cls, value): + """Deserialize a Union[EnumType, str] from XML.""" + text = value.text if isinstance(value, ET.Element) else value + if text is None: + return None + try: + return enum_cls(text) + except ValueError: + return text + + +def _extract_xml_model_type(rf_type): + """Extract the concrete Model class from a resolved rf._type partial chain. + + Unwraps ``Optional[Model]`` and ``_deserialize_model(Model, ...)`` + wrappers. Only handles Model and Optional[Model] — other composite + types (List, Dict, Union, etc.) return None and fall through to the + generic ``_deserialize`` path at runtime. + """ + if rf_type is None: + return None + if isinstance(rf_type, type) and _is_model(rf_type): + return rf_type + if not isinstance(rf_type, functools.partial): + return None + func = rf_type.func + args = rf_type.args + if func is _deserialize_with_optional and args: + return _extract_xml_model_type(args[0]) + if func is _deserialize_model and args: + cls = args[0] + return cls if isinstance(cls, type) and _is_model(cls) else None + return None + + +def _build_xml_field_plan( # pylint: disable=docstring-missing-return, docstring-missing-rtype, unused-variable + cls, attr_to_rest_field: dict +) -> list: + """Build a precomputed XML field plan for fast _init_from_xml iteration. + + Called once per model class in __new__. Returns a list of tuples: + (rest_name, xml_name, kind, deser, rf_type, is_optional, items_name) + + kind: 0=wrapped, 1=attribute, 2=unwrapped, 3=text + + For Model and Optional[Model] fields that lack a scalar + ``_deserializer``, this function precomputes the Model class as the + deserializer so ``_init_from_xml`` can call ``ModelClass(element)`` + directly instead of going through the expensive + ``_get_deserialize_callable_from_annotation`` chain at runtime. + """ + model_meta = getattr(cls, "_xml", {}) + model_ns = model_meta.get("ns") or model_meta.get("namespace") + plan = [] + + for rf in attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + deser = rf._deserializer + + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + is_optional = rf._is_optional + + # For Model / Optional[Model] fields without a scalar deserializer, + # precompute the Model class as the deserializer. + if deser is None and rf._type is not None: + model_cls = _extract_xml_model_type(rf._type) + if model_cls is not None: + deser = model_cls + + if prop_meta.get("attribute", False): + plan.append((rf._rest_name, xml_name, 1, deser, rf._type, is_optional, None)) + elif prop_meta.get("unwrapped", False): + items_name = prop_meta.get("itemsName") + if items_name: + items_ns = prop_meta.get("itemsNs") + if items_ns is not None: + xml_ns = items_ns + if xml_ns: + items_name = "{" + xml_ns + "}" + items_name + else: + items_name = xml_name + plan.append((rf._rest_name, xml_name, 2, deser, rf._type, is_optional, items_name)) + elif prop_meta.get("text", False): + plan.append((rf._rest_name, xml_name, 3, deser, rf._type, is_optional, None)) + else: + plan.append((rf._rest_name, xml_name, 0, deser, rf._type, is_optional, None)) + + return plan + + +# pylint: enable=docstring-missing-param class Model(_MyMutableMapping): _is_model = True # label whether current class's _attr_to_rest_field has been calculated @@ -593,59 +833,10 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } - if args: # pylint: disable=too-many-nested-blocks + dict_to_pass: dict[str, typing.Any] = {} + if args: if isinstance(args[0], ET.Element): - existed_attr_keys = [] - model_meta = getattr(self, "_xml", {}) - - for rf in self._attr_to_rest_field.values(): - prop_meta = getattr(rf, "_xml", {}) - xml_name = prop_meta.get("name", rf._rest_name) - xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - - # attribute - if prop_meta.get("attribute", False) and args[0].get(xml_name) is not None: - existed_attr_keys.append(xml_name) - dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].get(xml_name)) - continue - - # unwrapped element is array - if prop_meta.get("unwrapped", False): - # unwrapped array could either use prop items meta/prop meta - if prop_meta.get("itemsName"): - xml_name = prop_meta.get("itemsName") - xml_ns = prop_meta.get("itemNs") - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - items = args[0].findall(xml_name) # pyright: ignore - if len(items) > 0: - existed_attr_keys.append(xml_name) - dict_to_pass[rf._rest_name] = _deserialize(rf._type, items) - continue - - # text element is primitive type - if prop_meta.get("text", False): - if args[0].text is not None: - dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].text) - continue - - # wrapped element could be normal property or array, it should only have one element - item = args[0].find(xml_name) - if item is not None: - existed_attr_keys.append(xml_name) - dict_to_pass[rf._rest_name] = _deserialize(rf._type, item) - - # rest thing is additional properties - for e in args[0]: - if e.tag not in existed_attr_keys: - dict_to_pass[e.tag] = _convert_element(e) + dict_to_pass.update(self._init_from_xml(args[0])) else: dict_to_pass.update( {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} @@ -662,8 +853,117 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: if v is not None } ) + # Apply client default values for fields the caller didn't set so that + # defaults are part of `_data` and therefore included during serialization. + for rf in self._attr_to_rest_field.values(): + if rf._default is _UNSET: + continue + if rf._rest_name in dict_to_pass: + continue + dict_to_pass[rf._rest_name] = _create_value(rf, rf._default) super().__init__(dict_to_pass) + def _init_from_xml( # pylint: disable=too-many-branches, too-many-statements + self, element: ET.Element + ) -> dict[str, typing.Any]: + """Deserialize an XML element into a dict mapping rest field names to values. + + :param ET.Element element: The XML element to deserialize from. + :returns: A dictionary of rest_name to deserialized value pairs. + :rtype: dict + """ + result: dict[str, typing.Any] = {} + existed_attr_keys: list[str] = [] + + field_plan = getattr(self, "_xml_field_plan", None) + if field_plan: + for rest_name, xml_name, kind, deser, rf_type, is_optional, items_name in field_plan: + if kind == 0: # wrapped element (most common) + item = element.find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + if deser: + result[rest_name] = deser(item) + else: + result[rest_name] = _deserialize(rf_type, item) + elif kind == 1: # attribute + attr_val = element.get(xml_name) + if attr_val is not None: + existed_attr_keys.append(xml_name) + if deser: + result[rest_name] = deser(attr_val) + else: + result[rest_name] = attr_val + elif kind == 2: # unwrapped array + items = element.findall(items_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(items_name) + if deser: + result[rest_name] = deser(items) + else: + result[rest_name] = _deserialize(rf_type, items) + elif not is_optional: + existed_attr_keys.append(items_name) + result[rest_name] = [] + elif kind == 3: # text + if element.text is not None: + if deser: + result[rest_name] = deser(element.text) + else: + result[rest_name] = element.text + else: + model_meta = getattr(self, "_xml", {}) + for rf in self._attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + # attribute + if prop_meta.get("attribute", False) and element.get(xml_name) is not None: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, element.get(xml_name)) + continue + + # unwrapped element is array + if prop_meta.get("unwrapped", False): + _items_name = prop_meta.get("itemsName") + if _items_name: + xml_name = _items_name + _items_ns = prop_meta.get("itemsNs") + if _items_ns is not None: + xml_ns = _items_ns + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + items = element.findall(xml_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, items) + elif not rf._is_optional: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = [] + continue + + # text element is primitive type + if prop_meta.get("text", False): + if element.text is not None: + result[rf._rest_name] = _deserialize(rf._type, element.text) + continue + + # wrapped element could be normal property or array + item = element.find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, item) + + # rest thing is additional properties + for e in element: + if e.tag not in existed_attr_keys: + result[e.tag] = _convert_element(e) + + return result + def copy(self) -> "Model": return Model(self.__dict__) @@ -692,6 +992,9 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: Model._get_backcompat_attribute_name(cls._attr_to_rest_field, attr): rf for attr, rf in cls._attr_to_rest_field.items() } + # Build XML field plan for fast _init_from_xml (only for XML models) + if getattr(cls, "_xml", None): + cls._xml_field_plan = _build_xml_field_plan(cls, attr_to_rest_field) cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") return super().__new__(cls) @@ -730,7 +1033,7 @@ def _deserialize(cls, data, exist_discriminators): model_meta = getattr(cls, "_xml", {}) prop_meta = getattr(discriminator, "_xml", {}) xml_name = prop_meta.get("name", discriminator._rest_name) - xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) if xml_ns: xml_name = "{" + xml_ns + "}" + xml_name @@ -822,6 +1125,14 @@ def _deserialize_multiple_sequence( return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) +def _is_array_encoded_deserializer(deserializer: functools.partial) -> bool: + return ( + isinstance(deserializer, functools.partial) + and isinstance(deserializer.args[0], functools.partial) + and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable + ) + + def _deserialize_sequence( deserializer: typing.Optional[typing.Callable], module: typing.Optional[str], @@ -831,17 +1142,19 @@ def _deserialize_sequence( return obj if isinstance(obj, ET.Element): obj = list(obj) - try: - if ( - isinstance(obj, str) - and isinstance(deserializer, functools.partial) - and isinstance(deserializer.args[0], functools.partial) - and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable - ): - # encoded string may be deserialized to sequence + + # encoded string may be deserialized to sequence + if isinstance(obj, str) and isinstance(deserializer, functools.partial): + # for list[str] + if _is_array_encoded_deserializer(deserializer): return deserializer(obj) - except: # pylint: disable=bare-except - pass + + # for list[Union[...]] + if isinstance(deserializer.args[0], list): + for sub_deserializer in deserializer.args[0]: + if _is_array_encoded_deserializer(sub_deserializer): + return sub_deserializer(obj) + return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) @@ -893,6 +1206,8 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-retur # is it optional? try: if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore + if rf: + rf._is_optional = True if len(annotation.__args__) <= 2: # pyright: ignore if_obj_deserializer = _get_deserialize_callable_from_annotation( next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore @@ -985,16 +1300,20 @@ def _deserialize_with_callable( return float(value.text) if value.text else None if deserializer is bool: return value.text == "true" if value.text else None + if deserializer and deserializer in _DESERIALIZE_MAPPING.values(): + return deserializer(value.text) if value.text else None + if deserializer and deserializer in _DESERIALIZE_MAPPING_WITHFORMAT.values(): + return deserializer(value.text) if value.text else None if deserializer is None: return value if deserializer in [int, float, bool]: return deserializer(value) if isinstance(deserializer, CaseInsensitiveEnumMeta): try: - return deserializer(value) + return deserializer(value.text if isinstance(value, ET.Element) else value) except ValueError: # for unknown value, return raw value - return value + return value.text if isinstance(value, ET.Element) else value if isinstance(deserializer, type) and issubclass(deserializer, Model): return deserializer._deserialize(value, []) return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) @@ -1027,7 +1346,7 @@ def _failsafe_deserialize( ) -> typing.Any: try: return _deserialize(deserializer, response.json(), module, rf, format) - except DeserializationError: + except Exception: # pylint: disable=broad-except _LOGGER.warning( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) @@ -1040,7 +1359,7 @@ def _failsafe_deserialize_xml( ) -> typing.Any: try: return _deserialize_xml(deserializer, response.text()) - except DeserializationError: + except Exception: # pylint: disable=broad-except _LOGGER.warning( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) @@ -1060,6 +1379,7 @@ def __init__( format: typing.Optional[str] = None, is_multipart_file_input: bool = False, xml: typing.Optional[dict[str, typing.Any]] = None, + deserializer: typing.Optional[typing.Callable] = None, original_tsp_name: typing.Optional[str] = None, ): self._type = type @@ -1068,10 +1388,12 @@ def __init__( self._is_discriminator = is_discriminator self._visibility = visibility self._is_model = False + self._is_optional = False self._default = default self._format = format self._is_multipart_file_input = is_multipart_file_input self._xml = xml if xml is not None else {} + self._deserializer = deserializer self._original_tsp_name = original_tsp_name @property @@ -1092,7 +1414,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: @@ -1105,7 +1430,11 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # Return the value from _data directly (it's been deserialized in place) return obj._data.get(self._rest_name) - deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) + # Fast path: use _deserializer directly (avoids _serialize/_deserialize chain) + if self._deserializer: + deserialized = self._deserializer(item) + else: + deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) # For mutable types, store the deserialized value back in _data # so mutations directly affect _data @@ -1151,6 +1480,7 @@ def rest_field( format: typing.Optional[str] = None, is_multipart_file_input: bool = False, xml: typing.Optional[dict[str, typing.Any]] = None, + deserializer: typing.Optional[typing.Callable] = None, original_tsp_name: typing.Optional[str] = None, ) -> typing.Any: return _RestField( @@ -1161,6 +1491,7 @@ def rest_field( format=format, is_multipart_file_input=is_multipart_file_input, xml=xml, + deserializer=deserializer, original_tsp_name=original_tsp_name, ) @@ -1186,6 +1517,56 @@ def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore +def _get_xml_ns(meta: dict[str, typing.Any]) -> typing.Optional[str]: + """Return the XML namespace from a metadata dict, checking both 'ns' (old-style) and 'namespace' (DPG) keys. + + :param dict meta: The metadata dictionary to extract namespace from. + :returns: The namespace string if 'ns' or 'namespace' key is present, None otherwise. + :rtype: str or None + """ + ns = meta.get("ns") + if ns is None: + ns = meta.get("namespace") + return ns + + +def _resolve_xml_ns( + prop_meta: dict[str, typing.Any], model_meta: typing.Optional[dict[str, typing.Any]] = None +) -> typing.Optional[str]: + """Resolve XML namespace for a property, falling back to model namespace when appropriate. + + Checks the property metadata first; if no namespace is found and the model does not declare + an explicit prefix, falls back to the model-level namespace. + + :param dict prop_meta: The property metadata dictionary. + :param dict model_meta: The model metadata dictionary, used as fallback. + :returns: The resolved namespace string, or None. + :rtype: str or None + """ + ns = _get_xml_ns(prop_meta) + if ns is None and model_meta is not None and not model_meta.get("prefix"): + ns = _get_xml_ns(model_meta) + return ns + + +def _set_xml_attribute(element: ET.Element, name: str, value: typing.Any, prop_meta: dict[str, typing.Any]) -> None: + """Set an XML attribute on an element, handling namespace prefix registration. + + :param ET.Element element: The element to set the attribute on. + :param str name: The default attribute name (wire name). + :param any value: The attribute value. + :param dict prop_meta: The property metadata dictionary. + """ + xml_name = prop_meta.get("name", name) + _attr_ns = _get_xml_ns(prop_meta) + if _attr_ns: + _attr_prefix = prop_meta.get("prefix") + if _attr_prefix: + _safe_register_namespace(_attr_prefix, _attr_ns) + xml_name = "{" + _attr_ns + "}" + xml_name + element.set(xml_name, _get_primitive_type_value(value)) + + def _get_element( o: typing.Any, exclude_readonly: bool = False, @@ -1197,10 +1578,16 @@ def _get_element( # if prop is a model, then use the prop element directly, else generate a wrapper of model if wrapped_element is None: + # When serializing as an array item (parent_meta is set), check if the parent has an + # explicit itemsName. This ensures correct element names for unwrapped arrays (where + # the element tag is the property/items name, not the model type name). + _items_name = parent_meta.get("itemsName") if parent_meta is not None else None + element_name = _items_name if _items_name else (model_meta.get("name") or o.__class__.__name__) + _model_ns = _get_xml_ns(model_meta) wrapped_element = _create_xml_element( - model_meta.get("name", o.__class__.__name__), + element_name, model_meta.get("prefix"), - model_meta.get("ns"), + _model_ns, ) readonly_props = [] @@ -1222,7 +1609,9 @@ def _get_element( # additional properties will not have rest field, use the wire name as xml name prop_meta = {"name": k} - # if no ns for prop, use model's + # Propagate model namespace to properties only for old-style "ns"-keyed models. + # DPG-generated models use the "namespace" key and explicitly declare namespace on + # each property that needs it, so propagation is intentionally skipped for them. if prop_meta.get("ns") is None and model_meta.get("ns"): prop_meta["ns"] = model_meta.get("ns") prop_meta["prefix"] = model_meta.get("prefix") @@ -1234,12 +1623,7 @@ def _get_element( # text could only set on primitive type wrapped_element.text = _get_primitive_type_value(v) elif prop_meta.get("attribute", False): - xml_name = prop_meta.get("name", k) - if prop_meta.get("ns"): - ET.register_namespace(prop_meta.get("prefix"), prop_meta.get("ns")) # pyright: ignore - xml_name = "{" + prop_meta.get("ns") + "}" + xml_name # pyright: ignore - # attribute should be primitive type - wrapped_element.set(xml_name, _get_primitive_type_value(v)) + _set_xml_attribute(wrapped_element, k, v, prop_meta) else: # other wrapped prop element wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) @@ -1248,6 +1632,7 @@ def _get_element( return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore if isinstance(o, dict): result = [] + _dict_ns = _get_xml_ns(parent_meta) if parent_meta else None for k, v in o.items(): result.append( _get_wrapped_element( @@ -1255,7 +1640,7 @@ def _get_element( exclude_readonly, { "name": k, - "ns": parent_meta.get("ns") if parent_meta else None, + "ns": _dict_ns, "prefix": parent_meta.get("prefix") if parent_meta else None, }, ) @@ -1264,13 +1649,16 @@ def _get_element( # primitive case need to create element based on parent_meta if parent_meta: + _items_ns = parent_meta.get("itemsNs") + if _items_ns is None: + _items_ns = _get_xml_ns(parent_meta) return _get_wrapped_element( o, exclude_readonly, { "name": parent_meta.get("itemsName", parent_meta.get("name")), "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), - "ns": parent_meta.get("itemsNs", parent_meta.get("ns")), + "ns": _items_ns, }, ) @@ -1282,8 +1670,9 @@ def _get_wrapped_element( exclude_readonly: bool, meta: typing.Optional[dict[str, typing.Any]], ) -> ET.Element: + _meta_ns = _get_xml_ns(meta) if meta else None wrapped_element = _create_xml_element( - meta.get("name") if meta else None, meta.get("prefix") if meta else None, meta.get("ns") if meta else None + meta.get("name") if meta else None, meta.get("prefix") if meta else None, _meta_ns ) if isinstance(v, (dict, list)): wrapped_element.extend(_get_element(v, exclude_readonly, meta)) @@ -1304,11 +1693,29 @@ def _get_primitive_type_value(v) -> str: return str(v) +def _safe_register_namespace(prefix: str, ns: str) -> None: + """Register an XML namespace prefix, handling reserved prefix patterns. + + Some prefixes (e.g. 'ns2') match Python's reserved 'ns\\d+' pattern used for + auto-generated prefixes, causing register_namespace to raise ValueError. + Falls back to directly registering in the internal namespace map. + + :param str prefix: The namespace prefix to register. + :param str ns: The namespace URI. + """ + try: + ET.register_namespace(prefix, ns) + except ValueError: + _ns_map = getattr(ET, "_namespace_map", None) + if _ns_map is not None: + _ns_map[ns] = prefix + + def _create_xml_element( tag: typing.Any, prefix: typing.Optional[str] = None, ns: typing.Optional[str] = None ) -> ET.Element: if prefix and ns: - ET.register_namespace(prefix, ns) + _safe_register_namespace(prefix, ns) if ns: return ET.Element("{" + ns + "}" + tag) return ET.Element(tag) @@ -1319,6 +1726,8 @@ def _deserialize_xml( value: str, ) -> typing.Any: element = ET.fromstring(value) # nosec + if _is_model(deserializer): + return deserializer._deserialize(element, []) return _deserialize(deserializer, element) diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/_utils/serialization.py b/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/_utils/serialization.py index 81ec1de5922b..a088671e9c51 100644 --- a/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/_utils/serialization.py +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] @@ -1401,7 +1405,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: # Otherwise, result are unexpected self.additional_properties_detection = True - def __call__(self, target_obj, response_data, content_type=None): + def __call__(self, target_obj, response_data, content_type=None): # pylint: disable=too-many-return-statements """Call the deserializer to process a REST response. :param str target_obj: Target data type to deserialize to. @@ -1411,6 +1415,27 @@ def __call__(self, target_obj, response_data, content_type=None): :return: Deserialized object. :rtype: object """ + # Fast path for header deserialization: response_data is a plain str or None + # and target_obj is a simple scalar type. This avoids the expensive + # _unpack_content → _deserialize → _classify_target → deserialize_data chain. + if response_data is None: + return None + if target_obj == "str" and isinstance(response_data, str): + return response_data + if isinstance(response_data, str): + if target_obj == "int": + return int(response_data) + if target_obj == "bool": + if response_data in ("true", "1", "True"): + return True + if response_data in ("false", "0", "False"): + return False + return bool(response_data) + if target_obj == "rfc-1123": + return Deserializer.deserialize_rfc(response_data) + if target_obj == "bytearray": + return Deserializer.deserialize_bytearray(response_data) + data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/_version.py b/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/_version.py index 8191bc7f4c53..9fff966d2acd 100644 --- a/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/_version.py +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "6.0.0b2" +VERSION = "6.0.0b3" diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/aio/_client.py b/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/aio/_client.py index cef7840ce180..4c5bae133b09 100644 --- a/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/aio/_client.py +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/aio/_client.py @@ -8,8 +8,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, TYPE_CHECKING, Union -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.credentials import AzureKeyCredential @@ -20,6 +20,11 @@ from ._configuration import TextAnalysisClientConfiguration from ._operations import _TextAnalysisClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials_async import AsyncTokenCredential @@ -39,8 +44,9 @@ class TextAnalysisClient(_TextAnalysisClientOperationsMixin): credential type or a token credential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: The API version to use for this operation. Default value is - "2025-11-15-preview". Note that overriding this default value may result in unsupported + :keyword api_version: The API version to use for this operation. Known values are + "2026-05-15-preview" and None. Default value is None. If not set, the operation's default API + version will be used. Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/aio/_configuration.py b/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/aio/_configuration.py index 66b2f906bd09..793c346328c7 100644 --- a/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/aio/_configuration.py +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/aio/_configuration.py @@ -30,8 +30,9 @@ class TextAnalysisClientConfiguration: # pylint: disable=too-many-instance-attr credential type or a token credential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: The API version to use for this operation. Default value is - "2025-11-15-preview". Note that overriding this default value may result in unsupported + :keyword api_version: The API version to use for this operation. Known values are + "2026-05-15-preview" and None. Default value is None. If not set, the operation's default API + version will be used. Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -39,7 +40,7 @@ class TextAnalysisClientConfiguration: # pylint: disable=too-many-instance-attr def __init__( self, endpoint: str, credential: Union[AzureKeyCredential, "AsyncTokenCredential"], **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2025-11-15-preview") + api_version: str = kwargs.pop("api_version", "2026-05-15-preview") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/aio/_operations/_operations.py b/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/aio/_operations/_operations.py index 3c3b0d63f346..1115df30c504 100644 --- a/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/aio/_operations/_operations.py +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/aio/_operations/_operations.py @@ -171,6 +171,7 @@ async def analyze_text( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -192,7 +193,7 @@ async def analyze_text( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.AnalyzeTextResult, response.json()) @@ -259,6 +260,7 @@ async def get_job_status( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -280,7 +282,7 @@ async def get_job_status( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.AnalyzeTextOperationState, response.json()) @@ -346,6 +348,7 @@ async def _analyze_text_job_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -368,7 +371,7 @@ async def _analyze_text_job_initial( response_headers = {} response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -553,6 +556,7 @@ async def _cancel_job_initial(self, job_id: str, **kwargs: Any) -> AsyncIterator } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -575,7 +579,7 @@ async def _cancel_job_initial(self, job_id: str, **kwargs: Any) -> AsyncIterator response_headers = {} response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/aio/_patch.py b/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/aio/_patch.py index 4dff8f288feb..87676c65a8f0 100644 --- a/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/aio/_patch.py +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/aio/_patch.py @@ -7,331 +7,9 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -# coding: utf-8 -import json -from typing import Any, Callable, Dict, IO, Mapping, Optional, TypeVar, Union, cast, overload, Generic, TYPE_CHECKING -from collections.abc import MutableMapping # pylint:disable=import-error -from azure.core.exceptions import HttpResponseError -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncPollingMethod, AsyncNoPolling -from azure.core.polling.async_base_polling import AsyncLROBasePolling -from azure.core.rest import HttpRequest, AsyncHttpResponse -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.core.credentials import AzureKeyCredential -from azure.core.async_paging import AsyncItemPaged -from ._client import TextAnalysisClient as AnalysisTextClientGenerated -from .. import models as _models -from ..models import AnalyzeTextOperationState, TextActions -from .._utils.serialization import Serializer -from .._patch import _parse_operation_id - -if TYPE_CHECKING: - from azure.core.credentials_async import AsyncTokenCredential - -JSON = MutableMapping[str, Any] -_Unset: Any = object() -T = TypeVar("T") -PollingReturnType_co = TypeVar("PollingReturnType_co", covariant=True) -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -class AnalyzeTextAsyncLROPoller(AsyncLROPoller[PollingReturnType_co], Generic[PollingReturnType_co]): - """Custom **async** poller that returns ``PollingReturnType_co`` and exposes operation metadata.""" - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - self._last_state: Optional[AnalyzeTextOperationState] = None # set by deserializer - - # internal: called by the deserializer to update details() - def _record_state_for_details(self, state: AnalyzeTextOperationState) -> None: - self._last_state = state - - @property - def details(self) -> Mapping[str, Any]: - """Metadata associated with the long-running operation. - - :return: A mapping with keys like ``operation_id`` and, when available, - ``status``, ``job_id``, ``display_name``, ``created_at``, - ``last_updated_at``, ``expires_on``, ``statistics``, - ``errors``, and ``next_link``. - :rtype: Mapping[str, Any] - """ - try: - headers = getattr( - self.polling_method(), "_initial_response" - ).http_response.headers # type: ignore[attr-defined] - op_loc = headers.get("Operation-Location") or headers.get("operation-location") - except (AttributeError, TypeError): - op_loc = None - - info: Dict[str, Any] = {"operation_id": _parse_operation_id(op_loc)} - if self._last_state is not None: - s = self._last_state - info.update( - { - "status": s.status, - "job_id": s.job_id, - "display_name": s.display_name, - "created_at": s.created_at, - "last_updated_at": s.last_updated_at, - "expires_on": s.expires_on, - "statistics": s.statistics, - "errors": s.errors, - "next_link": s.next_link, - } - ) - return info - - @classmethod - def from_continuation_token( - cls, - polling_method: AsyncPollingMethod[PollingReturnType_co], - continuation_token: str, - **kwargs: Any, - ) -> "AnalyzeTextAsyncLROPoller[PollingReturnType_co]": - client, initial_response, deserialization_callback = polling_method.from_continuation_token( - continuation_token, **kwargs - ) - return cls(client, initial_response, deserialization_callback, polling_method) - - -class TextAnalysisClient(AnalysisTextClientGenerated): - """**Async** client for Text Analysis APIs.""" - - def __init__( - self, - endpoint: str, - credential: Union[AzureKeyCredential, "AsyncTokenCredential"], - *, - api_version: Optional[str] = None, - **kwargs: Any, - ) -> None: - """Create a TextAnalysisClient. - - :param endpoint: Supported Cognitive Services endpoint. - :type endpoint: str - :param credential: Key or token credential. - :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.AsyncTokenCredential - :keyword api_version: The API version to use for this operation. Default value is - ``"2025-05-15-preview"``. Note that overriding this default value may result in unsupported - behavior. - :paramtype api_version: str - """ - if api_version is not None: - kwargs["api_version"] = api_version - super().__init__(endpoint=endpoint, credential=credential, **kwargs) - - @overload # type: ignore[override] - async def begin_analyze_text_job( - self, - *, - text_input: _models.MultiLanguageTextInput, - actions: list[_models.AnalyzeTextOperationAction], - content_type: str = "application/json", - display_name: Optional[str] = None, - default_language: Optional[str] = None, - cancel_after: Optional[float] = None, - **kwargs: Any, - ) -> AnalyzeTextAsyncLROPoller[AsyncItemPaged["TextActions"]]: - """Submit a collection of text documents for analysis. Specify one or more unique tasks to be - executed as a long-running operation. - - :keyword text_input: Contains the input to be analyzed. Required. - :paramtype text_input: ~azure.ai.textanalytics.models.MultiLanguageTextInput - :keyword actions: List of tasks to be performed as part of the LRO. Required. - :paramtype actions: list[~azure.ai.textanalytics.models.AnalyzeTextOperationAction] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is ``"application/json"``. - :paramtype content_type: str - :keyword display_name: Name for the task. Default value is ``None``. - :paramtype display_name: str - :keyword default_language: Default language to use for records requesting automatic language - detection. Default value is ``None``. - :paramtype default_language: str - :keyword cancel_after: Optional duration in seconds after which the job will be canceled if not - completed. Default value is ``None``. - :paramtype cancel_after: float - :return: A poller whose ``result()`` yields ``AsyncItemPaged[TextActions]`` and exposes metadata via - ``.details``. - :rtype: ~azure.ai.textanalytics.AnalyzeTextAsyncLROPoller[ - ~azure.core.async_paging.AsyncItemPaged[~azure.ai.textanalytics.models.TextActions]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_analyze_text_job( # type: ignore[override] - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AnalyzeTextAsyncLROPoller[AsyncItemPaged["TextActions"]]: - """Submit a collection of text documents for analysis. Specify one or more unique tasks to be - executed as a long-running operation. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is ``"application/json"``. - :paramtype content_type: str - :return: A poller whose ``result()`` yields ``AsyncItemPaged[TextActions]`` and exposes metadata via - ``.details``. - :rtype: ~azure.ai.textanalytics.AnalyzeTextAsyncLROPoller[ - ~azure.core.async_paging.AsyncItemPaged[~azure.ai.textanalytics.models.TextActions]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_analyze_text_job( # type: ignore[override] - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AnalyzeTextAsyncLROPoller[AsyncItemPaged["TextActions"]]: - """Submit a collection of text documents for analysis. Specify one or more unique tasks to be - executed as a long-running operation. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is ``"application/json"``. - :paramtype content_type: str - :return: A poller whose ``result()`` yields ``AsyncItemPaged[TextActions]`` and exposes metadata via - ``.details``. - :rtype: ~azure.ai.textanalytics.AnalyzeTextAsyncLROPoller[ - ~azure.core.async_paging.AsyncItemPaged[~azure.ai.textanalytics.models.TextActions]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_analyze_text_job( # type: ignore[override] - self, - body: Union[JSON, IO[bytes]] = _Unset, - *, - text_input: _models.MultiLanguageTextInput = _Unset, - actions: list[_models.AnalyzeTextOperationAction] = _Unset, - display_name: Optional[str] = None, - default_language: Optional[str] = None, - cancel_after: Optional[float] = None, - **kwargs: Any, - ) -> AnalyzeTextAsyncLROPoller[AsyncItemPaged["TextActions"]]: - """Submit a collection of text documents for analysis. Specify one or more unique tasks to be - executed as a long-running operation. - - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword text_input: Contains the input to be analyzed. Required. - :paramtype text_input: ~azure.ai.textanalytics.models.MultiLanguageTextInput - :keyword actions: List of tasks to be performed as part of the LRO. Required. - :paramtype actions: list[~azure.ai.textanalytics.models.AnalyzeTextOperationAction] - :keyword display_name: Name for the task. Default value is ``None``. - :paramtype display_name: str - :keyword default_language: Default language to use for records requesting automatic language - detection. Default value is ``None``. - :paramtype default_language: str - :keyword cancel_after: Optional duration in seconds after which the job will be canceled if not - completed. Default value is ``None``. - :paramtype cancel_after: float - :return: A poller whose ``result()`` yields ``AsyncItemPaged[TextActions]`` and exposes metadata via - ``.details``. - :rtype: ~azure.ai.textanalytics.AnalyzeTextAsyncLROPoller[ - ~azure.core.async_paging.AsyncItemPaged[~azure.ai.textanalytics.models.TextActions]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - polling: Union[bool, AsyncPollingMethod[AsyncItemPaged["TextActions"]]] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - cls: ClsType[AsyncItemPaged["TextActions"]] = kwargs.pop("cls", None) - kwargs.pop("error_map", None) - - path_format_arguments = { - "Endpoint": self._serialize.url( # type: ignore[attr-defined] - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - - async def _fetch_state_by_next_link(next_link: str) -> AnalyzeTextOperationState: - req = HttpRequest("GET", next_link) - resp = await self._client.send_request(req) # type: ignore[attr-defined] - if resp.status_code != 200: - raise HttpResponseError(response=resp) - data = json.loads(await resp.text()) - return AnalyzeTextOperationState(data) - - def _build_pager_from_state( - state: AnalyzeTextOperationState, - ) -> AsyncItemPaged["TextActions"]: - async def extract_data(s: AnalyzeTextOperationState): - next_link = s.next_link - actions_payload: TextActions = s.actions - return next_link, [actions_payload] - - async def get_next(token: Optional[str]) -> Optional[AnalyzeTextOperationState]: - if token is None: - return state - if not token: - return None - return await _fetch_state_by_next_link(token) - - return AsyncItemPaged(get_next, extract_data) - - poller_holder: Dict[str, AnalyzeTextAsyncLROPoller[AsyncItemPaged["TextActions"]]] = {} - - def get_long_running_output(pipeline_response): - final = pipeline_response.http_response - if final.status_code == 200: - data = json.loads(final.text()) - op_state = AnalyzeTextOperationState(data) - - poller_ref = poller_holder["poller"] - poller_ref._record_state_for_details(op_state) # pylint:disable=protected-access - - paged = _build_pager_from_state(op_state) - return cls(pipeline_response, paged, {}) if cls else paged - raise HttpResponseError(response=final) - - if polling is True: - polling_method: AsyncPollingMethod[AsyncItemPaged["TextActions"]] = cast( - AsyncPollingMethod[AsyncItemPaged["TextActions"]], - AsyncLROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod[AsyncItemPaged["TextActions"]], AsyncNoPolling()) - else: - polling_method = cast(AsyncPollingMethod[AsyncItemPaged["TextActions"]], polling) - - if cont_token: - return AnalyzeTextAsyncLROPoller[AsyncItemPaged["TextActions"]].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - ) - - initial_kwargs = dict( # pylint:disable=use-dict-literal - text_input=text_input, - actions=actions, - display_name=display_name, - default_language=default_language, - cancel_after=cancel_after, - content_type=content_type, - cls=lambda x, y, z: x, # passthrough raw pipeline response - headers=_headers, - params=_params, - **kwargs, - ) - if body is not _Unset and body is not None: - initial_kwargs["body"] = body - - raw_result = await self._analyze_text_job_initial(**initial_kwargs) - await raw_result.http_response.read() # type: ignore[attr-defined] - - lro: AnalyzeTextAsyncLROPoller[AsyncItemPaged["TextActions"]] = AnalyzeTextAsyncLROPoller( - self._client, raw_result, get_long_running_output, polling_method - ) - poller_holder["poller"] = lro - return lro +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): @@ -341,6 +19,3 @@ def patch_sdk(): you can't accomplish using the techniques described in https://aka.ms/azsdk/python/dpcodegen/python/customize """ - - -__all__ = ["TextAnalysisClient", "AnalyzeTextAsyncLROPoller"] diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/models/_enums.py b/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/models/_enums.py index 0ff1a041455e..1fe7b7764b4d 100644 --- a/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/models/_enums.py +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/models/_enums.py @@ -15,188 +15,188 @@ class AgeUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The Age Unit of measurement.""" UNSPECIFIED = "Unspecified" - """Unspecified time period""" + """Unspecified time period.""" YEAR = "Year" - """Time period of a year""" + """Time period of a year.""" MONTH = "Month" - """Time period of a month""" + """Time period of a month.""" WEEK = "Week" - """Time period of a week""" + """Time period of a week.""" DAY = "Day" - """Time period of a day""" + """Time period of a day.""" class AnalyzeTextErrorCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Human-readable error code.""" INVALID_REQUEST = "InvalidRequest" - """Invalid request error""" + """Invalid request error.""" INVALID_ARGUMENT = "InvalidArgument" - """Invalid argument error""" + """Invalid argument error.""" UNAUTHORIZED = "Unauthorized" - """Unauthorized access error""" + """Unauthorized access error.""" FORBIDDEN = "Forbidden" - """Forbidden access error""" + """Forbidden access error.""" NOT_FOUND = "NotFound" - """Not found error""" + """Not found error.""" PROJECT_NOT_FOUND = "ProjectNotFound" - """Project not found error""" + """Project not found error.""" OPERATION_NOT_FOUND = "OperationNotFound" - """Operation not found error""" + """Operation not found error.""" AZURE_COGNITIVE_SEARCH_NOT_FOUND = "AzureCognitiveSearchNotFound" - """Azure Cognitive Search not found error""" + """Azure Cognitive Search not found error.""" AZURE_COGNITIVE_SEARCH_INDEX_NOT_FOUND = "AzureCognitiveSearchIndexNotFound" - """Azure Cognitive Search index not found error""" + """Azure Cognitive Search index not found error.""" TOO_MANY_REQUESTS = "TooManyRequests" - """Too many requests error""" + """Too many requests error.""" AZURE_COGNITIVE_SEARCH_THROTTLING = "AzureCognitiveSearchThrottling" - """Azure Cognitive Search throttling error""" + """Azure Cognitive Search throttling error.""" AZURE_COGNITIVE_SEARCH_INDEX_LIMIT_REACHED = "AzureCognitiveSearchIndexLimitReached" - """Azure Cognitive Search index limit reached error""" + """Azure Cognitive Search index limit reached error.""" INTERNAL_SERVER_ERROR = "InternalServerError" - """Internal server error""" + """Internal server error.""" SERVICE_UNAVAILABLE = "ServiceUnavailable" - """Service unavailable error""" + """Service unavailable error.""" TIMEOUT = "Timeout" - """Timeout error""" + """Timeout error.""" QUOTA_EXCEEDED = "QuotaExceeded" - """Quota exceeded error""" + """Quota exceeded error.""" CONFLICT = "Conflict" - """Conflict error""" + """Conflict error.""" WARNING = "Warning" - """Warning error""" + """Warning error.""" class AnalyzeTextInputKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of the analyze-text tasks supported.""" SENTIMENT_ANALYSIS = "SentimentAnalysis" - """Sentiment analysis task""" + """Sentiment analysis task.""" ENTITY_RECOGNITION = "EntityRecognition" - """Entity recognition task""" + """Entity recognition task.""" PII_ENTITY_RECOGNITION = "PiiEntityRecognition" - """PII entity recognition task""" + """PII entity recognition task.""" KEY_PHRASE_EXTRACTION = "KeyPhraseExtraction" - """Key phrase extraction task""" + """Key phrase extraction task.""" LANGUAGE_DETECTION = "LanguageDetection" - """Language detection task""" + """Language detection task.""" ENTITY_LINKING = "EntityLinking" - """Entity linking task""" + """Entity linking task.""" class AnalyzeTextOperationActionKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of the long running analyze text tasks supported.""" SENTIMENT_ANALYSIS = "SentimentAnalysis" - """Sentiment analysis task""" + """Sentiment analysis task.""" ENTITY_RECOGNITION = "EntityRecognition" - """Entity recognition task""" + """Entity recognition task.""" PII_ENTITY_RECOGNITION = "PiiEntityRecognition" - """PII entity recognition task""" + """PII entity recognition task.""" KEY_PHRASE_EXTRACTION = "KeyPhraseExtraction" - """Key phrase extraction task""" + """Key phrase extraction task.""" ENTITY_LINKING = "EntityLinking" - """Entity linking task""" + """Entity linking task.""" HEALTHCARE = "Healthcare" - """Healthcare task""" + """Healthcare task.""" CUSTOM_ENTITY_RECOGNITION = "CustomEntityRecognition" - """Custom entity recognition task""" + """Custom entity recognition task.""" CUSTOM_SINGLE_LABEL_CLASSIFICATION = "CustomSingleLabelClassification" - """Custom single label classification task""" + """Custom single label classification task.""" CUSTOM_MULTI_LABEL_CLASSIFICATION = "CustomMultiLabelClassification" - """Custom multi label classification task""" + """Custom multi label classification task.""" EXTRACTIVE_SUMMARIZATION = "ExtractiveSummarization" - """Extractive summarization task""" + """Extractive summarization task.""" ABSTRACTIVE_SUMMARIZATION = "AbstractiveSummarization" - """Abstractive summarization task""" + """Abstractive summarization task.""" class AnalyzeTextOperationResultsKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of the response object returned by the analyze-text long running task.""" SENTIMENT_ANALYSIS_OPERATION_RESULTS = "SentimentAnalysisLROResults" - """Sentiment analysis LRO results""" + """Sentiment analysis LRO results.""" ENTITY_RECOGNITION_OPERATION_RESULTS = "EntityRecognitionLROResults" - """Entity recognition LRO results""" + """Entity recognition LRO results.""" PII_ENTITY_RECOGNITION_OPERATION_RESULTS = "PiiEntityRecognitionLROResults" - """PII entity recognition LRO results""" + """PII entity recognition LRO results.""" KEY_PHRASE_EXTRACTION_OPERATION_RESULTS = "KeyPhraseExtractionLROResults" - """Key phrase extraction LRO results""" + """Key phrase extraction LRO results.""" ENTITY_LINKING_OPERATION_RESULTS = "EntityLinkingLROResults" - """Entity linking LRO results""" + """Entity linking LRO results.""" HEALTHCARE_OPERATION_RESULTS = "HealthcareLROResults" - """Healthcare LRO results""" + """Healthcare LRO results.""" CUSTOM_ENTITY_RECOGNITION_OPERATION_RESULTS = "CustomEntityRecognitionLROResults" - """Custom entity recognition LRO results""" + """Custom entity recognition LRO results.""" CUSTOM_SINGLE_LABEL_CLASSIFICATION_OPERATION_RESULTS = "CustomSingleLabelClassificationLROResults" - """Custom single label classification LRO results""" + """Custom single label classification LRO results.""" CUSTOM_MULTI_LABEL_CLASSIFICATION_OPERATION_RESULTS = "CustomMultiLabelClassificationLROResults" - """Custom multi label classification LRO results""" + """Custom multi label classification LRO results.""" EXTRACTIVE_SUMMARIZATION_OPERATION_RESULTS = "ExtractiveSummarizationLROResults" - """Extractive summarization LRO results""" + """Extractive summarization LRO results.""" ABSTRACTIVE_SUMMARIZATION_OPERATION_RESULTS = "AbstractiveSummarizationLROResults" - """Abstractive summarization LRO results""" + """Abstractive summarization LRO results.""" class AnalyzeTextResultsKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of the response object returned by the analyze-text task.""" SENTIMENT_ANALYSIS_RESULTS = "SentimentAnalysisResults" - """Sentiment analysis results""" + """Sentiment analysis results.""" ENTITY_RECOGNITION_RESULTS = "EntityRecognitionResults" - """Entity recognition results""" + """Entity recognition results.""" PII_ENTITY_RECOGNITION_RESULTS = "PiiEntityRecognitionResults" - """PII entity recognition results""" + """PII entity recognition results.""" KEY_PHRASE_EXTRACTION_RESULTS = "KeyPhraseExtractionResults" - """Key phrase extraction results""" + """Key phrase extraction results.""" LANGUAGE_DETECTION_RESULTS = "LanguageDetectionResults" - """Language detection results""" + """Language detection results.""" ENTITY_LINKING_RESULTS = "EntityLinkingResults" - """Entity linking results""" + """Entity linking results.""" class AreaUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The area unit of measurement.""" UNSPECIFIED = "Unspecified" - """Unspecified area unit""" + """Unspecified area unit.""" SQUARE_KILOMETER = "SquareKilometer" - """Area unit in square kilometers""" + """Area unit in square kilometers.""" SQUARE_HECTOMETER = "SquareHectometer" - """Area unit in square hectometers""" + """Area unit in square hectometers.""" SQUARE_DECAMETER = "SquareDecameter" - """Area unit in square decameters""" + """Area unit in square decameters.""" SQUARE_DECIMETER = "SquareDecimeter" - """Area unit in square decimeters""" + """Area unit in square decimeters.""" SQUARE_METER = "SquareMeter" - """Area unit in square meters""" + """Area unit in square meters.""" SQUARE_CENTIMETER = "SquareCentimeter" - """Area unit in square centimeters""" + """Area unit in square centimeters.""" SQUARE_MILLIMETER = "SquareMillimeter" - """Area unit in square millimeters""" + """Area unit in square millimeters.""" SQUARE_INCH = "SquareInch" - """Area unit in square inches""" + """Area unit in square inches.""" SQUARE_FOOT = "SquareFoot" - """Area unit in square feet""" + """Area unit in square feet.""" SQUARE_MILE = "SquareMile" - """Area unit in square miles""" + """Area unit in square miles.""" SQUARE_YARD = "SquareYard" - """Area unit in square yards""" + """Area unit in square yards.""" ACRE = "Acre" - """Area unit in acres""" + """Area unit in acres.""" class DocumentSentiment(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Predicted sentiment for document (Negative, Neutral, Positive, or Mixed).""" POSITIVE = "positive" - """Positive statement""" + """Positive statement.""" NEUTRAL = "neutral" - """Neutral statement""" + """Neutral statement.""" NEGATIVE = "negative" - """Negative statement""" + """Negative statement.""" MIXED = "mixed" - """Mixed statement""" + """Mixed statement.""" class EntityCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -212,9 +212,9 @@ class EntityCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): CURRENCY = "Currency" """Currency-related values.""" NUMBER = "Number" - """Numbers without a unit""" + """Numbers without a unit.""" NUMBER_RANGE = "NumberRange" - """Range of Numbers""" + """Range of Numbers.""" PERCENTAGE = "Percentage" """Percentage-related values.""" ORDINAL = "Ordinal" @@ -222,7 +222,7 @@ class EntityCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): TEMPERATURE = "Temperature" """Temperature-related values.""" DIMENSION = "Dimension" - """Dimension of measurements""" + """Dimension of measurements.""" LENGTH = "Length" """Length of an object.""" WEIGHT = "Weight" @@ -327,216 +327,216 @@ class ExtractiveSummarizationSortingCriteria(str, Enum, metaclass=CaseInsensitiv class FhirVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The FHIR Spec version.""" - ENUM_4_0_1 = "4.0.1" - """Version 4.0.1""" + ENUM4_0_1 = "4.0.1" + """Version 4.0.1.""" class HealthcareAssertionAssociation(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes if the entity is the subject of the text or if it describes someone else.""" SUBJECT = "subject" - """Subject association""" + """Subject association.""" OTHER = "other" - """Other association""" + """Other association.""" class HealthcareAssertionCertainty(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes the entities certainty and polarity.""" POSITIVE = "positive" - """Positive certainty""" + """Positive certainty.""" POSITIVE_POSSIBLE = "positivePossible" - """Possibly positive certainty""" + """Possibly positive certainty.""" NEUTRAL_POSSIBLE = "neutralPossible" - """Possibly neutral certainty""" + """Possibly neutral certainty.""" NEGATIVE_POSSIBLE = "negativePossible" - """Possibly negative certainty""" + """Possibly negative certainty.""" NEGATIVE = "negative" - """Negative certainty""" + """Negative certainty.""" class HealthcareAssertionConditionality(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes any conditionality on the entity.""" HYPOTHETICAL = "hypothetical" - """Hypothetical conditionality""" + """Hypothetical conditionality.""" CONDITIONAL = "conditional" - """Conditional conditionality""" + """Conditional conditionality.""" class HealthcareAssertionTemporality(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes temporal information regarding the entity.""" CURRENT = "current" - """Current temporality""" + """Current temporality.""" PAST = "past" - """Past temporality""" + """Past temporality.""" FUTURE = "future" - """Future temporality""" + """Future temporality.""" class HealthcareDocumentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Document type.""" NONE = "None" - """None document type""" + """None document type.""" CLINICAL_TRIAL = "ClinicalTrial" - """Clinical trial document type""" + """Clinical trial document type.""" DISCHARGE_SUMMARY = "DischargeSummary" - """Discharge summary document type""" + """Discharge summary document type.""" PROGRESS_NOTE = "ProgressNote" - """Progress note document type""" + """Progress note document type.""" HISTORY_AND_PHYSICAL = "HistoryAndPhysical" - """History and physical document type""" + """History and physical document type.""" CONSULT = "Consult" - """Consult document type""" + """Consult document type.""" IMAGING = "Imaging" - """Imaging document type""" + """Imaging document type.""" PATHOLOGY = "Pathology" - """Pathology document type""" + """Pathology document type.""" PROCEDURE_NOTE = "ProcedureNote" - """Procedure note document type""" + """Procedure note document type.""" class HealthcareEntityCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Healthcare Entity Category.""" BODY_STRUCTURE = "BodyStructure" - """Body structure""" + """Body structure.""" AGE = "Age" - """Age""" + """Age.""" GENDER = "Gender" - """Gender""" + """Gender.""" EXAMINATION_NAME = "ExaminationName" - """Examination name""" + """Examination name.""" DATE = "Date" - """Date""" + """Date.""" DIRECTION = "Direction" - """Direction""" + """Direction.""" FREQUENCY = "Frequency" - """Frequency""" + """Frequency.""" MEASUREMENT_VALUE = "MeasurementValue" - """Measurement value""" + """Measurement value.""" MEASUREMENT_UNIT = "MeasurementUnit" - """Measurement unit""" + """Measurement unit.""" RELATIONAL_OPERATOR = "RelationalOperator" - """Relational operator""" + """Relational operator.""" TIME = "Time" - """Time""" + """Time.""" GENE_OR_PROTEIN = "GeneOrProtein" - """Gene or protein""" + """Gene or protein.""" VARIANT = "Variant" - """Variant""" + """Variant.""" ADMINISTRATIVE_EVENT = "AdministrativeEvent" - """Administrative event""" + """Administrative event.""" CARE_ENVIRONMENT = "CareEnvironment" - """Care environment""" + """Care environment.""" HEALTHCARE_PROFESSION = "HealthcareProfession" - """Healthcare profession""" + """Healthcare profession.""" DIAGNOSIS = "Diagnosis" - """Diagnosis""" + """Diagnosis.""" SYMPTOM_OR_SIGN = "SymptomOrSign" - """Symptom or sign""" + """Symptom or sign.""" CONDITION_QUALIFIER = "ConditionQualifier" - """Condition qualifier""" + """Condition qualifier.""" MEDICATION_CLASS = "MedicationClass" - """Medication class""" + """Medication class.""" MEDICATION_NAME = "MedicationName" - """Medication name""" + """Medication name.""" DOSAGE = "Dosage" - """Dosage""" + """Dosage.""" MEDICATION_FORM = "MedicationForm" - """Medication form""" + """Medication form.""" MEDICATION_ROUTE = "MedicationRoute" - """Medication route""" + """Medication route.""" FAMILY_RELATION = "FamilyRelation" - """Family relation""" + """Family relation.""" TREATMENT_NAME = "TreatmentName" - """Treatment name""" + """Treatment name.""" ETHNICITY = "Ethnicity" - """Ethnicity""" + """Ethnicity.""" COURSE = "Course" - """Course""" + """Course.""" EXPRESSION = "Expression" - """Expression""" + """Expression.""" MUTATION_TYPE = "MutationType" - """Mutation type""" + """Mutation type.""" CONDITION_SCALE = "ConditionScale" - """Condition scale""" + """Condition scale.""" ALLERGEN = "Allergen" - """Allergen""" + """Allergen.""" EMPLOYMENT = "Employment" - """Employment""" + """Employment.""" LIVING_STATUS = "LivingStatus" - """Living status""" + """Living status.""" SUBSTANCE_USE = "SubstanceUse" - """Substance use""" + """Substance use.""" SUBSTANCE_USE_AMOUNT = "SubstanceUseAmount" - """Substance use amount""" + """Substance use amount.""" class InformationUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The information (data) Unit of measurement.""" UNSPECIFIED = "Unspecified" - """Unspecified data size unit""" + """Unspecified data size unit.""" BIT = "Bit" - """Data size unit in bits""" + """Data size unit in bits.""" KILOBIT = "Kilobit" - """Data size unit in kilobits""" + """Data size unit in kilobits.""" MEGABIT = "Megabit" - """Data size unit in megabits""" + """Data size unit in megabits.""" GIGABIT = "Gigabit" - """Data size unit in gigabits""" + """Data size unit in gigabits.""" TERABIT = "Terabit" - """Data size unit in terabits""" + """Data size unit in terabits.""" PETABIT = "Petabit" - """Data size unit in petabits""" + """Data size unit in petabits.""" BYTE = "Byte" - """Data size unit in bytes""" + """Data size unit in bytes.""" KILOBYTE = "Kilobyte" - """Data size unit in kilobytes""" + """Data size unit in kilobytes.""" MEGABYTE = "Megabyte" - """Data size unit in megabytes""" + """Data size unit in megabytes.""" GIGABYTE = "Gigabyte" - """Data size unit in gigabytes""" + """Data size unit in gigabytes.""" TERABYTE = "Terabyte" - """Data size unit in terabytes""" + """Data size unit in terabytes.""" PETABYTE = "Petabyte" - """Data size unit in petabytes""" + """Data size unit in petabytes.""" class InnerErrorCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Human-readable error code.""" INVALID_REQUEST = "InvalidRequest" - """Invalid request error""" + """Invalid request error.""" INVALID_PARAMETER_VALUE = "InvalidParameterValue" - """Invalid parameter value error""" + """Invalid parameter value error.""" KNOWLEDGE_BASE_NOT_FOUND = "KnowledgeBaseNotFound" - """Knowledge base not found error""" + """Knowledge base not found error.""" AZURE_COGNITIVE_SEARCH_NOT_FOUND = "AzureCognitiveSearchNotFound" - """Azure Cognitive Search not found error""" + """Azure Cognitive Search not found error.""" AZURE_COGNITIVE_SEARCH_THROTTLING = "AzureCognitiveSearchThrottling" - """Azure Cognitive Search throttling error""" + """Azure Cognitive Search throttling error.""" EXTRACTION_FAILURE = "ExtractionFailure" - """Extraction failure error""" + """Extraction failure error.""" INVALID_REQUEST_BODY_FORMAT = "InvalidRequestBodyFormat" - """Invalid request body format error""" + """Invalid request body format error.""" EMPTY_REQUEST = "EmptyRequest" - """Empty request error""" + """Empty request error.""" MISSING_INPUT_DOCUMENTS = "MissingInputDocuments" - """Missing input documents error""" + """Missing input documents error.""" INVALID_DOCUMENT = "InvalidDocument" - """Invalid document error""" + """Invalid document error.""" MODEL_VERSION_INCORRECT = "ModelVersionIncorrect" - """Model version incorrect error""" + """Model version incorrect error.""" INVALID_DOCUMENT_BATCH = "InvalidDocumentBatch" - """Invalid document batch error""" + """Invalid document batch error.""" UNSUPPORTED_LANGUAGE_CODE = "UnsupportedLanguageCode" - """Unsupported language code error""" + """Unsupported language code error.""" INVALID_COUNTRY_HINT = "InvalidCountryHint" - """Invalid country hint error""" + """Invalid country hint error.""" class LengthUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -623,817 +623,817 @@ class NumberKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the extracted number entity.""" INTEGER = "Integer" - """Integer number""" + """Integer number.""" DECIMAL = "Decimal" - """Decimal number""" + """Decimal number.""" POWER = "Power" - """Power number""" + """Power number.""" FRACTION = "Fraction" - """Fraction number""" + """Fraction number.""" PERCENT = "Percent" - """Percent number""" + """Percent number.""" UNSPECIFIED = "Unspecified" - """Unspecified number kind""" + """Unspecified number kind.""" class PiiCategoriesExclude(str, Enum, metaclass=CaseInsensitiveEnumMeta): """(Optional) describes the PII categories to return.""" ABA_ROUTING_NUMBER = "ABARoutingNumber" - """ABA Routing number""" + """ABA Routing number.""" AR_NATIONAL_IDENTITY_NUMBER = "ARNationalIdentityNumber" - """AR National Identity Number""" + """AR National Identity Number.""" AU_BANK_ACCOUNT_NUMBER = "AUBankAccountNumber" - """AT Bank Account Number""" + """AT Bank Account Number.""" AU_DRIVERS_LICENSE_NUMBER = "AUDriversLicenseNumber" - """AU Driver's License Number""" + """AU Driver's License Number.""" AU_MEDICAL_ACCOUNT_NUMBER = "AUMedicalAccountNumber" - """AU Medical Account Number""" + """AU Medical Account Number.""" AU_PASSPORT_NUMBER = "AUPassportNumber" - """AU Passport Number""" + """AU Passport Number.""" AU_TAX_FILE_NUMBER = "AUTaxFileNumber" - """AU Tax File Number""" + """AU Tax File Number.""" AU_BUSINESS_NUMBER = "AUBusinessNumber" - """AU Business Number""" + """AU Business Number.""" AU_COMPANY_NUMBER = "AUCompanyNumber" - """AU Company Number""" + """AU Company Number.""" AT_IDENTITY_CARD = "ATIdentityCard" - """AT Identity Card""" + """AT Identity Card.""" AT_TAX_IDENTIFICATION_NUMBER = "ATTaxIdentificationNumber" - """AT Tax Identification Number""" + """AT Tax Identification Number.""" AT_VALUE_ADDED_TAX_NUMBER = "ATValueAddedTaxNumber" - """AT Value Added Tax Number""" + """AT Value Added Tax Number.""" AZURE_DOCUMENT_DBAUTH_KEY = "AzureDocumentDBAuthKey" - """Azure Document DB Auth Key""" + """Azure Document DB Auth Key.""" AZURE_IAAS_DATABASE_CONNECTION_AND_SQL_STRING = "AzureIAASDatabaseConnectionAndSQLString" - """Azure IAAS Database Connection And SQL String""" + """Azure IAAS Database Connection And SQL String.""" AZURE_IO_T_CONNECTION_STRING = "AzureIoTConnectionString" - """Azure IoT Connection String""" + """Azure IoT Connection String.""" AZURE_PUBLISH_SETTING_PASSWORD = "AzurePublishSettingPassword" - """Azure Publish Setting Password""" + """Azure Publish Setting Password.""" AZURE_REDIS_CACHE_STRING = "AzureRedisCacheString" - """Azure Redis Cache String""" + """Azure Redis Cache String.""" AZURE_SAS = "AzureSAS" - """Azure SAS""" + """Azure SAS.""" AZURE_SERVICE_BUS_STRING = "AzureServiceBusString" - """Azure Service Bus String""" + """Azure Service Bus String.""" AZURE_STORAGE_ACCOUNT_KEY = "AzureStorageAccountKey" - """Azure Storage Account Key""" + """Azure Storage Account Key.""" AZURE_STORAGE_ACCOUNT_GENERIC = "AzureStorageAccountGeneric" - """Azure Storage Account Generic""" + """Azure Storage Account Generic.""" BE_NATIONAL_NUMBER = "BENationalNumber" - """BE National Number""" + """BE National Number.""" BE_NATIONAL_NUMBER_V2 = "BENationalNumberV2" - """BE National Number V2""" + """BE National Number V2.""" BE_VALUE_ADDED_TAX_NUMBER = "BEValueAddedTaxNumber" - """BE Value Added Tax Number""" + """BE Value Added Tax Number.""" BR_CPF_NUMBER = "BRCPFNumber" - """BR CPF Number""" + """BR CPF Number.""" BR_LEGAL_ENTITY_NUMBER = "BRLegalEntityNumber" - """BR Legal Entity Number""" + """BR Legal Entity Number.""" BR_NATIONAL_ID_RG = "BRNationalIDRG" - """BR National ID RG""" + """BR National ID RG.""" BG_UNIFORM_CIVIL_NUMBER = "BGUniformCivilNumber" - """BG Uniform Civil Number""" + """BG Uniform Civil Number.""" CA_BANK_ACCOUNT_NUMBER = "CABankAccountNumber" - """CA Bank Account Number""" + """CA Bank Account Number.""" CA_DRIVERS_LICENSE_NUMBER = "CADriversLicenseNumber" - """CA Driver's License Number""" + """CA Driver's License Number.""" CA_HEALTH_SERVICE_NUMBER = "CAHealthServiceNumber" - """CA Health Service Number""" + """CA Health Service Number.""" CA_PASSPORT_NUMBER = "CAPassportNumber" - """CA Passport Number""" + """CA Passport Number.""" CA_PERSONAL_HEALTH_IDENTIFICATION = "CAPersonalHealthIdentification" - """CA Personal Health Identification""" + """CA Personal Health Identification.""" CA_SOCIAL_INSURANCE_NUMBER = "CASocialInsuranceNumber" - """CA Social Insurance Number""" + """CA Social Insurance Number.""" CL_IDENTITY_CARD_NUMBER = "CLIdentityCardNumber" - """CL Identity Card Number""" + """CL Identity Card Number.""" CN_RESIDENT_IDENTITY_CARD_NUMBER = "CNResidentIdentityCardNumber" - """CN Resident Identity Card Number""" + """CN Resident Identity Card Number.""" CREDIT_CARD_NUMBER = "CreditCardNumber" - """Credit Card Number""" + """Credit Card Number.""" HR_IDENTITY_CARD_NUMBER = "HRIdentityCardNumber" - """HR Identity Card Number""" + """HR Identity Card Number.""" HR_NATIONAL_ID_NUMBER = "HRNationalIDNumber" - """HR National ID Number""" + """HR National ID Number.""" HR_PERSONAL_IDENTIFICATION_NUMBER = "HRPersonalIdentificationNumber" - """HR Personal Identification Number""" + """HR Personal Identification Number.""" HR_PERSONAL_IDENTIFICATION_OIB_NUMBER_V2 = "HRPersonalIdentificationOIBNumberV2" - """HR Personal Identification OIB Number V2""" + """HR Personal Identification OIB Number V2.""" CY_IDENTITY_CARD = "CYIdentityCard" - """CY Identity Card""" + """CY Identity Card.""" CY_TAX_IDENTIFICATION_NUMBER = "CYTaxIdentificationNumber" - """CY Tax Identification Number""" + """CY Tax Identification Number.""" CZ_PERSONAL_IDENTITY_NUMBER = "CZPersonalIdentityNumber" - """CZ Personal Identity Number""" + """CZ Personal Identity Number.""" CZ_PERSONAL_IDENTITY_V2 = "CZPersonalIdentityV2" - """CZ Personal Identity V2""" + """CZ Personal Identity V2.""" DK_PERSONAL_IDENTIFICATION_NUMBER = "DKPersonalIdentificationNumber" - """DK Personal Identification Number""" + """DK Personal Identification Number.""" DK_PERSONAL_IDENTIFICATION_V2 = "DKPersonalIdentificationV2" - """DK Personal Identification V2""" + """DK Personal Identification V2.""" DRUG_ENFORCEMENT_AGENCY_NUMBER = "DrugEnforcementAgencyNumber" - """Drug Enforcement Agency Number""" + """Drug Enforcement Agency Number.""" EE_PERSONAL_IDENTIFICATION_CODE = "EEPersonalIdentificationCode" - """EE Personal Identification Code""" + """EE Personal Identification Code.""" EU_DEBIT_CARD_NUMBER = "EUDebitCardNumber" - """EU Debit Card Number""" + """EU Debit Card Number.""" EU_DRIVERS_LICENSE_NUMBER = "EUDriversLicenseNumber" - """EU Driver's License Number""" + """EU Driver's License Number.""" EU_GPS_COORDINATES = "EUGPSCoordinates" - """EU GPS Coordinates""" + """EU GPS Coordinates.""" EU_NATIONAL_IDENTIFICATION_NUMBER = "EUNationalIdentificationNumber" - """EU National Identification Number""" + """EU National Identification Number.""" EU_PASSPORT_NUMBER = "EUPassportNumber" - """EU Passport Number""" + """EU Passport Number.""" EU_SOCIAL_SECURITY_NUMBER = "EUSocialSecurityNumber" - """EU Social Security Number""" + """EU Social Security Number.""" EU_TAX_IDENTIFICATION_NUMBER = "EUTaxIdentificationNumber" - """EU Tax Identification Number""" + """EU Tax Identification Number.""" FI_EUROPEAN_HEALTH_NUMBER = "FIEuropeanHealthNumber" - """FI European Health Number""" + """FI European Health Number.""" FI_NATIONAL_ID = "FINationalID" - """FI National ID""" + """FI National ID.""" FI_NATIONAL_ID_V2 = "FINationalIDV2" - """FI National ID V2""" + """FI National ID V2.""" FI_PASSPORT_NUMBER = "FIPassportNumber" - """FI Passport Number""" + """FI Passport Number.""" FR_DRIVERS_LICENSE_NUMBER = "FRDriversLicenseNumber" - """FR Driver's License Number""" + """FR Driver's License Number.""" FR_HEALTH_INSURANCE_NUMBER = "FRHealthInsuranceNumber" - """FR Health Insurance Number""" + """FR Health Insurance Number.""" FR_NATIONAL_ID = "FRNationalID" - """FR National ID""" + """FR National ID.""" FR_PASSPORT_NUMBER = "FRPassportNumber" - """FR Passport Number""" + """FR Passport Number.""" FR_SOCIAL_SECURITY_NUMBER = "FRSocialSecurityNumber" - """FR Social Security Number""" + """FR Social Security Number.""" FR_TAX_IDENTIFICATION_NUMBER = "FRTaxIdentificationNumber" - """FR Tax Identification Number""" + """FR Tax Identification Number.""" FR_VALUE_ADDED_TAX_NUMBER = "FRValueAddedTaxNumber" - """FR Value Added Tax Number""" + """FR Value Added Tax Number.""" DE_DRIVERS_LICENSE_NUMBER = "DEDriversLicenseNumber" - """DE Driver's License Number""" + """DE Driver's License Number.""" DE_PASSPORT_NUMBER = "DEPassportNumber" - """DE Passport Number""" + """DE Passport Number.""" DE_IDENTITY_CARD_NUMBER = "DEIdentityCardNumber" - """DE Identity Card Number""" + """DE Identity Card Number.""" DE_TAX_IDENTIFICATION_NUMBER = "DETaxIdentificationNumber" - """DE Tax Identification Number""" + """DE Tax Identification Number.""" DE_VALUE_ADDED_NUMBER = "DEValueAddedNumber" - """DE Value Added Number""" + """DE Value Added Number.""" GR_NATIONAL_ID_CARD = "GRNationalIDCard" - """GR National ID Card""" + """GR National ID Card.""" GR_NATIONAL_ID_V2 = "GRNationalIDV2" - """GR National ID V2""" + """GR National ID V2.""" GR_TAX_IDENTIFICATION_NUMBER = "GRTaxIdentificationNumber" - """GR Tax Identification Number""" + """GR Tax Identification Number.""" HK_IDENTITY_CARD_NUMBER = "HKIdentityCardNumber" - """HK Identity Card Number""" + """HK Identity Card Number.""" HU_VALUE_ADDED_NUMBER = "HUValueAddedNumber" - """HU Value Added Number""" + """HU Value Added Number.""" HU_PERSONAL_IDENTIFICATION_NUMBER = "HUPersonalIdentificationNumber" - """HU Personal Identification Number""" + """HU Personal Identification Number.""" HU_TAX_IDENTIFICATION_NUMBER = "HUTaxIdentificationNumber" - """HU Tax Identification Number""" + """HU Tax Identification Number.""" IN_PERMANENT_ACCOUNT = "INPermanentAccount" - """IN Permanent Account""" + """IN Permanent Account.""" IN_UNIQUE_IDENTIFICATION_NUMBER = "INUniqueIdentificationNumber" - """IN Unique Identification Number""" + """IN Unique Identification Number.""" ID_IDENTITY_CARD_NUMBER = "IDIdentityCardNumber" - """ID Identity Card Number""" + """ID Identity Card Number.""" INTERNATIONAL_BANKING_ACCOUNT_NUMBER = "InternationalBankingAccountNumber" - """International Banking Account Number""" + """International Banking Account Number.""" IE_PERSONAL_PUBLIC_SERVICE_NUMBER = "IEPersonalPublicServiceNumber" - """IE Personal Public Service Number""" + """IE Personal Public Service Number.""" IE_PERSONAL_PUBLIC_SERVICE_NUMBER_V2 = "IEPersonalPublicServiceNumberV2" - """IE Personal Public Service Number V2""" + """IE Personal Public Service Number V2.""" IL_BANK_ACCOUNT_NUMBER = "ILBankAccountNumber" - """IL Bank Account Number""" + """IL Bank Account Number.""" IL_NATIONAL_ID = "ILNationalID" - """IL National ID""" + """IL National ID.""" IT_DRIVERS_LICENSE_NUMBER = "ITDriversLicenseNumber" - """IT Driver's License Number""" + """IT Driver's License Number.""" IT_FISCAL_CODE = "ITFiscalCode" - """IT Fiscal Code""" + """IT Fiscal Code.""" IT_VALUE_ADDED_TAX_NUMBER = "ITValueAddedTaxNumber" - """IT Value Added Tax Number""" + """IT Value Added Tax Number.""" JP_BANK_ACCOUNT_NUMBER = "JPBankAccountNumber" - """JP Bank Account Number""" + """JP Bank Account Number.""" JP_DRIVERS_LICENSE_NUMBER = "JPDriversLicenseNumber" - """JP Driver's License Number""" + """JP Driver's License Number.""" JP_PASSPORT_NUMBER = "JPPassportNumber" - """JP Passport Number""" + """JP Passport Number.""" JP_RESIDENT_REGISTRATION_NUMBER = "JPResidentRegistrationNumber" - """JP Resident Registration Number""" + """JP Resident Registration Number.""" JP_SOCIAL_INSURANCE_NUMBER = "JPSocialInsuranceNumber" - """JP Social Insurance Number""" + """JP Social Insurance Number.""" JP_MY_NUMBER_CORPORATE = "JPMyNumberCorporate" - """JP My Number Corporate""" + """JP My Number Corporate.""" JP_MY_NUMBER_PERSONAL = "JPMyNumberPersonal" - """JP My Number Personal""" + """JP My Number Personal.""" JP_RESIDENCE_CARD_NUMBER = "JPResidenceCardNumber" - """JP Residence Card Number""" + """JP Residence Card Number.""" LV_PERSONAL_CODE = "LVPersonalCode" - """LV Personal Code""" + """LV Personal Code.""" LT_PERSONAL_CODE = "LTPersonalCode" - """LT Personal Code""" + """LT Personal Code.""" LU_NATIONAL_IDENTIFICATION_NUMBER_NATURAL = "LUNationalIdentificationNumberNatural" - """LU National Identification Number Natural""" + """LU National Identification Number Natural.""" LU_NATIONAL_IDENTIFICATION_NUMBER_NON_NATURAL = "LUNationalIdentificationNumberNonNatural" - """LU National Identification Number Non Natural""" + """LU National Identification Number Non Natural.""" MY_IDENTITY_CARD_NUMBER = "MYIdentityCardNumber" - """MY Identity Card Number""" + """MY Identity Card Number.""" MT_IDENTITY_CARD_NUMBER = "MTIdentityCardNumber" - """MT Identity Card Number""" + """MT Identity Card Number.""" MT_TAX_ID_NUMBER = "MTTaxIDNumber" - """MT Tax ID Number""" + """MT Tax ID Number.""" NL_CITIZENS_SERVICE_NUMBER = "NLCitizensServiceNumber" - """NL Citizens Service Number""" + """NL Citizens Service Number.""" NL_CITIZENS_SERVICE_NUMBER_V2 = "NLCitizensServiceNumberV2" - """NL Citizens Service Number V2""" + """NL Citizens Service Number V2.""" NL_TAX_IDENTIFICATION_NUMBER = "NLTaxIdentificationNumber" - """NL Tax Identification Number""" + """NL Tax Identification Number.""" NL_VALUE_ADDED_TAX_NUMBER = "NLValueAddedTaxNumber" - """NL Value Added Tax Number""" + """NL Value Added Tax Number.""" NZ_BANK_ACCOUNT_NUMBER = "NZBankAccountNumber" - """NZ Bank Account Number""" + """NZ Bank Account Number.""" NZ_DRIVERS_LICENSE_NUMBER = "NZDriversLicenseNumber" - """NZ Driver's License Number""" + """NZ Driver's License Number.""" NZ_INLAND_REVENUE_NUMBER = "NZInlandRevenueNumber" - """NZ Inland Revenue Number""" + """NZ Inland Revenue Number.""" NZ_MINISTRY_OF_HEALTH_NUMBER = "NZMinistryOfHealthNumber" - """NZ Ministry Of Health Number""" + """NZ Ministry Of Health Number.""" NZ_SOCIAL_WELFARE_NUMBER = "NZSocialWelfareNumber" - """NZ Social Welfare Number""" + """NZ Social Welfare Number.""" NO_IDENTITY_NUMBER = "NOIdentityNumber" - """NO Identity Number""" + """NO Identity Number.""" PH_UNIFIED_MULTI_PURPOSE_ID_NUMBER = "PHUnifiedMultiPurposeIDNumber" - """PH Unified Multi Purpose ID Number""" + """PH Unified Multi Purpose ID Number.""" PL_IDENTITY_CARD = "PLIdentityCard" - """PL Identity Card""" + """PL Identity Card.""" PL_NATIONAL_ID = "PLNationalID" - """PL National ID""" + """PL National ID.""" PL_NATIONAL_ID_V2 = "PLNationalIDV2" - """PL National ID V2""" + """PL National ID V2.""" PL_PASSPORT_NUMBER = "PLPassportNumber" - """PL Passport Number""" + """PL Passport Number.""" PL_TAX_IDENTIFICATION_NUMBER = "PLTaxIdentificationNumber" - """PL Tax Identification Number""" + """PL Tax Identification Number.""" PL_REGON_NUMBER = "PLREGONNumber" - """PL REGON Number""" + """PL REGON Number.""" PT_CITIZEN_CARD_NUMBER = "PTCitizenCardNumber" - """PT Citizen Card Number""" + """PT Citizen Card Number.""" PT_CITIZEN_CARD_NUMBER_V2 = "PTCitizenCardNumberV2" - """PT Citizen Card Number V2""" + """PT Citizen Card Number V2.""" PT_TAX_IDENTIFICATION_NUMBER = "PTTaxIdentificationNumber" - """PT Tax Identification Number""" + """PT Tax Identification Number.""" RO_PERSONAL_NUMERICAL_CODE = "ROPersonalNumericalCode" - """RO Personal Numerical Code""" + """RO Personal Numerical Code.""" RU_PASSPORT_NUMBER_DOMESTIC = "RUPassportNumberDomestic" - """RU Passport Number Domestic""" + """RU Passport Number Domestic.""" RU_PASSPORT_NUMBER_INTERNATIONAL = "RUPassportNumberInternational" - """RU Passport Number International""" + """RU Passport Number International.""" SA_NATIONAL_ID = "SANationalID" - """SA National ID""" + """SA National ID.""" SG_NATIONAL_REGISTRATION_IDENTITY_CARD_NUMBER = "SGNationalRegistrationIdentityCardNumber" - """SG National Registration Identity Card Number""" + """SG National Registration Identity Card Number.""" SK_PERSONAL_NUMBER = "SKPersonalNumber" - """SK Personal Number""" + """SK Personal Number.""" SI_TAX_IDENTIFICATION_NUMBER = "SITaxIdentificationNumber" - """SI Tax Identification Number""" + """SI Tax Identification Number.""" SI_UNIQUE_MASTER_CITIZEN_NUMBER = "SIUniqueMasterCitizenNumber" - """SI Unique Master Citizen Number""" + """SI Unique Master Citizen Number.""" ZA_IDENTIFICATION_NUMBER = "ZAIdentificationNumber" - """ZA Identification Number""" + """ZA Identification Number.""" KR_RESIDENT_REGISTRATION_NUMBER = "KRResidentRegistrationNumber" - """KR Resident Registration Number""" + """KR Resident Registration Number.""" ES_DNI = "ESDNI" - """ES DNI""" + """ES DNI.""" ES_SOCIAL_SECURITY_NUMBER = "ESSocialSecurityNumber" - """ES Social Security Number""" + """ES Social Security Number.""" ES_TAX_IDENTIFICATION_NUMBER = "ESTaxIdentificationNumber" - """ES Tax Identification Number""" + """ES Tax Identification Number.""" SQL_SERVER_CONNECTION_STRING = "SQLServerConnectionString" - """SQL Server Connection String""" + """SQL Server Connection String.""" SE_NATIONAL_ID = "SENationalID" - """SE National ID""" + """SE National ID.""" SE_NATIONAL_ID_V2 = "SENationalIDV2" - """SE National ID V2""" + """SE National ID V2.""" SE_PASSPORT_NUMBER = "SEPassportNumber" - """SE Passport Number""" + """SE Passport Number.""" SE_TAX_IDENTIFICATION_NUMBER = "SETaxIdentificationNumber" - """SE Tax Identification Number""" + """SE Tax Identification Number.""" SWIFT_CODE = "SWIFTCode" - """SWIFT Code""" + """SWIFT Code.""" CH_SOCIAL_SECURITY_NUMBER = "CHSocialSecurityNumber" - """CH Social Security Number""" + """CH Social Security Number.""" TW_NATIONAL_ID = "TWNationalID" - """TW National ID""" + """TW National ID.""" TW_PASSPORT_NUMBER = "TWPassportNumber" - """TW Passport Number""" + """TW Passport Number.""" TW_RESIDENT_CERTIFICATE = "TWResidentCertificate" - """TW Resident Certificate""" + """TW Resident Certificate.""" TH_POPULATION_IDENTIFICATION_CODE = "THPopulationIdentificationCode" - """TH Population Identification Code""" + """TH Population Identification Code.""" TR_NATIONAL_IDENTIFICATION_NUMBER = "TRNationalIdentificationNumber" - """TR National Identification Number""" + """TR National Identification Number.""" UK_DRIVERS_LICENSE_NUMBER = "UKDriversLicenseNumber" - """UK Driver's License Number""" + """UK Driver's License Number.""" UK_ELECTORAL_ROLL_NUMBER = "UKElectoralRollNumber" - """UK Electoral Roll Number""" + """UK Electoral Roll Number.""" UK_NATIONAL_HEALTH_NUMBER = "UKNationalHealthNumber" - """UK National Health Number""" + """UK National Health Number.""" UK_NATIONAL_INSURANCE_NUMBER = "UKNationalInsuranceNumber" - """UK National Insurance Number""" + """UK National Insurance Number.""" UK_UNIQUE_TAXPAYER_NUMBER = "UKUniqueTaxpayerNumber" - """UK Unique Taxpayer Number""" + """UK Unique Taxpayer Number.""" US_UK_PASSPORT_NUMBER = "USUKPassportNumber" - """US UK Passport Number""" + """US UK Passport Number.""" US_BANK_ACCOUNT_NUMBER = "USBankAccountNumber" - """US Bank Account Number""" + """US Bank Account Number.""" US_DRIVERS_LICENSE_NUMBER = "USDriversLicenseNumber" - """US Driver's License Number""" + """US Driver's License Number.""" US_INDIVIDUAL_TAXPAYER_IDENTIFICATION = "USIndividualTaxpayerIdentification" - """US Individual Taxpayer Identification""" + """US Individual Taxpayer Identification.""" US_SOCIAL_SECURITY_NUMBER = "USSocialSecurityNumber" - """US Social Security Number""" + """US Social Security Number.""" UA_PASSPORT_NUMBER_DOMESTIC = "UAPassportNumberDomestic" - """UA Passport Number Domestic""" + """UA Passport Number Domestic.""" UA_PASSPORT_NUMBER_INTERNATIONAL = "UAPassportNumberInternational" - """UA Passport Number International""" + """UA Passport Number International.""" ORGANIZATION = "Organization" - """Organization""" + """Organization.""" EMAIL = "Email" - """Email""" + """Email.""" URL = "URL" - """URL""" + """URL.""" AGE = "Age" - """Age""" + """Age.""" PHONE_NUMBER = "PhoneNumber" - """Phone Number""" + """Phone Number.""" IP_ADDRESS = "IPAddress" - """IP Address""" + """IP Address.""" DATE = "Date" - """Date""" + """Date.""" PERSON = "Person" - """Person""" + """Person.""" ADDRESS = "Address" - """Address""" + """Address.""" DATE_OF_BIRTH = "DateOfBirth" - """Date Of Birth""" + """Date Of Birth.""" BANK_ACCOUNT_NUMBER = "BankAccountNumber" - """Bank Account Number""" + """Bank Account Number.""" PASSPORT_NUMBER = "PassportNumber" - """Passport Number""" + """Passport Number.""" DRIVERS_LICENSE_NUMBER = "DriversLicenseNumber" - """Drivers License Number""" + """Drivers License Number.""" NEIGHBORHOOD = "Neighborhood" - """Neighborhood""" + """Neighborhood.""" SORT_CODE = "SortCode" """Sort Code. 6-digit number used in the UK to identify a specific bank and branch where a bank - account is held""" + account is held.""" PIN = "PIN" - """PIN""" + """PIN.""" VIN = "VIN" - """VIN""" + """VIN.""" VEHICLE_IDENTIFICATION_NUMBER = "VehicleIdentificationNumber" - """VIN""" + """VIN.""" LICENSE_PLATE = "LicensePlate" - """License Plate""" + """License Plate.""" KR_PASSPORT_NUMBER = "KRPassportNumber" - """KR Passport Number""" + """KR Passport Number.""" KR_DRIVERS_LICENSE_NUMBER = "KRDriversLicenseNumber" - """KR Driver's License Number""" + """KR Driver's License Number.""" KR_SOCIAL_SECURITY_NUMBER = "KRSocialSecurityNumber" - """KR Social Security Number""" + """KR Social Security Number.""" GOVERNMENT_ISSUED_ID = "GovernmentIssuedId" - """Government Issued ID""" + """Government Issued ID.""" PASSWORD = "Password" - """Password""" + """Password.""" NATIONAL_ID = "NationalId" - """National Identification""" + """National Identification.""" ZIP_CODE = "ZipCode" - """Zip Code""" + """Zip Code.""" CVV = "CVV" - """Card Verification Value""" + """Card Verification Value.""" EXPIRATION_DATE = "ExpirationDate" - """Expiration Date""" + """Expiration Date.""" CA_SOCIAL_IDENTIFICATION_NUMBER = "CASocialIdentificationNumber" - """CA Social Identification Number""" + """CA Social Identification Number.""" MEDICARE_BENEFICIARY_ID = "USMedicareBeneficiaryId" - """Medicare Beneficiary ID""" + """Medicare Beneficiary ID.""" LOCATION = "Location" - """Location""" + """Location.""" CITY = "City" - """City""" + """City.""" STATE = "State" - """State""" + """State.""" AIRPORT = "Airport" - """Airport""" + """Airport.""" GPE = "GPE" - """Geopolitical Entity""" + """Geopolitical Entity.""" class PiiCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): """(Optional) describes the PII categories to return.""" ABA_ROUTING_NUMBER = "ABARoutingNumber" - """ABA Routing number""" + """ABA Routing number.""" AR_NATIONAL_IDENTITY_NUMBER = "ARNationalIdentityNumber" - """AR National Identity Number""" + """AR National Identity Number.""" AU_BANK_ACCOUNT_NUMBER = "AUBankAccountNumber" - """AT Bank Account Number""" + """AT Bank Account Number.""" AU_DRIVERS_LICENSE_NUMBER = "AUDriversLicenseNumber" - """AU Driver's License Number""" + """AU Driver's License Number.""" AU_MEDICAL_ACCOUNT_NUMBER = "AUMedicalAccountNumber" - """AU Medical Account Number""" + """AU Medical Account Number.""" AU_PASSPORT_NUMBER = "AUPassportNumber" - """AU Passport Number""" + """AU Passport Number.""" AU_TAX_FILE_NUMBER = "AUTaxFileNumber" - """AU Tax File Number""" + """AU Tax File Number.""" AU_BUSINESS_NUMBER = "AUBusinessNumber" - """AU Business Number""" + """AU Business Number.""" AU_COMPANY_NUMBER = "AUCompanyNumber" - """AU Company Number""" + """AU Company Number.""" AT_IDENTITY_CARD = "ATIdentityCard" - """AT Identity Card""" + """AT Identity Card.""" AT_TAX_IDENTIFICATION_NUMBER = "ATTaxIdentificationNumber" - """AT Tax Identification Number""" + """AT Tax Identification Number.""" AT_VALUE_ADDED_TAX_NUMBER = "ATValueAddedTaxNumber" - """AT Value Added Tax Number""" + """AT Value Added Tax Number.""" AZURE_DOCUMENT_DBAUTH_KEY = "AzureDocumentDBAuthKey" - """Azure Document DB Auth Key""" + """Azure Document DB Auth Key.""" AZURE_IAAS_DATABASE_CONNECTION_AND_SQL_STRING = "AzureIAASDatabaseConnectionAndSQLString" - """Azure IAAS Database Connection And SQL String""" + """Azure IAAS Database Connection And SQL String.""" AZURE_IO_T_CONNECTION_STRING = "AzureIoTConnectionString" - """Azure IoT Connection String""" + """Azure IoT Connection String.""" AZURE_PUBLISH_SETTING_PASSWORD = "AzurePublishSettingPassword" - """Azure Publish Setting Password""" + """Azure Publish Setting Password.""" AZURE_REDIS_CACHE_STRING = "AzureRedisCacheString" - """Azure Redis Cache String""" + """Azure Redis Cache String.""" AZURE_SAS = "AzureSAS" - """Azure SAS""" + """Azure SAS.""" AZURE_SERVICE_BUS_STRING = "AzureServiceBusString" - """Azure Service Bus String""" + """Azure Service Bus String.""" AZURE_STORAGE_ACCOUNT_KEY = "AzureStorageAccountKey" - """Azure Storage Account Key""" + """Azure Storage Account Key.""" AZURE_STORAGE_ACCOUNT_GENERIC = "AzureStorageAccountGeneric" - """Azure Storage Account Generic""" + """Azure Storage Account Generic.""" BE_NATIONAL_NUMBER = "BENationalNumber" - """BE National Number""" + """BE National Number.""" BE_NATIONAL_NUMBER_V2 = "BENationalNumberV2" - """BE National Number V2""" + """BE National Number V2.""" BE_VALUE_ADDED_TAX_NUMBER = "BEValueAddedTaxNumber" - """BE Value Added Tax Number""" + """BE Value Added Tax Number.""" BR_CPF_NUMBER = "BRCPFNumber" - """BR CPF Number""" + """BR CPF Number.""" BR_LEGAL_ENTITY_NUMBER = "BRLegalEntityNumber" - """BR Legal Entity Number""" + """BR Legal Entity Number.""" BR_NATIONAL_ID_RG = "BRNationalIDRG" - """BR National ID RG""" + """BR National ID RG.""" BG_UNIFORM_CIVIL_NUMBER = "BGUniformCivilNumber" - """BG Uniform Civil Number""" + """BG Uniform Civil Number.""" CA_BANK_ACCOUNT_NUMBER = "CABankAccountNumber" - """CA Bank Account Number""" + """CA Bank Account Number.""" CA_DRIVERS_LICENSE_NUMBER = "CADriversLicenseNumber" - """CA Driver's License Number""" + """CA Driver's License Number.""" CA_HEALTH_SERVICE_NUMBER = "CAHealthServiceNumber" - """CA Health Service Number""" + """CA Health Service Number.""" CA_PASSPORT_NUMBER = "CAPassportNumber" - """CA Passport Number""" + """CA Passport Number.""" CA_PERSONAL_HEALTH_IDENTIFICATION = "CAPersonalHealthIdentification" - """CA Personal Health Identification""" + """CA Personal Health Identification.""" CA_SOCIAL_INSURANCE_NUMBER = "CASocialInsuranceNumber" - """CA Social Insurance Number""" + """CA Social Insurance Number.""" CL_IDENTITY_CARD_NUMBER = "CLIdentityCardNumber" - """CL Identity Card Number""" + """CL Identity Card Number.""" CN_RESIDENT_IDENTITY_CARD_NUMBER = "CNResidentIdentityCardNumber" - """CN Resident Identity Card Number""" + """CN Resident Identity Card Number.""" CREDIT_CARD_NUMBER = "CreditCardNumber" - """Credit Card Number""" + """Credit Card Number.""" HR_IDENTITY_CARD_NUMBER = "HRIdentityCardNumber" - """HR Identity Card Number""" + """HR Identity Card Number.""" HR_NATIONAL_ID_NUMBER = "HRNationalIDNumber" - """HR National ID Number""" + """HR National ID Number.""" HR_PERSONAL_IDENTIFICATION_NUMBER = "HRPersonalIdentificationNumber" - """HR Personal Identification Number""" + """HR Personal Identification Number.""" HR_PERSONAL_IDENTIFICATION_OIB_NUMBER_V2 = "HRPersonalIdentificationOIBNumberV2" - """HR Personal Identification OIB Number V2""" + """HR Personal Identification OIB Number V2.""" CY_IDENTITY_CARD = "CYIdentityCard" - """CY Identity Card""" + """CY Identity Card.""" CY_TAX_IDENTIFICATION_NUMBER = "CYTaxIdentificationNumber" - """CY Tax Identification Number""" + """CY Tax Identification Number.""" CZ_PERSONAL_IDENTITY_NUMBER = "CZPersonalIdentityNumber" - """CZ Personal Identity Number""" + """CZ Personal Identity Number.""" CZ_PERSONAL_IDENTITY_V2 = "CZPersonalIdentityV2" - """CZ Personal Identity V2""" + """CZ Personal Identity V2.""" DK_PERSONAL_IDENTIFICATION_NUMBER = "DKPersonalIdentificationNumber" - """DK Personal Identification Number""" + """DK Personal Identification Number.""" DK_PERSONAL_IDENTIFICATION_V2 = "DKPersonalIdentificationV2" - """DK Personal Identification V2""" + """DK Personal Identification V2.""" DRUG_ENFORCEMENT_AGENCY_NUMBER = "DrugEnforcementAgencyNumber" - """Drug Enforcement Agency Number""" + """Drug Enforcement Agency Number.""" EE_PERSONAL_IDENTIFICATION_CODE = "EEPersonalIdentificationCode" - """EE Personal Identification Code""" + """EE Personal Identification Code.""" EU_DEBIT_CARD_NUMBER = "EUDebitCardNumber" - """EU Debit Card Number""" + """EU Debit Card Number.""" EU_DRIVERS_LICENSE_NUMBER = "EUDriversLicenseNumber" - """EU Driver's License Number""" + """EU Driver's License Number.""" EU_GPS_COORDINATES = "EUGPSCoordinates" - """EU GPS Coordinates""" + """EU GPS Coordinates.""" EU_NATIONAL_IDENTIFICATION_NUMBER = "EUNationalIdentificationNumber" - """EU National Identification Number""" + """EU National Identification Number.""" EU_PASSPORT_NUMBER = "EUPassportNumber" - """EU Passport Number""" + """EU Passport Number.""" EU_SOCIAL_SECURITY_NUMBER = "EUSocialSecurityNumber" - """EU Social Security Number""" + """EU Social Security Number.""" EU_TAX_IDENTIFICATION_NUMBER = "EUTaxIdentificationNumber" - """EU Tax Identification Number""" + """EU Tax Identification Number.""" FI_EUROPEAN_HEALTH_NUMBER = "FIEuropeanHealthNumber" - """FI European Health Number""" + """FI European Health Number.""" FI_NATIONAL_ID = "FINationalID" - """FI National ID""" + """FI National ID.""" FI_NATIONAL_ID_V2 = "FINationalIDV2" - """FI National ID V2""" + """FI National ID V2.""" FI_PASSPORT_NUMBER = "FIPassportNumber" - """FI Passport Number""" + """FI Passport Number.""" FR_DRIVERS_LICENSE_NUMBER = "FRDriversLicenseNumber" - """FR Driver's License Number""" + """FR Driver's License Number.""" FR_HEALTH_INSURANCE_NUMBER = "FRHealthInsuranceNumber" - """FR Health Insurance Number""" + """FR Health Insurance Number.""" FR_NATIONAL_ID = "FRNationalID" - """FR National ID""" + """FR National ID.""" FR_PASSPORT_NUMBER = "FRPassportNumber" - """FR Passport Number""" + """FR Passport Number.""" FR_SOCIAL_SECURITY_NUMBER = "FRSocialSecurityNumber" - """FR Social Security Number""" + """FR Social Security Number.""" FR_TAX_IDENTIFICATION_NUMBER = "FRTaxIdentificationNumber" - """FR Tax Identification Number""" + """FR Tax Identification Number.""" FR_VALUE_ADDED_TAX_NUMBER = "FRValueAddedTaxNumber" - """FR Value Added Tax Number""" + """FR Value Added Tax Number.""" DE_DRIVERS_LICENSE_NUMBER = "DEDriversLicenseNumber" - """DE Driver's License Number""" + """DE Driver's License Number.""" DE_PASSPORT_NUMBER = "DEPassportNumber" - """DE Passport Number""" + """DE Passport Number.""" DE_IDENTITY_CARD_NUMBER = "DEIdentityCardNumber" - """DE Identity Card Number""" + """DE Identity Card Number.""" DE_TAX_IDENTIFICATION_NUMBER = "DETaxIdentificationNumber" - """DE Tax Identification Number""" + """DE Tax Identification Number.""" DE_VALUE_ADDED_NUMBER = "DEValueAddedNumber" - """DE Value Added Number""" + """DE Value Added Number.""" GR_NATIONAL_ID_CARD = "GRNationalIDCard" - """GR National ID Card""" + """GR National ID Card.""" GR_NATIONAL_ID_V2 = "GRNationalIDV2" - """GR National ID V2""" + """GR National ID V2.""" GR_TAX_IDENTIFICATION_NUMBER = "GRTaxIdentificationNumber" - """GR Tax Identification Number""" + """GR Tax Identification Number.""" HK_IDENTITY_CARD_NUMBER = "HKIdentityCardNumber" - """HK Identity Card Number""" + """HK Identity Card Number.""" HU_VALUE_ADDED_NUMBER = "HUValueAddedNumber" - """HU Value Added Number""" + """HU Value Added Number.""" HU_PERSONAL_IDENTIFICATION_NUMBER = "HUPersonalIdentificationNumber" - """HU Personal Identification Number""" + """HU Personal Identification Number.""" HU_TAX_IDENTIFICATION_NUMBER = "HUTaxIdentificationNumber" - """HU Tax Identification Number""" + """HU Tax Identification Number.""" IN_PERMANENT_ACCOUNT = "INPermanentAccount" - """IN Permanent Account""" + """IN Permanent Account.""" IN_UNIQUE_IDENTIFICATION_NUMBER = "INUniqueIdentificationNumber" - """IN Unique Identification Number""" + """IN Unique Identification Number.""" ID_IDENTITY_CARD_NUMBER = "IDIdentityCardNumber" - """ID Identity Card Number""" + """ID Identity Card Number.""" INTERNATIONAL_BANKING_ACCOUNT_NUMBER = "InternationalBankingAccountNumber" - """International Banking Account Number""" + """International Banking Account Number.""" IE_PERSONAL_PUBLIC_SERVICE_NUMBER = "IEPersonalPublicServiceNumber" - """IE Personal Public Service Number""" + """IE Personal Public Service Number.""" IE_PERSONAL_PUBLIC_SERVICE_NUMBER_V2 = "IEPersonalPublicServiceNumberV2" - """IE Personal Public Service Number V2""" + """IE Personal Public Service Number V2.""" IL_BANK_ACCOUNT_NUMBER = "ILBankAccountNumber" - """IL Bank Account Number""" + """IL Bank Account Number.""" IL_NATIONAL_ID = "ILNationalID" - """IL National ID""" + """IL National ID.""" IT_DRIVERS_LICENSE_NUMBER = "ITDriversLicenseNumber" - """IT Driver's License Number""" + """IT Driver's License Number.""" IT_FISCAL_CODE = "ITFiscalCode" - """IT Fiscal Code""" + """IT Fiscal Code.""" IT_VALUE_ADDED_TAX_NUMBER = "ITValueAddedTaxNumber" - """IT Value Added Tax Number""" + """IT Value Added Tax Number.""" JP_BANK_ACCOUNT_NUMBER = "JPBankAccountNumber" - """JP Bank Account Number""" + """JP Bank Account Number.""" JP_DRIVERS_LICENSE_NUMBER = "JPDriversLicenseNumber" - """JP Driver's License Number""" + """JP Driver's License Number.""" JP_PASSPORT_NUMBER = "JPPassportNumber" - """JP Passport Number""" + """JP Passport Number.""" JP_RESIDENT_REGISTRATION_NUMBER = "JPResidentRegistrationNumber" - """JP Resident Registration Number""" + """JP Resident Registration Number.""" JP_SOCIAL_INSURANCE_NUMBER = "JPSocialInsuranceNumber" - """JP Social Insurance Number""" + """JP Social Insurance Number.""" JP_MY_NUMBER_CORPORATE = "JPMyNumberCorporate" - """JP My Number Corporate""" + """JP My Number Corporate.""" JP_MY_NUMBER_PERSONAL = "JPMyNumberPersonal" - """JP My Number Personal""" + """JP My Number Personal.""" JP_RESIDENCE_CARD_NUMBER = "JPResidenceCardNumber" - """JP Residence Card Number""" + """JP Residence Card Number.""" LV_PERSONAL_CODE = "LVPersonalCode" - """LV Personal Code""" + """LV Personal Code.""" LT_PERSONAL_CODE = "LTPersonalCode" - """LT Personal Code""" + """LT Personal Code.""" LU_NATIONAL_IDENTIFICATION_NUMBER_NATURAL = "LUNationalIdentificationNumberNatural" - """LU National Identification Number Natural""" + """LU National Identification Number Natural.""" LU_NATIONAL_IDENTIFICATION_NUMBER_NON_NATURAL = "LUNationalIdentificationNumberNonNatural" - """LU National Identification Number Non Natural""" + """LU National Identification Number Non Natural.""" MY_IDENTITY_CARD_NUMBER = "MYIdentityCardNumber" - """MY Identity Card Number""" + """MY Identity Card Number.""" MT_IDENTITY_CARD_NUMBER = "MTIdentityCardNumber" - """MT Identity Card Number""" + """MT Identity Card Number.""" MT_TAX_ID_NUMBER = "MTTaxIDNumber" - """MT Tax ID Number""" + """MT Tax ID Number.""" NL_CITIZENS_SERVICE_NUMBER = "NLCitizensServiceNumber" - """NL Citizens Service Number""" + """NL Citizens Service Number.""" NL_CITIZENS_SERVICE_NUMBER_V2 = "NLCitizensServiceNumberV2" - """NL Citizens Service Number V2""" + """NL Citizens Service Number V2.""" NL_TAX_IDENTIFICATION_NUMBER = "NLTaxIdentificationNumber" - """NL Tax Identification Number""" + """NL Tax Identification Number.""" NL_VALUE_ADDED_TAX_NUMBER = "NLValueAddedTaxNumber" - """NL Value Added Tax Number""" + """NL Value Added Tax Number.""" NZ_BANK_ACCOUNT_NUMBER = "NZBankAccountNumber" - """NZ Bank Account Number""" + """NZ Bank Account Number.""" NZ_DRIVERS_LICENSE_NUMBER = "NZDriversLicenseNumber" - """NZ Driver's License Number""" + """NZ Driver's License Number.""" NZ_INLAND_REVENUE_NUMBER = "NZInlandRevenueNumber" - """NZ Inland Revenue Number""" + """NZ Inland Revenue Number.""" NZ_MINISTRY_OF_HEALTH_NUMBER = "NZMinistryOfHealthNumber" - """NZ Ministry Of Health Number""" + """NZ Ministry Of Health Number.""" NZ_SOCIAL_WELFARE_NUMBER = "NZSocialWelfareNumber" - """NZ Social Welfare Number""" + """NZ Social Welfare Number.""" NO_IDENTITY_NUMBER = "NOIdentityNumber" - """NO Identity Number""" + """NO Identity Number.""" PH_UNIFIED_MULTI_PURPOSE_ID_NUMBER = "PHUnifiedMultiPurposeIDNumber" - """PH Unified Multi Purpose ID Number""" + """PH Unified Multi Purpose ID Number.""" PL_IDENTITY_CARD = "PLIdentityCard" - """PL Identity Card""" + """PL Identity Card.""" PL_NATIONAL_ID = "PLNationalID" - """PL National ID""" + """PL National ID.""" PL_NATIONAL_ID_V2 = "PLNationalIDV2" - """PL National ID V2""" + """PL National ID V2.""" PL_PASSPORT_NUMBER = "PLPassportNumber" - """PL Passport Number""" + """PL Passport Number.""" PL_TAX_IDENTIFICATION_NUMBER = "PLTaxIdentificationNumber" - """PL Tax Identification Number""" + """PL Tax Identification Number.""" PL_REGON_NUMBER = "PLREGONNumber" - """PL REGON Number""" + """PL REGON Number.""" PT_CITIZEN_CARD_NUMBER = "PTCitizenCardNumber" - """PT Citizen Card Number""" + """PT Citizen Card Number.""" PT_CITIZEN_CARD_NUMBER_V2 = "PTCitizenCardNumberV2" - """PT Citizen Card Number V2""" + """PT Citizen Card Number V2.""" PT_TAX_IDENTIFICATION_NUMBER = "PTTaxIdentificationNumber" - """PT Tax Identification Number""" + """PT Tax Identification Number.""" RO_PERSONAL_NUMERICAL_CODE = "ROPersonalNumericalCode" - """RO Personal Numerical Code""" + """RO Personal Numerical Code.""" RU_PASSPORT_NUMBER_DOMESTIC = "RUPassportNumberDomestic" - """RU Passport Number Domestic""" + """RU Passport Number Domestic.""" RU_PASSPORT_NUMBER_INTERNATIONAL = "RUPassportNumberInternational" - """RU Passport Number International""" + """RU Passport Number International.""" SA_NATIONAL_ID = "SANationalID" - """SA National ID""" + """SA National ID.""" SG_NATIONAL_REGISTRATION_IDENTITY_CARD_NUMBER = "SGNationalRegistrationIdentityCardNumber" - """SG National Registration Identity Card Number""" + """SG National Registration Identity Card Number.""" SK_PERSONAL_NUMBER = "SKPersonalNumber" - """SK Personal Number""" + """SK Personal Number.""" SI_TAX_IDENTIFICATION_NUMBER = "SITaxIdentificationNumber" - """SI Tax Identification Number""" + """SI Tax Identification Number.""" SI_UNIQUE_MASTER_CITIZEN_NUMBER = "SIUniqueMasterCitizenNumber" - """SI Unique Master Citizen Number""" + """SI Unique Master Citizen Number.""" ZA_IDENTIFICATION_NUMBER = "ZAIdentificationNumber" - """ZA Identification Number""" + """ZA Identification Number.""" KR_RESIDENT_REGISTRATION_NUMBER = "KRResidentRegistrationNumber" - """KR Resident Registration Number""" + """KR Resident Registration Number.""" ES_DNI = "ESDNI" - """ES DNI""" + """ES DNI.""" ES_SOCIAL_SECURITY_NUMBER = "ESSocialSecurityNumber" - """ES Social Security Number""" + """ES Social Security Number.""" ES_TAX_IDENTIFICATION_NUMBER = "ESTaxIdentificationNumber" - """ES Tax Identification Number""" + """ES Tax Identification Number.""" SQL_SERVER_CONNECTION_STRING = "SQLServerConnectionString" - """SQL Server Connection String""" + """SQL Server Connection String.""" SE_NATIONAL_ID = "SENationalID" - """SE National ID""" + """SE National ID.""" SE_NATIONAL_ID_V2 = "SENationalIDV2" - """SE National ID V2""" + """SE National ID V2.""" SE_PASSPORT_NUMBER = "SEPassportNumber" - """SE Passport Number""" + """SE Passport Number.""" SE_TAX_IDENTIFICATION_NUMBER = "SETaxIdentificationNumber" - """SE Tax Identification Number""" + """SE Tax Identification Number.""" SWIFT_CODE = "SWIFTCode" - """SWIFT Code""" + """SWIFT Code.""" CH_SOCIAL_SECURITY_NUMBER = "CHSocialSecurityNumber" - """CH Social Security Number""" + """CH Social Security Number.""" TW_NATIONAL_ID = "TWNationalID" - """TW National ID""" + """TW National ID.""" TW_PASSPORT_NUMBER = "TWPassportNumber" - """TW Passport Number""" + """TW Passport Number.""" TW_RESIDENT_CERTIFICATE = "TWResidentCertificate" - """TW Resident Certificate""" + """TW Resident Certificate.""" TH_POPULATION_IDENTIFICATION_CODE = "THPopulationIdentificationCode" - """TH Population Identification Code""" + """TH Population Identification Code.""" TR_NATIONAL_IDENTIFICATION_NUMBER = "TRNationalIdentificationNumber" - """TR National Identification Number""" + """TR National Identification Number.""" UK_DRIVERS_LICENSE_NUMBER = "UKDriversLicenseNumber" - """UK Driver's License Number""" + """UK Driver's License Number.""" UK_ELECTORAL_ROLL_NUMBER = "UKElectoralRollNumber" - """UK Electoral Roll Number""" + """UK Electoral Roll Number.""" UK_NATIONAL_HEALTH_NUMBER = "UKNationalHealthNumber" - """UK National Health Number""" + """UK National Health Number.""" UK_NATIONAL_INSURANCE_NUMBER = "UKNationalInsuranceNumber" - """UK National Insurance Number""" + """UK National Insurance Number.""" UK_UNIQUE_TAXPAYER_NUMBER = "UKUniqueTaxpayerNumber" - """UK Unique Taxpayer Number""" + """UK Unique Taxpayer Number.""" US_UK_PASSPORT_NUMBER = "USUKPassportNumber" - """US UK Passport Number""" + """US UK Passport Number.""" US_BANK_ACCOUNT_NUMBER = "USBankAccountNumber" - """US Bank Account Number""" + """US Bank Account Number.""" US_DRIVERS_LICENSE_NUMBER = "USDriversLicenseNumber" - """US Driver's License Number""" + """US Driver's License Number.""" US_INDIVIDUAL_TAXPAYER_IDENTIFICATION = "USIndividualTaxpayerIdentification" - """US Individual Taxpayer Identification""" + """US Individual Taxpayer Identification.""" US_SOCIAL_SECURITY_NUMBER = "USSocialSecurityNumber" - """US Social Security Number""" + """US Social Security Number.""" UA_PASSPORT_NUMBER_DOMESTIC = "UAPassportNumberDomestic" - """UA Passport Number Domestic""" + """UA Passport Number Domestic.""" UA_PASSPORT_NUMBER_INTERNATIONAL = "UAPassportNumberInternational" - """UA Passport Number International""" + """UA Passport Number International.""" ORGANIZATION = "Organization" - """Organization""" + """Organization.""" EMAIL = "Email" - """Email""" + """Email.""" URL = "URL" - """URL""" + """URL.""" AGE = "Age" - """Age""" + """Age.""" PHONE_NUMBER = "PhoneNumber" - """Phone Number""" + """Phone Number.""" IP_ADDRESS = "IPAddress" - """IP Address""" + """IP Address.""" DATE = "Date" - """Date""" + """Date.""" PERSON = "Person" - """Person""" + """Person.""" ADDRESS = "Address" - """Address""" + """Address.""" DATE_OF_BIRTH = "DateOfBirth" - """Date Of Birth""" + """Date Of Birth.""" BANK_ACCOUNT_NUMBER = "BankAccountNumber" - """Bank Account Number""" + """Bank Account Number.""" PASSPORT_NUMBER = "PassportNumber" - """Passport Number""" + """Passport Number.""" DRIVERS_LICENSE_NUMBER = "DriversLicenseNumber" - """Drivers License Number""" + """Drivers License Number.""" NEIGHBORHOOD = "Neighborhood" - """Neighborhood""" + """Neighborhood.""" SORT_CODE = "SortCode" """Sort Code. 6-digit number used in the UK to identify a specific bank and branch where a bank - account is held""" + account is held.""" PIN = "PIN" - """PIN""" + """PIN.""" VIN = "VIN" - """VIN""" + """VIN.""" VEHICLE_IDENTIFICATION_NUMBER = "VehicleIdentificationNumber" - """VIN""" + """VIN.""" LICENSE_PLATE = "LicensePlate" - """License Plate""" + """License Plate.""" KR_PASSPORT_NUMBER = "KRPassportNumber" - """KR Passport Number""" + """KR Passport Number.""" KR_DRIVERS_LICENSE_NUMBER = "KRDriversLicenseNumber" - """KR Driver's License Number""" + """KR Driver's License Number.""" KR_SOCIAL_SECURITY_NUMBER = "KRSocialSecurityNumber" - """KR Social Security Number""" + """KR Social Security Number.""" GOVERNMENT_ISSUED_ID = "GovernmentIssuedId" - """Government Issued ID""" + """Government Issued ID.""" PASSWORD = "Password" - """Password""" + """Password.""" NATIONAL_ID = "NationalId" - """National Identification""" + """National Identification.""" ZIP_CODE = "ZipCode" - """Zip Code""" + """Zip Code.""" CVV = "CVV" - """Card Verification Value""" + """Card Verification Value.""" EXPIRATION_DATE = "ExpirationDate" - """Expiration Date""" + """Expiration Date.""" CA_SOCIAL_IDENTIFICATION_NUMBER = "CASocialIdentificationNumber" - """CA Social Identification Number""" + """CA Social Identification Number.""" MEDICARE_BENEFICIARY_ID = "USMedicareBeneficiaryId" - """Medicare Beneficiary ID""" + """Medicare Beneficiary ID.""" LOCATION = "Location" - """Location""" + """Location.""" CITY = "City" - """City""" + """City.""" STATE = "State" - """State""" + """State.""" AIRPORT = "Airport" - """Airport""" + """Airport.""" GPE = "GPE" - """Geopolitical Entity""" + """Geopolitical Entity.""" ALL = "All" """All PII categories.""" DEFAULT = "Default" @@ -1453,47 +1453,47 @@ class PolicyKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Kinds of overlap policies supported.""" MATCH_LONGEST = "matchLongest" - """Represents MatchLongestEntityPolicyType""" + """Represents MatchLongestEntityPolicyType.""" ALLOW_OVERLAP = "allowOverlap" - """Represents AllowOverlapEntityPolicyType""" + """Represents AllowOverlapEntityPolicyType.""" class RangeInclusivity(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The range inclusiveness of this property property.""" NONE_INCLUSIVE = "NoneInclusive" - """No inclusivity""" + """No inclusivity.""" LEFT_INCLUSIVE = "LeftInclusive" - """Left side inclusive""" + """Left side inclusive.""" RIGHT_INCLUSIVE = "RightInclusive" - """Right side inclusive""" + """Right side inclusive.""" LEFT_RIGHT_INCLUSIVE = "LeftRightInclusive" - """Both sides inclusive""" + """Both sides inclusive.""" class RangeKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of the number range entity.""" NUMBER = "Number" - """Number range""" + """Number range.""" SPEED = "Speed" - """Speed range""" + """Speed range.""" WEIGHT = "Weight" - """Weight range""" + """Weight range.""" LENGTH = "Length" - """Length range""" + """Length range.""" VOLUME = "Volume" - """Volume range""" + """Volume range.""" AREA = "Area" - """Area range""" + """Area range.""" AGE = "Age" - """Age range""" + """Age range.""" INFORMATION = "Information" - """Information range""" + """Information range.""" TEMPERATURE = "Temperature" - """Temperature range""" + """Temperature range.""" CURRENCY = "Currency" - """Currency range""" + """Currency range.""" class RedactionCharacter(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -1502,33 +1502,33 @@ class RedactionCharacter(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ EXCLAMATION_POINT = "!" - """Exclamation point character""" + """Exclamation point character.""" NUMBER_SIGN = "#" - """Number sign character""" + """Number sign character.""" DOLLAR = "$" - """Dollar sign character""" + """Dollar sign character.""" PER_CENT = "%" - """Percent sign character""" + """Percent sign character.""" AMPERSAND = "&" - """Ampersand character""" + """Ampersand character.""" ASTERISK = "*" - """Asterisk character""" + """Asterisk character.""" PLUS = "+" - """Plus sign character""" + """Plus sign character.""" MINUS = "-" - """Minus sign character""" + """Minus sign character.""" EQUALS = "=" - """Equals sign character""" + """Equals sign character.""" QUESTION_MARK = "?" - """Question mark character""" + """Question mark character.""" AT_SIGN = "@" - """At sign character""" + """At sign character.""" CARET = "^" - """Caret character""" + """Caret character.""" UNDERSCORE = "_" - """Underscore character""" + """Underscore character.""" TILDE = "~" - """Tilde character""" + """Tilde character.""" class RedactionPolicyKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -1548,86 +1548,86 @@ class RelationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of relation. Examples include: ``DosageOfMedication`` or 'FrequencyOfMedication', etc.""" ABBREVIATION = "Abbreviation" - """Abbreviation""" + """Abbreviation.""" DIRECTION_OF_BODY_STRUCTURE = "DirectionOfBodyStructure" - """Direction of body structure""" + """Direction of body structure.""" DIRECTION_OF_CONDITION = "DirectionOfCondition" - """Direction of condition""" + """Direction of condition.""" DIRECTION_OF_EXAMINATION = "DirectionOfExamination" - """Direction of examination""" + """Direction of examination.""" DIRECTION_OF_TREATMENT = "DirectionOfTreatment" - """Direction of treatment""" + """Direction of treatment.""" DOSAGE_OF_MEDICATION = "DosageOfMedication" - """Dosage of medication""" + """Dosage of medication.""" FORM_OF_MEDICATION = "FormOfMedication" - """Form of medication""" + """Form of medication.""" FREQUENCY_OF_MEDICATION = "FrequencyOfMedication" - """Frequency of medication""" + """Frequency of medication.""" FREQUENCY_OF_TREATMENT = "FrequencyOfTreatment" - """Frequency of treatment""" + """Frequency of treatment.""" QUALIFIER_OF_CONDITION = "QualifierOfCondition" - """Qualifier of condition""" + """Qualifier of condition.""" RELATION_OF_EXAMINATION = "RelationOfExamination" - """Relation of examination""" + """Relation of examination.""" ROUTE_OF_MEDICATION = "RouteOfMedication" - """Route of medication""" + """Route of medication.""" TIME_OF_CONDITION = "TimeOfCondition" - """Time of condition""" + """Time of condition.""" TIME_OF_EVENT = "TimeOfEvent" - """Time of event""" + """Time of event.""" TIME_OF_EXAMINATION = "TimeOfExamination" - """Time of examination""" + """Time of examination.""" TIME_OF_MEDICATION = "TimeOfMedication" - """Time of medication""" + """Time of medication.""" TIME_OF_TREATMENT = "TimeOfTreatment" - """Time of treatment""" + """Time of treatment.""" UNIT_OF_CONDITION = "UnitOfCondition" - """Unit of condition""" + """Unit of condition.""" UNIT_OF_EXAMINATION = "UnitOfExamination" - """Unit of examination""" + """Unit of examination.""" VALUE_OF_CONDITION = "ValueOfCondition" - """Value of condition""" + """Value of condition.""" VALUE_OF_EXAMINATION = "ValueOfExamination" - """Value of examination""" + """Value of examination.""" BODY_SITE_OF_CONDITION = "BodySiteOfCondition" - """Body site of condition""" + """Body site of condition.""" BODY_SITE_OF_TREATMENT = "BodySiteOfTreatment" - """Body site of treatment""" + """Body site of treatment.""" COURSE_OF_CONDITION = "CourseOfCondition" - """Course of condition""" + """Course of condition.""" COURSE_OF_EXAMINATION = "CourseOfExamination" - """Course of examination""" + """Course of examination.""" COURSE_OF_MEDICATION = "CourseOfMedication" - """Course of medication""" + """Course of medication.""" COURSE_OF_TREATMENT = "CourseOfTreatment" - """Course of treatment""" + """Course of treatment.""" EXAMINATION_FINDS_CONDITION = "ExaminationFindsCondition" - """Examination finds condition""" + """Examination finds condition.""" EXPRESSION_OF_GENE = "ExpressionOfGene" - """Expression of gene""" + """Expression of gene.""" EXPRESSION_OF_VARIANT = "ExpressionOfVariant" - """Expression of variant""" + """Expression of variant.""" FREQUENCY_OF_CONDITION = "FrequencyOfCondition" - """Frequency of condition""" + """Frequency of condition.""" MUTATION_TYPE_OF_GENE = "MutationTypeOfGene" - """Mutation type of gene""" + """Mutation type of gene.""" MUTATION_TYPE_OF_VARIANT = "MutationTypeOfVariant" - """Mutation type of variant""" + """Mutation type of variant.""" SCALE_OF_CONDITION = "ScaleOfCondition" - """Scale of condition""" + """Scale of condition.""" VARIANT_OF_GENE = "VariantOfGene" - """Variant of gene""" + """Variant of gene.""" class RelativeTo(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The reference point that the ordinal number denotes.""" CURRENT = "Current" - """Current state or position""" + """Current state or position.""" END = "End" - """End state or position""" + """End state or position.""" START = "Start" - """Start state or position""" + """Start state or position.""" class ScriptCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -1780,11 +1780,11 @@ class SentenceSentimentValue(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The predicted Sentiment for the sentence.""" POSITIVE = "positive" - """Positive sentiment""" + """Positive sentiment.""" NEUTRAL = "neutral" - """Neutral sentiment""" + """Neutral sentiment.""" NEGATIVE = "negative" - """Negative sentiment""" + """Negative sentiment.""" class SpeedUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -1862,86 +1862,86 @@ class TemperatureUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The temperature Unit of measurement.""" UNSPECIFIED = "Unspecified" - """Unspecified temperature unit""" + """Unspecified temperature unit.""" FAHRENHEIT = "Fahrenheit" - """Temperature unit in Fahrenheit""" + """Temperature unit in Fahrenheit.""" KELVIN = "Kelvin" - """Temperature unit in Kelvin""" + """Temperature unit in Kelvin.""" RANKINE = "Rankine" - """Temperature unit in Rankine""" + """Temperature unit in Rankine.""" CELSIUS = "Celsius" - """Temperature unit in Celsius""" + """Temperature unit in Celsius.""" class TemporalModifier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """An optional modifier of a date/time instance.""" AFTER_APPROX = "AfterApprox" - """After an approximate time""" + """After an approximate time.""" BEFORE = "Before" - """Before a specific time""" + """Before a specific time.""" BEFORE_START = "BeforeStart" - """Before the start of a time period""" + """Before the start of a time period.""" APPROX = "Approx" - """Approximately at a specific time""" + """Approximately at a specific time.""" REFERENCE_UNDEFINED = "ReferenceUndefined" - """Reference to an undefined time""" + """Reference to an undefined time.""" SINCE_END = "SinceEnd" - """Since the end of a time period""" + """Since the end of a time period.""" AFTER_MID = "AfterMid" - """After the middle of a time period""" + """After the middle of a time period.""" START = "Start" - """At the start of a time period""" + """At the start of a time period.""" AFTER = "After" - """After a specific time""" + """After a specific time.""" BEFORE_END = "BeforeEnd" - """Before the end of a time period""" + """Before the end of a time period.""" UNTIL = "Until" - """Until a specific time""" + """Until a specific time.""" END = "End" - """At the end of a time period""" + """At the end of a time period.""" LESS = "Less" - """Less than a specific time""" + """Less than a specific time.""" SINCE = "Since" - """Since a specific time""" + """Since a specific time.""" AFTER_START = "AfterStart" - """After the start of a time period""" + """After the start of a time period.""" BEFORE_APPROX = "BeforeApprox" - """Before an approximate time""" + """Before an approximate time.""" MID = "Mid" - """In the middle of a time period""" + """In the middle of a time period.""" MORE = "More" - """More than a specific time""" + """More than a specific time.""" class TextActionState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The status of the task at the mentioned last update time.""" NOT_STARTED = "notStarted" - """Not started status""" + """Not started status.""" RUNNING = "running" - """Running status""" + """Running status.""" SUCCEEDED = "succeeded" - """Succeeded status""" + """Succeeded status.""" PARTIALLY_COMPLETED = "partiallyCompleted" - """Partially completed status""" + """Partially completed status.""" FAILED = "failed" - """Failed status""" + """Failed status.""" CANCELLED = "cancelled" - """Cancelled status""" + """Cancelled status.""" CANCELLING = "cancelling" - """Cancelling status""" + """Cancelling status.""" class TokenSentiment(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The predicted Sentiment for the sentence.""" POSITIVE = "positive" - """Positive sentiment""" + """Positive sentiment.""" MIXED = "mixed" - """Mixed sentiment""" + """Mixed sentiment.""" NEGATIVE = "negative" - """Negative sentiment""" + """Negative sentiment.""" class VolumeUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -2009,43 +2009,43 @@ class WarningCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines the list of the warning codes.""" LONG_WORDS_IN_DOCUMENT = "LongWordsInDocument" - """Long words in document warning""" + """Long words in document warning.""" DOCUMENT_TRUNCATED = "DocumentTruncated" - """Document truncated warning""" + """Document truncated warning.""" class WeightUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The weight Unit of measurement.""" UNSPECIFIED = "Unspecified" - """Unspecified weight unit""" + """Unspecified weight unit.""" KILOGRAM = "Kilogram" - """Weight unit in kilograms""" + """Weight unit in kilograms.""" GRAM = "Gram" - """Weight unit in grams""" + """Weight unit in grams.""" MILLIGRAM = "Milligram" - """Weight unit in milligrams""" + """Weight unit in milligrams.""" GALLON = "Gallon" - """Volume unit in gallons""" + """Volume unit in gallons.""" METRIC_TON = "MetricTon" - """Weight unit in metric tons""" + """Weight unit in metric tons.""" TON = "Ton" - """Weight unit in tons""" + """Weight unit in tons.""" POUND = "Pound" - """Weight unit in pounds""" + """Weight unit in pounds.""" OUNCE = "Ounce" - """Weight unit in ounces""" + """Weight unit in ounces.""" GRAIN = "Grain" - """Weight unit in grains""" + """Weight unit in grains.""" PENNY_WEIGHT = "PennyWeight" - """Weight unit in pennyweights""" + """Weight unit in pennyweights.""" LONG_TON_BRITISH = "LongTonBritish" - """Weight unit in long tons (British)""" + """Weight unit in long tons (British).""" SHORT_TON_US = "ShortTonUS" - """Weight unit in short tons (US)""" + """Weight unit in short tons (US).""" SHORT_HUNDRED_WEIGHT_US = "ShortHundredWeightUS" - """Weight unit in short hundredweights (US)""" + """Weight unit in short hundredweights (US).""" STONE = "Stone" - """Weight unit in stones""" + """Weight unit in stones.""" DRAM = "Dram" - """Weight unit in drams""" + """Weight unit in drams.""" diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/models/_models.py b/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/models/_models.py index 309446e81c02..2e798e152db1 100644 --- a/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/models/_models.py +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/azure/ai/textanalytics/models/_models.py @@ -146,7 +146,7 @@ class AbstractiveSummarizationOperationAction(AnalyzeTextOperationAction, discri :ivar name: task name. :vartype name: str :ivar kind: The Abstractive Summarization kind of the long running task. Required. Abstractive - summarization task + summarization task. :vartype kind: str or ~azure.ai.textanalytics.models.ABSTRACTIVE_SUMMARIZATION :ivar action_content: Parameters for the Abstractive Summarization task. :vartype action_content: ~azure.ai.textanalytics.models.AbstractiveSummarizationActionContent @@ -154,7 +154,7 @@ class AbstractiveSummarizationOperationAction(AnalyzeTextOperationAction, discri kind: Literal[AnalyzeTextOperationActionKind.ABSTRACTIVE_SUMMARIZATION] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """The Abstractive Summarization kind of the long running task. Required. Abstractive - summarization task""" + summarization task.""" action_content: Optional["_models.AbstractiveSummarizationActionContent"] = rest_field( name="parameters", visibility=["read", "create", "update", "delete", "query"] ) @@ -260,7 +260,7 @@ class AbstractiveSummarizationOperationResult(AnalyzeTextLROResult, discriminato :vartype status: str or ~azure.ai.textanalytics.models.TextActionState :ivar task_name: task name. :vartype task_name: str - :ivar kind: Kind of the task. Required. Abstractive summarization LRO results + :ivar kind: Kind of the task. Required. Abstractive summarization LRO results. :vartype kind: str or ~azure.ai.textanalytics.models.ABSTRACTIVE_SUMMARIZATION_OPERATION_RESULTS :ivar results: Results of the task. Required. @@ -268,7 +268,7 @@ class AbstractiveSummarizationOperationResult(AnalyzeTextLROResult, discriminato """ kind: Literal[AnalyzeTextOperationResultsKind.ABSTRACTIVE_SUMMARIZATION_OPERATION_RESULTS] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Kind of the task. Required. Abstractive summarization LRO results""" + """Kind of the task. Required. Abstractive summarization LRO results.""" results: "_models.AbstractiveSummarizationResult" = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -635,12 +635,12 @@ class AllowOverlapEntityPolicyType(EntityOverlapPolicy, discriminator="allowOver selection. :ivar policy_kind: The entity OverlapPolicy object kind. Required. Represents - AllowOverlapEntityPolicyType + AllowOverlapEntityPolicyType. :vartype policy_kind: str or ~azure.ai.textanalytics.models.ALLOW_OVERLAP """ policy_kind: Literal[PolicyKind.ALLOW_OVERLAP] = rest_discriminator(name="policyKind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The entity OverlapPolicy object kind. Required. Represents AllowOverlapEntityPolicyType""" + """The entity OverlapPolicy object kind. Required. Represents AllowOverlapEntityPolicyType.""" @overload def __init__( @@ -699,14 +699,14 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class AnalyzeTextEntitiesResult(AnalyzeTextResult, discriminator="EntityRecognitionResults"): """Contains the entity task. - :ivar kind: kind of the task. Required. Entity recognition results + :ivar kind: kind of the task. Required. Entity recognition results. :vartype kind: str or ~azure.ai.textanalytics.models.ENTITY_RECOGNITION_RESULTS :ivar results: Results for entity recognition. Required. :vartype results: ~azure.ai.textanalytics.models.EntitiesWithMetadataAutoResult """ kind: Literal[AnalyzeTextResultsKind.ENTITY_RECOGNITION_RESULTS] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """kind of the task. Required. Entity recognition results""" + """kind of the task. Required. Entity recognition results.""" results: "_models.EntitiesWithMetadataAutoResult" = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -734,14 +734,14 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class AnalyzeTextEntityLinkingResult(AnalyzeTextResult, discriminator="EntityLinkingResults"): """Contains the analyze text Entity linking task result. - :ivar kind: Kind of task result. Required. Entity linking results + :ivar kind: Kind of task result. Required. Entity linking results. :vartype kind: str or ~azure.ai.textanalytics.models.ENTITY_LINKING_RESULTS :ivar results: Entity linking result. Required. :vartype results: ~azure.ai.textanalytics.models.EntityLinkingResult """ kind: Literal[AnalyzeTextResultsKind.ENTITY_LINKING_RESULTS] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Kind of task result. Required. Entity linking results""" + """Kind of task result. Required. Entity linking results.""" results: "_models.EntityLinkingResult" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Entity linking result. Required.""" @@ -870,14 +870,14 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class AnalyzeTextKeyPhraseResult(AnalyzeTextResult, discriminator="KeyPhraseExtractionResults"): """Contains the analyze text KeyPhraseExtraction task result. - :ivar kind: Kind of the task results. Required. Key phrase extraction results + :ivar kind: Kind of the task results. Required. Key phrase extraction results. :vartype kind: str or ~azure.ai.textanalytics.models.KEY_PHRASE_EXTRACTION_RESULTS :ivar results: The list of Key phrase extraction results. Required. :vartype results: ~azure.ai.textanalytics.models.KeyPhraseResult """ kind: Literal[AnalyzeTextResultsKind.KEY_PHRASE_EXTRACTION_RESULTS] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Kind of the task results. Required. Key phrase extraction results""" + """Kind of the task results. Required. Key phrase extraction results.""" results: "_models.KeyPhraseResult" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The list of Key phrase extraction results. Required.""" @@ -903,14 +903,14 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class AnalyzeTextLanguageDetectionResult(AnalyzeTextResult, discriminator="LanguageDetectionResults"): """Contains the language detection task result for the request. - :ivar kind: Kind of the task result. Required. Language detection results + :ivar kind: Kind of the task result. Required. Language detection results. :vartype kind: str or ~azure.ai.textanalytics.models.LANGUAGE_DETECTION_RESULTS :ivar results: Contains the language detection results. Required. :vartype results: ~azure.ai.textanalytics.models.LanguageDetectionResult """ kind: Literal[AnalyzeTextResultsKind.LANGUAGE_DETECTION_RESULTS] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Kind of the task result. Required. Language detection results""" + """Kind of the task result. Required. Language detection results.""" results: "_models.LanguageDetectionResult" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Contains the language detection results. Required.""" @@ -1028,14 +1028,14 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class AnalyzeTextPiiResult(AnalyzeTextResult, discriminator="PiiEntityRecognitionResults"): """Contains the analyze text PIIEntityRecognition LRO task. - :ivar kind: The kind of the task. Required. PII entity recognition results + :ivar kind: The kind of the task. Required. PII entity recognition results. :vartype kind: str or ~azure.ai.textanalytics.models.PII_ENTITY_RECOGNITION_RESULTS :ivar results: The list of pii results. Required. :vartype results: ~azure.ai.textanalytics.models.PiiResult """ kind: Literal[AnalyzeTextResultsKind.PII_ENTITY_RECOGNITION_RESULTS] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The kind of the task. Required. PII entity recognition results""" + """The kind of the task. Required. PII entity recognition results.""" results: "_models.PiiResult" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The list of pii results. Required.""" @@ -1061,14 +1061,14 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class AnalyzeTextSentimentResult(AnalyzeTextResult, discriminator="SentimentAnalysisResults"): """Contains the analyze text SentimentAnalysis LRO task result. - :ivar kind: Kind of the task. Required. Sentiment analysis results + :ivar kind: Kind of the task. Required. Sentiment analysis results. :vartype kind: str or ~azure.ai.textanalytics.models.SENTIMENT_ANALYSIS_RESULTS :ivar results: The sentiment analysis results. Required. :vartype results: ~azure.ai.textanalytics.models.SentimentResult """ kind: Literal[AnalyzeTextResultsKind.SENTIMENT_ANALYSIS_RESULTS] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Kind of the task. Required. Sentiment analysis results""" + """Kind of the task. Required. Sentiment analysis results.""" results: "_models.SentimentResult" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The sentiment analysis results. Required.""" @@ -1465,7 +1465,7 @@ class ConfidenceScoreThresholdOverride(_Model): :ivar value: The confidence score threshold for the specified PII category. Required. :vartype value: float :ivar language: The 2 letter ISO 639-1 language for which the override applies. If not - specified, the override applies to all languages. + specified, the override applies to all languages. Required. :vartype language: str """ @@ -1535,9 +1535,9 @@ class ConfidenceScoreThresholdOverride(_Model): \"USMedicareBeneficiaryId\", \"Location\", \"City\", \"State\", \"Airport\", and \"GPE\".""" value: float = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The confidence score threshold for the specified PII category. Required.""" - language: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + language: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The 2 letter ISO 639-1 language for which the override applies. If not specified, the override - applies to all languages.""" + applies to all languages. Required.""" @overload def __init__( @@ -1545,7 +1545,7 @@ def __init__( *, entity: Union[str, "_models.PiiCategoriesExclude"], value: float, - language: Optional[str] = None, + language: str, ) -> None: ... @overload @@ -1664,14 +1664,14 @@ class CustomEntitiesLROTask(AnalyzeTextOperationAction, discriminator="CustomEnt :ivar name: task name. :vartype name: str - :ivar kind: Kind of the task. Required. Custom entity recognition task + :ivar kind: Kind of the task. Required. Custom entity recognition task. :vartype kind: str or ~azure.ai.textanalytics.models.CUSTOM_ENTITY_RECOGNITION :ivar parameters: task parameters. :vartype parameters: ~azure.ai.textanalytics.models.CustomEntitiesActionContent """ kind: Literal[AnalyzeTextOperationActionKind.CUSTOM_ENTITY_RECOGNITION] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Kind of the task. Required. Custom entity recognition task""" + """Kind of the task. Required. Custom entity recognition task.""" parameters: Optional["_models.CustomEntitiesActionContent"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -1819,7 +1819,7 @@ class CustomEntityRecognitionOperationResult(AnalyzeTextLROResult, discriminator :vartype status: str or ~azure.ai.textanalytics.models.TextActionState :ivar task_name: task name. :vartype task_name: str - :ivar kind: Kind of the task. Required. Custom entity recognition LRO results + :ivar kind: Kind of the task. Required. Custom entity recognition LRO results. :vartype kind: str or ~azure.ai.textanalytics.models.CUSTOM_ENTITY_RECOGNITION_OPERATION_RESULTS :ivar results: List of results. Required. @@ -1827,7 +1827,7 @@ class CustomEntityRecognitionOperationResult(AnalyzeTextLROResult, discriminator """ kind: Literal[AnalyzeTextOperationResultsKind.CUSTOM_ENTITY_RECOGNITION_OPERATION_RESULTS] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Kind of the task. Required. Custom entity recognition LRO results""" + """Kind of the task. Required. Custom entity recognition LRO results.""" results: "_models.CustomEntitiesResult" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """List of results. Required.""" @@ -1954,7 +1954,7 @@ class CustomMultiLabelClassificationOperationAction( :ivar name: task name. :vartype name: str - :ivar kind: Kind of the task. Required. Custom multi label classification task + :ivar kind: Kind of the task. Required. Custom multi label classification task. :vartype kind: str or ~azure.ai.textanalytics.models.CUSTOM_MULTI_LABEL_CLASSIFICATION :ivar action_content: Task parameters. :vartype action_content: @@ -1962,7 +1962,7 @@ class CustomMultiLabelClassificationOperationAction( """ kind: Literal[AnalyzeTextOperationActionKind.CUSTOM_MULTI_LABEL_CLASSIFICATION] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Kind of the task. Required. Custom multi label classification task""" + """Kind of the task. Required. Custom multi label classification task.""" action_content: Optional["_models.CustomMultiLabelClassificationActionContent"] = rest_field( name="parameters", visibility=["read", "create", "update", "delete", "query"] ) @@ -2001,7 +2001,7 @@ class CustomMultiLabelClassificationOperationResult( :vartype status: str or ~azure.ai.textanalytics.models.TextActionState :ivar task_name: task name. :vartype task_name: str - :ivar kind: Kind of the task. Required. Custom multi label classification LRO results + :ivar kind: Kind of the task. Required. Custom multi label classification LRO results. :vartype kind: str or ~azure.ai.textanalytics.models.CUSTOM_MULTI_LABEL_CLASSIFICATION_OPERATION_RESULTS :ivar results: List of results. Required. @@ -2009,7 +2009,7 @@ class CustomMultiLabelClassificationOperationResult( """ kind: Literal[AnalyzeTextOperationResultsKind.CUSTOM_MULTI_LABEL_CLASSIFICATION_OPERATION_RESULTS] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Kind of the task. Required. Custom multi label classification LRO results""" + """Kind of the task. Required. Custom multi label classification LRO results.""" results: "_models.CustomLabelClassificationResult" = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -2084,7 +2084,7 @@ class CustomSingleLabelClassificationOperationAction( :ivar name: task name. :vartype name: str - :ivar kind: Kind of the task. Required. Custom single label classification task + :ivar kind: Kind of the task. Required. Custom single label classification task. :vartype kind: str or ~azure.ai.textanalytics.models.CUSTOM_SINGLE_LABEL_CLASSIFICATION :ivar action_content: Task parameters. :vartype action_content: @@ -2092,7 +2092,7 @@ class CustomSingleLabelClassificationOperationAction( """ kind: Literal[AnalyzeTextOperationActionKind.CUSTOM_SINGLE_LABEL_CLASSIFICATION] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Kind of the task. Required. Custom single label classification task""" + """Kind of the task. Required. Custom single label classification task.""" action_content: Optional["_models.CustomSingleLabelClassificationActionContent"] = rest_field( name="parameters", visibility=["read", "create", "update", "delete", "query"] ) @@ -2131,7 +2131,7 @@ class CustomSingleLabelClassificationOperationResult( :vartype status: str or ~azure.ai.textanalytics.models.TextActionState :ivar task_name: task name. :vartype task_name: str - :ivar kind: Kind of the task. Required. Custom single label classification LRO results + :ivar kind: Kind of the task. Required. Custom single label classification LRO results. :vartype kind: str or ~azure.ai.textanalytics.models.CUSTOM_SINGLE_LABEL_CLASSIFICATION_OPERATION_RESULTS :ivar results: List of results. Required. @@ -2139,7 +2139,7 @@ class CustomSingleLabelClassificationOperationResult( """ kind: Literal[AnalyzeTextOperationResultsKind.CUSTOM_SINGLE_LABEL_CLASSIFICATION_OPERATION_RESULTS] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Kind of the task. Required. Custom single label classification LRO results""" + """Kind of the task. Required. Custom single label classification LRO results.""" results: "_models.CustomLabelClassificationResult" = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -2567,14 +2567,14 @@ class EntitiesLROTask(AnalyzeTextOperationAction, discriminator="EntityRecogniti :ivar name: task name. :vartype name: str - :ivar kind: The kind of task. Required. Entity recognition task + :ivar kind: The kind of task. Required. Entity recognition task. :vartype kind: str or ~azure.ai.textanalytics.models.ENTITY_RECOGNITION :ivar parameters: Task parameters. :vartype parameters: ~azure.ai.textanalytics.models.EntitiesActionContent """ kind: Literal[AnalyzeTextOperationActionKind.ENTITY_RECOGNITION] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The kind of task. Required. Entity recognition task""" + """The kind of task. Required. Entity recognition task.""" parameters: Optional["_models.EntitiesActionContent"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -2950,14 +2950,14 @@ class EntityLinkingLROTask(AnalyzeTextOperationAction, discriminator="EntityLink :ivar name: task name. :vartype name: str - :ivar kind: Kind of task result. Required. Entity linking task + :ivar kind: Kind of task result. Required. Entity linking task. :vartype kind: str or ~azure.ai.textanalytics.models.ENTITY_LINKING :ivar parameters: Task parameters. :vartype parameters: ~azure.ai.textanalytics.models.EntityLinkingActionContent """ kind: Literal[AnalyzeTextOperationActionKind.ENTITY_LINKING] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Kind of task result. Required. Entity linking task""" + """Kind of task result. Required. Entity linking task.""" parameters: Optional["_models.EntityLinkingActionContent"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -3041,14 +3041,14 @@ class EntityLinkingOperationResult(AnalyzeTextLROResult, discriminator="EntityLi :vartype status: str or ~azure.ai.textanalytics.models.TextActionState :ivar task_name: task name. :vartype task_name: str - :ivar kind: Kind of the task. Required. Entity linking LRO results + :ivar kind: Kind of the task. Required. Entity linking LRO results. :vartype kind: str or ~azure.ai.textanalytics.models.ENTITY_LINKING_OPERATION_RESULTS :ivar results: Entity linking result. Required. :vartype results: ~azure.ai.textanalytics.models.EntityLinkingResult """ kind: Literal[AnalyzeTextOperationResultsKind.ENTITY_LINKING_OPERATION_RESULTS] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Kind of the task. Required. Entity linking LRO results""" + """Kind of the task. Required. Entity linking LRO results.""" results: "_models.EntityLinkingResult" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Entity linking result. Required.""" @@ -3175,14 +3175,14 @@ class EntityRecognitionOperationResult(AnalyzeTextLROResult, discriminator="Enti :vartype status: str or ~azure.ai.textanalytics.models.TextActionState :ivar task_name: task name. :vartype task_name: str - :ivar kind: Kind of the task. Required. Entity recognition LRO results + :ivar kind: Kind of the task. Required. Entity recognition LRO results. :vartype kind: str or ~azure.ai.textanalytics.models.ENTITY_RECOGNITION_OPERATION_RESULTS :ivar results: Results for the task. Required. :vartype results: ~azure.ai.textanalytics.models.EntitiesResult """ kind: Literal[AnalyzeTextOperationResultsKind.ENTITY_RECOGNITION_OPERATION_RESULTS] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Kind of the task. Required. Entity recognition LRO results""" + """Kind of the task. Required. Entity recognition LRO results.""" results: "_models.EntitiesResult" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Results for the task. Required.""" @@ -3245,32 +3245,131 @@ class EntitySynonyms(_Model): """Object that allows the user to provide synonyms for context words that to enhance pii entity detection. - :ivar entity_type: The entity name. Required. Known values are: "Address", "Numeric", "Age", - "Currency", "Number", "NumberRange", "Percentage", "Ordinal", "Temperature", "Dimension", - "Length", "Weight", "Height", "Speed", "Area", "Volume", "Information", "Temporal", "Date", - "Time", "DateTime", "DateRange", "TimeRange", "DateTimeRange", "Duration", "SetTemporal", - "Event", "SportsEvent", "CulturalEvent", "NaturalEvent", "Location", "GPE", "City", "State", - "CountryRegion", "Continent", "Structural", "Airport", "Geological", "Organization", - "OrganizationMedical", "OrganizationStockExchange", "OrganizationSports", "Person", - "PersonType", "Email", "URL", "IP", "PhoneNumber", "Product", "ComputingProduct", and "Skill". - :vartype entity_type: str or ~azure.ai.textanalytics.models.EntityCategory + :ivar entity_type: The entity name. Required. Known values are: "ABARoutingNumber", + "ARNationalIdentityNumber", "AUBankAccountNumber", "AUDriversLicenseNumber", + "AUMedicalAccountNumber", "AUPassportNumber", "AUTaxFileNumber", "AUBusinessNumber", + "AUCompanyNumber", "ATIdentityCard", "ATTaxIdentificationNumber", "ATValueAddedTaxNumber", + "AzureDocumentDBAuthKey", "AzureIAASDatabaseConnectionAndSQLString", + "AzureIoTConnectionString", "AzurePublishSettingPassword", "AzureRedisCacheString", "AzureSAS", + "AzureServiceBusString", "AzureStorageAccountKey", "AzureStorageAccountGeneric", + "BENationalNumber", "BENationalNumberV2", "BEValueAddedTaxNumber", "BRCPFNumber", + "BRLegalEntityNumber", "BRNationalIDRG", "BGUniformCivilNumber", "CABankAccountNumber", + "CADriversLicenseNumber", "CAHealthServiceNumber", "CAPassportNumber", + "CAPersonalHealthIdentification", "CASocialInsuranceNumber", "CLIdentityCardNumber", + "CNResidentIdentityCardNumber", "CreditCardNumber", "HRIdentityCardNumber", + "HRNationalIDNumber", "HRPersonalIdentificationNumber", "HRPersonalIdentificationOIBNumberV2", + "CYIdentityCard", "CYTaxIdentificationNumber", "CZPersonalIdentityNumber", + "CZPersonalIdentityV2", "DKPersonalIdentificationNumber", "DKPersonalIdentificationV2", + "DrugEnforcementAgencyNumber", "EEPersonalIdentificationCode", "EUDebitCardNumber", + "EUDriversLicenseNumber", "EUGPSCoordinates", "EUNationalIdentificationNumber", + "EUPassportNumber", "EUSocialSecurityNumber", "EUTaxIdentificationNumber", + "FIEuropeanHealthNumber", "FINationalID", "FINationalIDV2", "FIPassportNumber", + "FRDriversLicenseNumber", "FRHealthInsuranceNumber", "FRNationalID", "FRPassportNumber", + "FRSocialSecurityNumber", "FRTaxIdentificationNumber", "FRValueAddedTaxNumber", + "DEDriversLicenseNumber", "DEPassportNumber", "DEIdentityCardNumber", + "DETaxIdentificationNumber", "DEValueAddedNumber", "GRNationalIDCard", "GRNationalIDV2", + "GRTaxIdentificationNumber", "HKIdentityCardNumber", "HUValueAddedNumber", + "HUPersonalIdentificationNumber", "HUTaxIdentificationNumber", "INPermanentAccount", + "INUniqueIdentificationNumber", "IDIdentityCardNumber", "InternationalBankingAccountNumber", + "IEPersonalPublicServiceNumber", "IEPersonalPublicServiceNumberV2", "ILBankAccountNumber", + "ILNationalID", "ITDriversLicenseNumber", "ITFiscalCode", "ITValueAddedTaxNumber", + "JPBankAccountNumber", "JPDriversLicenseNumber", "JPPassportNumber", + "JPResidentRegistrationNumber", "JPSocialInsuranceNumber", "JPMyNumberCorporate", + "JPMyNumberPersonal", "JPResidenceCardNumber", "LVPersonalCode", "LTPersonalCode", + "LUNationalIdentificationNumberNatural", "LUNationalIdentificationNumberNonNatural", + "MYIdentityCardNumber", "MTIdentityCardNumber", "MTTaxIDNumber", "NLCitizensServiceNumber", + "NLCitizensServiceNumberV2", "NLTaxIdentificationNumber", "NLValueAddedTaxNumber", + "NZBankAccountNumber", "NZDriversLicenseNumber", "NZInlandRevenueNumber", + "NZMinistryOfHealthNumber", "NZSocialWelfareNumber", "NOIdentityNumber", + "PHUnifiedMultiPurposeIDNumber", "PLIdentityCard", "PLNationalID", "PLNationalIDV2", + "PLPassportNumber", "PLTaxIdentificationNumber", "PLREGONNumber", "PTCitizenCardNumber", + "PTCitizenCardNumberV2", "PTTaxIdentificationNumber", "ROPersonalNumericalCode", + "RUPassportNumberDomestic", "RUPassportNumberInternational", "SANationalID", + "SGNationalRegistrationIdentityCardNumber", "SKPersonalNumber", "SITaxIdentificationNumber", + "SIUniqueMasterCitizenNumber", "ZAIdentificationNumber", "KRResidentRegistrationNumber", + "ESDNI", "ESSocialSecurityNumber", "ESTaxIdentificationNumber", "SQLServerConnectionString", + "SENationalID", "SENationalIDV2", "SEPassportNumber", "SETaxIdentificationNumber", "SWIFTCode", + "CHSocialSecurityNumber", "TWNationalID", "TWPassportNumber", "TWResidentCertificate", + "THPopulationIdentificationCode", "TRNationalIdentificationNumber", "UKDriversLicenseNumber", + "UKElectoralRollNumber", "UKNationalHealthNumber", "UKNationalInsuranceNumber", + "UKUniqueTaxpayerNumber", "USUKPassportNumber", "USBankAccountNumber", + "USDriversLicenseNumber", "USIndividualTaxpayerIdentification", "USSocialSecurityNumber", + "UAPassportNumberDomestic", "UAPassportNumberInternational", "Organization", "Email", "URL", + "Age", "PhoneNumber", "IPAddress", "Date", "Person", "Address", "DateOfBirth", + "BankAccountNumber", "PassportNumber", "DriversLicenseNumber", "Neighborhood", "SortCode", + "PIN", "VIN", "VehicleIdentificationNumber", "LicensePlate", "KRPassportNumber", + "KRDriversLicenseNumber", "KRSocialSecurityNumber", "GovernmentIssuedId", "Password", + "NationalId", "ZipCode", "CVV", "ExpirationDate", "CASocialIdentificationNumber", + "USMedicareBeneficiaryId", "Location", "City", "State", "Airport", and "GPE". + :vartype entity_type: str or ~azure.ai.textanalytics.models.PiiCategoriesExclude :ivar synonyms: The entity synonyms. Required. :vartype synonyms: list[~azure.ai.textanalytics.models.EntitySynonym] """ - entity_type: Union[str, "_models.EntityCategory"] = rest_field( + entity_type: Union[str, "_models.PiiCategoriesExclude"] = rest_field( name="entityType", visibility=["read", "create", "update", "delete", "query"] ) - """The entity name. Required. Known values are: \"Address\", \"Numeric\", \"Age\", \"Currency\", - \"Number\", \"NumberRange\", \"Percentage\", \"Ordinal\", \"Temperature\", \"Dimension\", - \"Length\", \"Weight\", \"Height\", \"Speed\", \"Area\", \"Volume\", \"Information\", - \"Temporal\", \"Date\", \"Time\", \"DateTime\", \"DateRange\", \"TimeRange\", - \"DateTimeRange\", \"Duration\", \"SetTemporal\", \"Event\", \"SportsEvent\", - \"CulturalEvent\", \"NaturalEvent\", \"Location\", \"GPE\", \"City\", \"State\", - \"CountryRegion\", \"Continent\", \"Structural\", \"Airport\", \"Geological\", - \"Organization\", \"OrganizationMedical\", \"OrganizationStockExchange\", - \"OrganizationSports\", \"Person\", \"PersonType\", \"Email\", \"URL\", \"IP\", - \"PhoneNumber\", \"Product\", \"ComputingProduct\", and \"Skill\".""" + """The entity name. Required. Known values are: \"ABARoutingNumber\", + \"ARNationalIdentityNumber\", \"AUBankAccountNumber\", \"AUDriversLicenseNumber\", + \"AUMedicalAccountNumber\", \"AUPassportNumber\", \"AUTaxFileNumber\", \"AUBusinessNumber\", + \"AUCompanyNumber\", \"ATIdentityCard\", \"ATTaxIdentificationNumber\", + \"ATValueAddedTaxNumber\", \"AzureDocumentDBAuthKey\", + \"AzureIAASDatabaseConnectionAndSQLString\", \"AzureIoTConnectionString\", + \"AzurePublishSettingPassword\", \"AzureRedisCacheString\", \"AzureSAS\", + \"AzureServiceBusString\", \"AzureStorageAccountKey\", \"AzureStorageAccountGeneric\", + \"BENationalNumber\", \"BENationalNumberV2\", \"BEValueAddedTaxNumber\", \"BRCPFNumber\", + \"BRLegalEntityNumber\", \"BRNationalIDRG\", \"BGUniformCivilNumber\", \"CABankAccountNumber\", + \"CADriversLicenseNumber\", \"CAHealthServiceNumber\", \"CAPassportNumber\", + \"CAPersonalHealthIdentification\", \"CASocialInsuranceNumber\", \"CLIdentityCardNumber\", + \"CNResidentIdentityCardNumber\", \"CreditCardNumber\", \"HRIdentityCardNumber\", + \"HRNationalIDNumber\", \"HRPersonalIdentificationNumber\", + \"HRPersonalIdentificationOIBNumberV2\", \"CYIdentityCard\", \"CYTaxIdentificationNumber\", + \"CZPersonalIdentityNumber\", \"CZPersonalIdentityV2\", \"DKPersonalIdentificationNumber\", + \"DKPersonalIdentificationV2\", \"DrugEnforcementAgencyNumber\", + \"EEPersonalIdentificationCode\", \"EUDebitCardNumber\", \"EUDriversLicenseNumber\", + \"EUGPSCoordinates\", \"EUNationalIdentificationNumber\", \"EUPassportNumber\", + \"EUSocialSecurityNumber\", \"EUTaxIdentificationNumber\", \"FIEuropeanHealthNumber\", + \"FINationalID\", \"FINationalIDV2\", \"FIPassportNumber\", \"FRDriversLicenseNumber\", + \"FRHealthInsuranceNumber\", \"FRNationalID\", \"FRPassportNumber\", + \"FRSocialSecurityNumber\", \"FRTaxIdentificationNumber\", \"FRValueAddedTaxNumber\", + \"DEDriversLicenseNumber\", \"DEPassportNumber\", \"DEIdentityCardNumber\", + \"DETaxIdentificationNumber\", \"DEValueAddedNumber\", \"GRNationalIDCard\", + \"GRNationalIDV2\", \"GRTaxIdentificationNumber\", \"HKIdentityCardNumber\", + \"HUValueAddedNumber\", \"HUPersonalIdentificationNumber\", \"HUTaxIdentificationNumber\", + \"INPermanentAccount\", \"INUniqueIdentificationNumber\", \"IDIdentityCardNumber\", + \"InternationalBankingAccountNumber\", \"IEPersonalPublicServiceNumber\", + \"IEPersonalPublicServiceNumberV2\", \"ILBankAccountNumber\", \"ILNationalID\", + \"ITDriversLicenseNumber\", \"ITFiscalCode\", \"ITValueAddedTaxNumber\", + \"JPBankAccountNumber\", \"JPDriversLicenseNumber\", \"JPPassportNumber\", + \"JPResidentRegistrationNumber\", \"JPSocialInsuranceNumber\", \"JPMyNumberCorporate\", + \"JPMyNumberPersonal\", \"JPResidenceCardNumber\", \"LVPersonalCode\", \"LTPersonalCode\", + \"LUNationalIdentificationNumberNatural\", \"LUNationalIdentificationNumberNonNatural\", + \"MYIdentityCardNumber\", \"MTIdentityCardNumber\", \"MTTaxIDNumber\", + \"NLCitizensServiceNumber\", \"NLCitizensServiceNumberV2\", \"NLTaxIdentificationNumber\", + \"NLValueAddedTaxNumber\", \"NZBankAccountNumber\", \"NZDriversLicenseNumber\", + \"NZInlandRevenueNumber\", \"NZMinistryOfHealthNumber\", \"NZSocialWelfareNumber\", + \"NOIdentityNumber\", \"PHUnifiedMultiPurposeIDNumber\", \"PLIdentityCard\", \"PLNationalID\", + \"PLNationalIDV2\", \"PLPassportNumber\", \"PLTaxIdentificationNumber\", \"PLREGONNumber\", + \"PTCitizenCardNumber\", \"PTCitizenCardNumberV2\", \"PTTaxIdentificationNumber\", + \"ROPersonalNumericalCode\", \"RUPassportNumberDomestic\", \"RUPassportNumberInternational\", + \"SANationalID\", \"SGNationalRegistrationIdentityCardNumber\", \"SKPersonalNumber\", + \"SITaxIdentificationNumber\", \"SIUniqueMasterCitizenNumber\", \"ZAIdentificationNumber\", + \"KRResidentRegistrationNumber\", \"ESDNI\", \"ESSocialSecurityNumber\", + \"ESTaxIdentificationNumber\", \"SQLServerConnectionString\", \"SENationalID\", + \"SENationalIDV2\", \"SEPassportNumber\", \"SETaxIdentificationNumber\", \"SWIFTCode\", + \"CHSocialSecurityNumber\", \"TWNationalID\", \"TWPassportNumber\", \"TWResidentCertificate\", + \"THPopulationIdentificationCode\", \"TRNationalIdentificationNumber\", + \"UKDriversLicenseNumber\", \"UKElectoralRollNumber\", \"UKNationalHealthNumber\", + \"UKNationalInsuranceNumber\", \"UKUniqueTaxpayerNumber\", \"USUKPassportNumber\", + \"USBankAccountNumber\", \"USDriversLicenseNumber\", \"USIndividualTaxpayerIdentification\", + \"USSocialSecurityNumber\", \"UAPassportNumberDomestic\", \"UAPassportNumberInternational\", + \"Organization\", \"Email\", \"URL\", \"Age\", \"PhoneNumber\", \"IPAddress\", \"Date\", + \"Person\", \"Address\", \"DateOfBirth\", \"BankAccountNumber\", \"PassportNumber\", + \"DriversLicenseNumber\", \"Neighborhood\", \"SortCode\", \"PIN\", \"VIN\", + \"VehicleIdentificationNumber\", \"LicensePlate\", \"KRPassportNumber\", + \"KRDriversLicenseNumber\", \"KRSocialSecurityNumber\", \"GovernmentIssuedId\", \"Password\", + \"NationalId\", \"ZipCode\", \"CVV\", \"ExpirationDate\", \"CASocialIdentificationNumber\", + \"USMedicareBeneficiaryId\", \"Location\", \"City\", \"State\", \"Airport\", and \"GPE\".""" synonyms: list["_models.EntitySynonym"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The entity synonyms. Required.""" @@ -3278,7 +3377,7 @@ class EntitySynonyms(_Model): def __init__( self, *, - entity_type: Union[str, "_models.EntityCategory"], + entity_type: Union[str, "_models.PiiCategoriesExclude"], synonyms: list["_models.EntitySynonym"], ) -> None: ... @@ -3537,7 +3636,7 @@ class ExtractiveSummarizationOperationAction(AnalyzeTextOperationAction, discrim :ivar name: task name. :vartype name: str :ivar kind: The Extractive Summarization kind of the long running task. Required. Extractive - summarization task + summarization task. :vartype kind: str or ~azure.ai.textanalytics.models.EXTRACTIVE_SUMMARIZATION :ivar action_content: Parameters for the Extractive Summarization task. :vartype action_content: ~azure.ai.textanalytics.models.ExtractiveSummarizationActionContent @@ -3545,7 +3644,7 @@ class ExtractiveSummarizationOperationAction(AnalyzeTextOperationAction, discrim kind: Literal[AnalyzeTextOperationActionKind.EXTRACTIVE_SUMMARIZATION] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """The Extractive Summarization kind of the long running task. Required. Extractive summarization - task""" + task.""" action_content: Optional["_models.ExtractiveSummarizationActionContent"] = rest_field( name="parameters", visibility=["read", "create", "update", "delete", "query"] ) @@ -3582,14 +3681,14 @@ class ExtractiveSummarizationOperationResult(AnalyzeTextLROResult, discriminator :vartype status: str or ~azure.ai.textanalytics.models.TextActionState :ivar task_name: task name. :vartype task_name: str - :ivar kind: Kind of the task. Required. Extractive summarization LRO results + :ivar kind: Kind of the task. Required. Extractive summarization LRO results. :vartype kind: str or ~azure.ai.textanalytics.models.EXTRACTIVE_SUMMARIZATION_OPERATION_RESULTS :ivar results: Results of the task. Required. :vartype results: ~azure.ai.textanalytics.models.ExtractiveSummarizationResult """ kind: Literal[AnalyzeTextOperationResultsKind.EXTRACTIVE_SUMMARIZATION_OPERATION_RESULTS] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Kind of the task. Required. Extractive summarization LRO results""" + """Kind of the task. Required. Extractive summarization LRO results.""" results: "_models.ExtractiveSummarizationResult" = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -3948,14 +4047,14 @@ class HealthcareLROResult(AnalyzeTextLROResult, discriminator="HealthcareLROResu :vartype status: str or ~azure.ai.textanalytics.models.TextActionState :ivar task_name: task name. :vartype task_name: str - :ivar kind: Kind of the task. Required. Healthcare LRO results + :ivar kind: Kind of the task. Required. Healthcare LRO results. :vartype kind: str or ~azure.ai.textanalytics.models.HEALTHCARE_OPERATION_RESULTS :ivar results: Results of the task. Required. :vartype results: ~azure.ai.textanalytics.models.HealthcareResult """ kind: Literal[AnalyzeTextOperationResultsKind.HEALTHCARE_OPERATION_RESULTS] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Kind of the task. Required. Healthcare LRO results""" + """Kind of the task. Required. Healthcare LRO results.""" results: "_models.HealthcareResult" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Results of the task. Required.""" @@ -3986,14 +4085,14 @@ class HealthcareLROTask(AnalyzeTextOperationAction, discriminator="Healthcare"): :ivar name: task name. :vartype name: str - :ivar kind: Healthcare kind of the long running task. Required. Healthcare task + :ivar kind: Healthcare kind of the long running task. Required. Healthcare task. :vartype kind: str or ~azure.ai.textanalytics.models.HEALTHCARE :ivar parameters: Parameters for the Healthcare task. :vartype parameters: ~azure.ai.textanalytics.models.HealthcareTaskParameters """ kind: Literal[AnalyzeTextOperationActionKind.HEALTHCARE] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Healthcare kind of the long running task. Required. Healthcare task""" + """Healthcare kind of the long running task. Required. Healthcare task.""" parameters: Optional["_models.HealthcareTaskParameters"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -4397,14 +4496,14 @@ class KeyPhraseExtractionOperationResult(AnalyzeTextLROResult, discriminator="Ke :vartype status: str or ~azure.ai.textanalytics.models.TextActionState :ivar task_name: task name. :vartype task_name: str - :ivar kind: Kind of the task. Required. Key phrase extraction LRO results + :ivar kind: Kind of the task. Required. Key phrase extraction LRO results. :vartype kind: str or ~azure.ai.textanalytics.models.KEY_PHRASE_EXTRACTION_OPERATION_RESULTS :ivar results: The list of Key phrase extraction results. Required. :vartype results: ~azure.ai.textanalytics.models.KeyPhraseResult """ kind: Literal[AnalyzeTextOperationResultsKind.KEY_PHRASE_EXTRACTION_OPERATION_RESULTS] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Kind of the task. Required. Key phrase extraction LRO results""" + """Kind of the task. Required. Key phrase extraction LRO results.""" results: "_models.KeyPhraseResult" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The list of Key phrase extraction results. Required.""" @@ -4435,14 +4534,14 @@ class KeyPhraseLROTask(AnalyzeTextOperationAction, discriminator="KeyPhraseExtra :ivar name: task name. :vartype name: str - :ivar kind: Kind of the task. Required. Key phrase extraction task + :ivar kind: Kind of the task. Required. Key phrase extraction task. :vartype kind: str or ~azure.ai.textanalytics.models.KEY_PHRASE_EXTRACTION :ivar parameters: Key phrase extraction task parameters. :vartype parameters: ~azure.ai.textanalytics.models.KeyPhraseActionContent """ kind: Literal[AnalyzeTextOperationActionKind.KEY_PHRASE_EXTRACTION] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Kind of the task. Required. Key phrase extraction task""" + """Kind of the task. Required. Key phrase extraction task.""" parameters: Optional["_models.KeyPhraseActionContent"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -4891,12 +4990,12 @@ class MatchLongestEntityPolicyType(EntityOverlapPolicy, discriminator="matchLong Text Analytics) follow the above steps starting from 1. :ivar policy_kind: The entity OverlapPolicy object kind. Required. Represents - MatchLongestEntityPolicyType + MatchLongestEntityPolicyType. :vartype policy_kind: str or ~azure.ai.textanalytics.models.MATCH_LONGEST """ policy_kind: Literal[PolicyKind.MATCH_LONGEST] = rest_discriminator(name="policyKind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The entity OverlapPolicy object kind. Required. Represents MatchLongestEntityPolicyType""" + """The entity OverlapPolicy object kind. Required. Represents MatchLongestEntityPolicyType.""" @overload def __init__( @@ -5536,14 +5635,14 @@ class PiiEntityRecognitionOperationResult(AnalyzeTextLROResult, discriminator="P :vartype status: str or ~azure.ai.textanalytics.models.TextActionState :ivar task_name: task name. :vartype task_name: str - :ivar kind: The kind of the task. Required. PII entity recognition LRO results + :ivar kind: The kind of the task. Required. PII entity recognition LRO results. :vartype kind: str or ~azure.ai.textanalytics.models.PII_ENTITY_RECOGNITION_OPERATION_RESULTS :ivar results: The list of pii results. Required. :vartype results: ~azure.ai.textanalytics.models.PiiResult """ kind: Literal[AnalyzeTextOperationResultsKind.PII_ENTITY_RECOGNITION_OPERATION_RESULTS] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The kind of the task. Required. PII entity recognition LRO results""" + """The kind of the task. Required. PII entity recognition LRO results.""" results: "_models.PiiResult" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The list of pii results. Required.""" @@ -5574,14 +5673,14 @@ class PiiLROTask(AnalyzeTextOperationAction, discriminator="PiiEntityRecognition :ivar name: task name. :vartype name: str - :ivar kind: Kind of the task. Required. PII entity recognition task + :ivar kind: Kind of the task. Required. PII entity recognition task. :vartype kind: str or ~azure.ai.textanalytics.models.PII_ENTITY_RECOGNITION :ivar parameters: Pii task parameters. :vartype parameters: ~azure.ai.textanalytics.models.PiiActionContent """ kind: Literal[AnalyzeTextOperationActionKind.PII_ENTITY_RECOGNITION] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Kind of the task. Required. PII entity recognition task""" + """Kind of the task. Required. PII entity recognition task.""" parameters: Optional["_models.PiiActionContent"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -6097,14 +6196,14 @@ class SentimentAnalysisOperationAction(AnalyzeTextOperationAction, discriminator :ivar name: task name. :vartype name: str :ivar kind: The Sentiment Analysis kind of the long running task. Required. Sentiment analysis - task + task. :vartype kind: str or ~azure.ai.textanalytics.models.SENTIMENT_ANALYSIS :ivar parameters: Parameters for the Sentiment Analysis task. :vartype parameters: ~azure.ai.textanalytics.models.SentimentAnalysisActionContent """ kind: Literal[AnalyzeTextOperationActionKind.SENTIMENT_ANALYSIS] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The Sentiment Analysis kind of the long running task. Required. Sentiment analysis task""" + """The Sentiment Analysis kind of the long running task. Required. Sentiment analysis task.""" parameters: Optional["_models.SentimentAnalysisActionContent"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -6180,14 +6279,14 @@ class SentimentLROResult(AnalyzeTextLROResult, discriminator="SentimentAnalysisL :vartype status: str or ~azure.ai.textanalytics.models.TextActionState :ivar task_name: task name. :vartype task_name: str - :ivar kind: Kind of the task. Required. Sentiment analysis LRO results + :ivar kind: Kind of the task. Required. Sentiment analysis LRO results. :vartype kind: str or ~azure.ai.textanalytics.models.SENTIMENT_ANALYSIS_OPERATION_RESULTS :ivar results: The sentiment analysis results. Required. :vartype results: ~azure.ai.textanalytics.models.SentimentResult """ kind: Literal[AnalyzeTextOperationResultsKind.SENTIMENT_ANALYSIS_OPERATION_RESULTS] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Kind of the task. Required. Sentiment analysis LRO results""" + """Kind of the task. Required. Sentiment analysis LRO results.""" results: "_models.SentimentResult" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The sentiment analysis results. Required.""" @@ -6688,7 +6787,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class TextEntityLinkingInput(AnalyzeTextInput, discriminator="EntityLinking"): """Contains the analyze text Entity linking input. - :ivar kind: Kind for Entity linking input. Required. Entity linking task + :ivar kind: Kind for Entity linking input. Required. Entity linking task. :vartype kind: str or ~azure.ai.textanalytics.models.ENTITY_LINKING :ivar text_input: Contains the analysis input to be handled by the service. :vartype text_input: ~azure.ai.textanalytics.models.MultiLanguageTextInput @@ -6697,7 +6796,7 @@ class TextEntityLinkingInput(AnalyzeTextInput, discriminator="EntityLinking"): """ kind: Literal[AnalyzeTextInputKind.ENTITY_LINKING] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Kind for Entity linking input. Required. Entity linking task""" + """Kind for Entity linking input. Required. Entity linking task.""" text_input: Optional["_models.MultiLanguageTextInput"] = rest_field( name="analysisInput", visibility=["read", "create", "update", "delete", "query"] ) @@ -6730,7 +6829,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class TextEntityRecognitionInput(AnalyzeTextInput, discriminator="EntityRecognition"): """The entity recognition analyze text input task request. - :ivar kind: The kind of task. Required. Entity recognition task + :ivar kind: The kind of task. Required. Entity recognition task. :vartype kind: str or ~azure.ai.textanalytics.models.ENTITY_RECOGNITION :ivar text_input: The input to be analyzed. :vartype text_input: ~azure.ai.textanalytics.models.MultiLanguageTextInput @@ -6739,7 +6838,7 @@ class TextEntityRecognitionInput(AnalyzeTextInput, discriminator="EntityRecognit """ kind: Literal[AnalyzeTextInputKind.ENTITY_RECOGNITION] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The kind of task. Required. Entity recognition task""" + """The kind of task. Required. Entity recognition task.""" text_input: Optional["_models.MultiLanguageTextInput"] = rest_field( name="analysisInput", visibility=["read", "create", "update", "delete", "query"] ) @@ -6772,7 +6871,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class TextKeyPhraseExtractionInput(AnalyzeTextInput, discriminator="KeyPhraseExtraction"): """Contains the analyze text KeyPhraseExtraction task input. - :ivar kind: Kind of the task. Required. Key phrase extraction task + :ivar kind: Kind of the task. Required. Key phrase extraction task. :vartype kind: str or ~azure.ai.textanalytics.models.KEY_PHRASE_EXTRACTION :ivar text_input: Contains the input documents. :vartype text_input: ~azure.ai.textanalytics.models.MultiLanguageTextInput @@ -6781,7 +6880,7 @@ class TextKeyPhraseExtractionInput(AnalyzeTextInput, discriminator="KeyPhraseExt """ kind: Literal[AnalyzeTextInputKind.KEY_PHRASE_EXTRACTION] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Kind of the task. Required. Key phrase extraction task""" + """Kind of the task. Required. Key phrase extraction task.""" text_input: Optional["_models.MultiLanguageTextInput"] = rest_field( name="analysisInput", visibility=["read", "create", "update", "delete", "query"] ) @@ -6814,7 +6913,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class TextLanguageDetectionInput(AnalyzeTextInput, discriminator="LanguageDetection"): """Contains the language detection document analysis task input. - :ivar kind: Kind of the task. Required. Language detection task + :ivar kind: Kind of the task. Required. Language detection task. :vartype kind: str or ~azure.ai.textanalytics.models.LANGUAGE_DETECTION :ivar text_input: Documents to be analyzed. :vartype text_input: ~azure.ai.textanalytics.models.LanguageDetectionTextInput @@ -6823,7 +6922,7 @@ class TextLanguageDetectionInput(AnalyzeTextInput, discriminator="LanguageDetect """ kind: Literal[AnalyzeTextInputKind.LANGUAGE_DETECTION] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Kind of the task. Required. Language detection task""" + """Kind of the task. Required. Language detection task.""" text_input: Optional["_models.LanguageDetectionTextInput"] = rest_field( name="analysisInput", visibility=["read", "create", "update", "delete", "query"] ) @@ -6856,7 +6955,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class TextPiiEntitiesRecognitionInput(AnalyzeTextInput, discriminator="PiiEntityRecognition"): """Contains the analyze text PIIEntityRecognition task input. - :ivar kind: Kind of the task. Required. PII entity recognition task + :ivar kind: Kind of the task. Required. PII entity recognition task. :vartype kind: str or ~azure.ai.textanalytics.models.PII_ENTITY_RECOGNITION :ivar text_input: Contains the input documents. :vartype text_input: ~azure.ai.textanalytics.models.MultiLanguageTextInput @@ -6865,7 +6964,7 @@ class TextPiiEntitiesRecognitionInput(AnalyzeTextInput, discriminator="PiiEntity """ kind: Literal[AnalyzeTextInputKind.PII_ENTITY_RECOGNITION] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Kind of the task. Required. PII entity recognition task""" + """Kind of the task. Required. PII entity recognition task.""" text_input: Optional["_models.MultiLanguageTextInput"] = rest_field( name="analysisInput", visibility=["read", "create", "update", "delete", "query"] ) @@ -6898,7 +6997,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class TextSentimentAnalysisInput(AnalyzeTextInput, discriminator="SentimentAnalysis"): """Contains the analyze text SentimentAnalysis task input. - :ivar kind: Kind of the task. Required. Sentiment analysis task + :ivar kind: Kind of the task. Required. Sentiment analysis task. :vartype kind: str or ~azure.ai.textanalytics.models.SENTIMENT_ANALYSIS :ivar text_input: Contains the input documents. :vartype text_input: ~azure.ai.textanalytics.models.MultiLanguageTextInput @@ -6907,7 +7006,7 @@ class TextSentimentAnalysisInput(AnalyzeTextInput, discriminator="SentimentAnaly """ kind: Literal[AnalyzeTextInputKind.SENTIMENT_ANALYSIS] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Kind of the task. Required. Sentiment analysis task""" + """Kind of the task. Required. Sentiment analysis task.""" text_input: Optional["_models.MultiLanguageTextInput"] = rest_field( name="analysisInput", visibility=["read", "create", "update", "delete", "query"] ) diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_abstractive_summarization_summary_length_prompt_task_result.py b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_abstractive_summarization_summary_length_prompt_task_result.py new file mode 100644 index 000000000000..7db642c66a8a --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_abstractive_summarization_summary_length_prompt_task_result.py @@ -0,0 +1,33 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.textanalytics import TextAnalysisClient + +""" +# PREREQUISITES + pip install azure-ai-textanalytics +# USAGE + python successful_abstractive_summarization_summary_length_prompt_task_result.py +""" + + +def main(): + client = TextAnalysisClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + ) + + response = client.get_job_status( + job_id="c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18", + ) + print(response) + + +# x-ms-original-file: 2026-05-15-preview/SuccessfulAbstractiveSummarizationSummaryLengthPromptTaskResult.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_abstractive_summarization_summary_length_prompt_task_submit.py b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_abstractive_summarization_summary_length_prompt_task_submit.py new file mode 100644 index 000000000000..79098b6e0a92 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_abstractive_summarization_summary_length_prompt_task_submit.py @@ -0,0 +1,53 @@ +# pylint: disable=line-too-long,useless-suppression +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.textanalytics import TextAnalysisClient + +""" +# PREREQUISITES + pip install azure-ai-textanalytics +# USAGE + python successful_abstractive_summarization_summary_length_prompt_task_submit.py +""" + + +def main(): + client = TextAnalysisClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + ) + + client.begin_analyze_text_job( + body={ + "analysisInput": { + "documents": [ + { + "id": "1", + "language": "en", + "text": "At Microsoft, we have been on a quest to advance AI beyond existing techniques, by taking a more holistic, human-centric approach to learning and understanding. As Chief Technology Officer of Azure AI Cognitive Services, I have been working with a team of amazing scientists and engineers to turn this quest into a reality. In my role, I enjoy a unique perspective in viewing the relationship among three attributes of human cognition: monolingual text (X), audio or visual sensory signals, (Y) and multilingual (Z). At the intersection of all three, there is magic—what we call XYZ-code as illustrated in Figure 1—a joint representation to create more powerful AI that can speak, hear, see, and understand humans better. We believe XYZ-code will enable us to fulfill our long-term vision: cross-domain transfer learning, spanning modalities and languages. The goal is to have pre-trained models that can jointly learn representations to support a broad range of downstream AI tasks, much in the way humans do today. Over the past five years, we have achieved human performance on benchmarks in conversational speech recognition, machine translation, conversational question answering, machine reading comprehension, and image captioning. These five breakthroughs provided us with strong signals toward our more ambitious aspiration to produce a leap in AI capabilities, achieving multi-sensory and multilingual learning that is closer in line with how humans learn and understand. I believe the joint XYZ-code is a foundational component of this aspiration, if grounded with external knowledge sources in the downstream AI tasks.", + } + ] + }, + "displayName": "Document Abstractive Summarization Task Example", + "tasks": [ + { + "kind": "AbstractiveSummarization", + "parameters": {"summaryLength": "medium"}, + "taskName": "Document Abstractive Summarization Task 1", + } + ], + }, + text_input={"documents": [{"id": "str", "text": "str", "language": "str"}]}, + actions=[analyze_text_operation_action], + ).result() + + +# x-ms-original-file: 2026-05-15-preview/SuccessfulAbstractiveSummarizationSummaryLengthPromptTaskSubmit.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_abstractive_summarization_task_result.py b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_abstractive_summarization_task_result.py new file mode 100644 index 000000000000..562009a07046 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_abstractive_summarization_task_result.py @@ -0,0 +1,33 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.textanalytics import TextAnalysisClient + +""" +# PREREQUISITES + pip install azure-ai-textanalytics +# USAGE + python successful_abstractive_summarization_task_result.py +""" + + +def main(): + client = TextAnalysisClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + ) + + response = client.get_job_status( + job_id="c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18", + ) + print(response) + + +# x-ms-original-file: 2026-05-15-preview/SuccessfulAbstractiveSummarizationTaskResult.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_abstractive_summarization_task_submit.py b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_abstractive_summarization_task_submit.py new file mode 100644 index 000000000000..8d690767a074 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_abstractive_summarization_task_submit.py @@ -0,0 +1,53 @@ +# pylint: disable=line-too-long,useless-suppression +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.textanalytics import TextAnalysisClient + +""" +# PREREQUISITES + pip install azure-ai-textanalytics +# USAGE + python successful_abstractive_summarization_task_submit.py +""" + + +def main(): + client = TextAnalysisClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + ) + + client.begin_analyze_text_job( + body={ + "analysisInput": { + "documents": [ + { + "id": "1", + "language": "en", + "text": "At Microsoft, we have been on a quest to advance AI beyond existing techniques, by taking a more holistic, human-centric approach to learning and understanding. As Chief Technology Officer of Azure AI Cognitive Services, I have been working with a team of amazing scientists and engineers to turn this quest into a reality. In my role, I enjoy a unique perspective in viewing the relationship among three attributes of human cognition: monolingual text (X), audio or visual sensory signals, (Y) and multilingual (Z). At the intersection of all three, there is magic—what we call XYZ-code as illustrated in Figure 1—a joint representation to create more powerful AI that can speak, hear, see, and understand humans better. We believe XYZ-code will enable us to fulfill our long-term vision: cross-domain transfer learning, spanning modalities and languages. The goal is to have pre-trained models that can jointly learn representations to support a broad range of downstream AI tasks, much in the way humans do today. Over the past five years, we have achieved human performance on benchmarks in conversational speech recognition, machine translation, conversational question answering, machine reading comprehension, and image captioning. These five breakthroughs provided us with strong signals toward our more ambitious aspiration to produce a leap in AI capabilities, achieving multi-sensory and multilingual learning that is closer in line with how humans learn and understand. I believe the joint XYZ-code is a foundational component of this aspiration, if grounded with external knowledge sources in the downstream AI tasks.", + } + ] + }, + "displayName": "Document Abstractive Summarization Task Example", + "tasks": [ + { + "kind": "AbstractiveSummarization", + "parameters": {"sentenceCount": 1}, + "taskName": "Document Abstractive Summarization Task 1", + } + ], + }, + text_input={"documents": [{"id": "str", "text": "str", "language": "str"}]}, + actions=[analyze_text_operation_action], + ).result() + + +# x-ms-original-file: 2026-05-15-preview/SuccessfulAbstractiveSummarizationTaskSubmit.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_analyze_text_jobs_cancel_request.py b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_analyze_text_jobs_cancel_request.py new file mode 100644 index 000000000000..331e3bb0b6ef --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_analyze_text_jobs_cancel_request.py @@ -0,0 +1,32 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.textanalytics import TextAnalysisClient + +""" +# PREREQUISITES + pip install azure-ai-textanalytics +# USAGE + python successful_analyze_text_jobs_cancel_request.py +""" + + +def main(): + client = TextAnalysisClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + ) + + client.begin_cancel_job( + job_id="c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18", + ).result() + + +# x-ms-original-file: 2026-05-15-preview/SuccessfulAnalyzeTextJobsCancelRequest.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_analyze_text_jobs_multiple_task_status_request.py b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_analyze_text_jobs_multiple_task_status_request.py new file mode 100644 index 000000000000..0710ffd0b8a1 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_analyze_text_jobs_multiple_task_status_request.py @@ -0,0 +1,33 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.textanalytics import TextAnalysisClient + +""" +# PREREQUISITES + pip install azure-ai-textanalytics +# USAGE + python successful_analyze_text_jobs_multiple_task_status_request.py +""" + + +def main(): + client = TextAnalysisClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + ) + + response = client.get_job_status( + job_id="c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18", + ) + print(response) + + +# x-ms-original-file: 2026-05-15-preview/SuccessfulAnalyzeTextJobsMultipleTaskStatusRequest.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_analyze_text_jobs_multiple_task_submit_request.py b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_analyze_text_jobs_multiple_task_submit_request.py new file mode 100644 index 000000000000..55b8e8c1808b --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_analyze_text_jobs_multiple_task_submit_request.py @@ -0,0 +1,54 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.textanalytics import TextAnalysisClient + +""" +# PREREQUISITES + pip install azure-ai-textanalytics +# USAGE + python successful_analyze_text_jobs_multiple_task_submit_request.py +""" + + +def main(): + client = TextAnalysisClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + ) + + client.begin_analyze_text_job( + body={ + "analysisInput": { + "documents": [ + {"id": "1", "language": "en", "text": "I had a wonderful trip to Seattle last week."}, + {"id": "2", "language": "en", "text": "I'm flying to NYC tomorrow. See you there."}, + ] + }, + "displayName": "Extracting Location & US Region", + "tasks": [ + { + "kind": "EntityRecognition", + "parameters": {"modelVersion": "latest"}, + "taskName": "Recognize Entities", + }, + { + "kind": "CustomEntityRecognition", + "parameters": {"deploymentName": "MyDeployment", "projectName": "MyProject"}, + "taskName": "Recognize US Regions", + }, + ], + }, + text_input={"documents": [{"id": "str", "text": "str", "language": "str"}]}, + actions=[analyze_text_operation_action], + ).result() + + +# x-ms-original-file: 2026-05-15-preview/SuccessfulAnalyzeTextJobsMultipleTaskSubmitRequest.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_entity_linking_request.py b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_entity_linking_request.py new file mode 100644 index 000000000000..20d85bff1a35 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_entity_linking_request.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.textanalytics import TextAnalysisClient + +""" +# PREREQUISITES + pip install azure-ai-textanalytics +# USAGE + python successful_entity_linking_request.py +""" + + +def main(): + client = TextAnalysisClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + ) + + response = client.analyze_text( + body={ + "analysisInput": { + "documents": [ + {"id": "1", "language": "en", "text": "Microsoft was founded by Bill Gates and Paul Allen."}, + {"id": "2", "language": "en", "text": "Pike place market is my favorite Seattle attraction."}, + ] + }, + "kind": "EntityLinking", + "parameters": {"modelVersion": "latest"}, + }, + ) + print(response) + + +# x-ms-original-file: 2026-05-15-preview/SuccessfulEntityLinkingRequest.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_entity_recognition_exclusion_request.py b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_entity_recognition_exclusion_request.py new file mode 100644 index 000000000000..606ad2106fd2 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_entity_recognition_exclusion_request.py @@ -0,0 +1,51 @@ +# pylint: disable=line-too-long,useless-suppression +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.textanalytics import TextAnalysisClient + +""" +# PREREQUISITES + pip install azure-ai-textanalytics +# USAGE + python successful_entity_recognition_exclusion_request.py +""" + + +def main(): + client = TextAnalysisClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + ) + + response = client.analyze_text( + body={ + "analysisInput": { + "documents": [ + {"id": "2", "language": "en", "text": "When I was 5 years old I had $90.00 dollars to my name."}, + { + "id": "3", + "language": "en", + "text": "When we flew from LAX it seemed like we were moving at 10 meters per second. I was lucky to see Amsterdam, Effile Tower, and the Nile.", + }, + ] + }, + "kind": "EntityRecognition", + "parameters": { + "exclusionList": ["Numeric"], + "modelVersion": "latest", + "overlapPolicy": {"policyKind": "allowOverlap"}, + }, + }, + ) + print(response) + + +# x-ms-original-file: 2026-05-15-preview/SuccessfulEntityRecognitionExclusionRequest.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_entity_recognition_inclusion_request.py b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_entity_recognition_inclusion_request.py new file mode 100644 index 000000000000..4eed4bae5fbb --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_entity_recognition_inclusion_request.py @@ -0,0 +1,47 @@ +# pylint: disable=line-too-long,useless-suppression +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.textanalytics import TextAnalysisClient + +""" +# PREREQUISITES + pip install azure-ai-textanalytics +# USAGE + python successful_entity_recognition_inclusion_request.py +""" + + +def main(): + client = TextAnalysisClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + ) + + response = client.analyze_text( + body={ + "analysisInput": { + "documents": [ + {"id": "2", "language": "en", "text": "When I was 5 years old I had $90.00 dollars to my name."}, + { + "id": "3", + "language": "en", + "text": "When we flew from LAX it seemed like we were moving at 10 meters per second. I was lucky to see Amsterdam, Effile Tower, and the Nile.", + }, + ] + }, + "kind": "EntityRecognition", + "parameters": {"inclusionList": ["Location"], "modelVersion": "latest"}, + }, + ) + print(response) + + +# x-ms-original-file: 2026-05-15-preview/SuccessfulEntityRecognitionInclusionRequest.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_entity_recognition_inference_options_request.py b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_entity_recognition_inference_options_request.py new file mode 100644 index 000000000000..ee779bcd9ab6 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_entity_recognition_inference_options_request.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.textanalytics import TextAnalysisClient + +""" +# PREREQUISITES + pip install azure-ai-textanalytics +# USAGE + python successful_entity_recognition_inference_options_request.py +""" + + +def main(): + client = TextAnalysisClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + ) + + response = client.analyze_text( + body={ + "analysisInput": { + "documents": [ + {"id": "1", "language": "en", "text": "When I was 5 years old I had $90.00 dollars to my name."} + ] + }, + "kind": "EntityRecognition", + "parameters": {"inferenceOptions": {"excludeNormalizedValues": True}, "modelVersion": "latest"}, + }, + ) + print(response) + + +# x-ms-original-file: 2026-05-15-preview/SuccessfulEntityRecognitionInferenceOptionsRequest.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_entity_recognition_overlap_policy.py b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_entity_recognition_overlap_policy.py new file mode 100644 index 000000000000..2281bb7b2199 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_entity_recognition_overlap_policy.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.textanalytics import TextAnalysisClient + +""" +# PREREQUISITES + pip install azure-ai-textanalytics +# USAGE + python successful_entity_recognition_overlap_policy.py +""" + + +def main(): + client = TextAnalysisClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + ) + + response = client.analyze_text( + body={ + "analysisInput": { + "documents": [ + { + "id": "4", + "language": "en", + "text": "25th April Meeting was an intresting one. At least we gont to experience the WorldCup", + } + ] + }, + "kind": "EntityRecognition", + "parameters": {"modelVersion": "latest", "overlapPolicy": {"policyKind": "matchLongest"}}, + }, + ) + print(response) + + +# x-ms-original-file: 2026-05-15-preview/SuccessfulEntityRecognitionOverlapPolicy.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_entity_recognition_request.py b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_entity_recognition_request.py new file mode 100644 index 000000000000..d64b359867de --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_entity_recognition_request.py @@ -0,0 +1,53 @@ +# pylint: disable=line-too-long,useless-suppression +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.textanalytics import TextAnalysisClient + +""" +# PREREQUISITES + pip install azure-ai-textanalytics +# USAGE + python successful_entity_recognition_request.py +""" + + +def main(): + client = TextAnalysisClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + ) + + response = client.analyze_text( + body={ + "analysisInput": { + "documents": [ + {"id": "2", "language": "en", "text": "When I was 5 years old I had $90.00 dollars to my name."}, + { + "id": "3", + "language": "en", + "text": "When we flew from LAX it seemed like we were moving at 10 meters per second. I was lucky to see Amsterdam, Effile Tower, and the Nile.", + }, + { + "id": "4", + "language": "en", + "text": "25th April Meeting was an intresting one. At least we gont to experience the WorldCup", + }, + {"id": "5", "language": "en", "text": "My IP is 127.12.1.1 and my phone number is 5555555555"}, + ] + }, + "kind": "EntityRecognition", + "parameters": {"modelVersion": "latest", "overlapPolicy": {"policyKind": "allowOverlap"}}, + }, + ) + print(response) + + +# x-ms-original-file: 2026-05-15-preview/SuccessfulEntityRecognitionRequest.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_healthcare_document_type_post_request.py b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_healthcare_document_type_post_request.py new file mode 100644 index 000000000000..8be63f7e2d29 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_healthcare_document_type_post_request.py @@ -0,0 +1,48 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.textanalytics import TextAnalysisClient + +""" +# PREREQUISITES + pip install azure-ai-textanalytics +# USAGE + python successful_healthcare_document_type_post_request.py +""" + + +def main(): + client = TextAnalysisClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + ) + + client.begin_analyze_text_job( + body={ + "analysisInput": { + "documents": [{"id": "1", "language": "en", "text": "Prescribed 100mg ibuprofen, taken twice daily."}] + }, + "tasks": [ + { + "kind": "Healthcare", + "parameters": { + "documentType": "DischargeSummary", + "fhirVersion": "4.0.1", + "modelVersion": "latest", + }, + } + ], + }, + text_input={"documents": [{"id": "str", "text": "str", "language": "str"}]}, + actions=[analyze_text_operation_action], + ).result() + + +# x-ms-original-file: 2026-05-15-preview/SuccessfulHealthcareDocumentTypePostRequest.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_healthcare_document_type_task_status_request.py b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_healthcare_document_type_task_status_request.py new file mode 100644 index 000000000000..e8035c6274c8 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_healthcare_document_type_task_status_request.py @@ -0,0 +1,33 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.textanalytics import TextAnalysisClient + +""" +# PREREQUISITES + pip install azure-ai-textanalytics +# USAGE + python successful_healthcare_document_type_task_status_request.py +""" + + +def main(): + client = TextAnalysisClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + ) + + response = client.get_job_status( + job_id="15e4a46b-62e2-4386-8d36-9c2a92bb45dd", + ) + print(response) + + +# x-ms-original-file: 2026-05-15-preview/SuccessfulHealthcareDocumentTypeTaskStatusRequest.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_healthcare_post_request.py b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_healthcare_post_request.py new file mode 100644 index 000000000000..90ad99f15bb6 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_healthcare_post_request.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.textanalytics import TextAnalysisClient + +""" +# PREREQUISITES + pip install azure-ai-textanalytics +# USAGE + python successful_healthcare_post_request.py +""" + + +def main(): + client = TextAnalysisClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + ) + + client.begin_analyze_text_job( + body={ + "analysisInput": { + "documents": [{"id": "1", "language": "en", "text": "Prescribed 100mg ibuprofen, taken twice daily."}] + }, + "tasks": [{"kind": "Healthcare", "parameters": {"modelVersion": "latest"}}], + }, + text_input={"documents": [{"id": "str", "text": "str", "language": "str"}]}, + actions=[analyze_text_operation_action], + ).result() + + +# x-ms-original-file: 2026-05-15-preview/SuccessfulHealthcarePostRequest.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_healthcare_task_status_request.py b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_healthcare_task_status_request.py new file mode 100644 index 000000000000..e1684baabb56 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_healthcare_task_status_request.py @@ -0,0 +1,33 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.textanalytics import TextAnalysisClient + +""" +# PREREQUISITES + pip install azure-ai-textanalytics +# USAGE + python successful_healthcare_task_status_request.py +""" + + +def main(): + client = TextAnalysisClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + ) + + response = client.get_job_status( + job_id="1780194a-e9c1-4298-b0d4-fdc59ba818a0", + ) + print(response) + + +# x-ms-original-file: 2026-05-15-preview/SuccessfulHealthcareTaskStatusRequest.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_key_phrase_extraction_request.py b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_key_phrase_extraction_request.py new file mode 100644 index 000000000000..f828cd625468 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_key_phrase_extraction_request.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.textanalytics import TextAnalysisClient + +""" +# PREREQUISITES + pip install azure-ai-textanalytics +# USAGE + python successful_key_phrase_extraction_request.py +""" + + +def main(): + client = TextAnalysisClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + ) + + response = client.analyze_text( + body={ + "analysisInput": { + "documents": [ + {"id": "1", "language": "en", "text": "Microsoft was founded by Bill Gates and Paul Allen."}, + {"id": "2", "language": "en", "text": "Text Analytics is one of the Azure Cognitive Services."}, + {"id": "3", "language": "en", "text": "My cat might need to see a veterinarian."}, + ] + }, + "kind": "KeyPhraseExtraction", + "parameters": {"modelVersion": "latest"}, + }, + ) + print(response) + + +# x-ms-original-file: 2026-05-15-preview/SuccessfulKeyPhraseExtractionRequest.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_language_detection_request.py b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_language_detection_request.py new file mode 100644 index 000000000000..463ae26051cf --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_language_detection_request.py @@ -0,0 +1,44 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.textanalytics import TextAnalysisClient + +""" +# PREREQUISITES + pip install azure-ai-textanalytics +# USAGE + python successful_language_detection_request.py +""" + + +def main(): + client = TextAnalysisClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + ) + + response = client.analyze_text( + body={ + "analysisInput": { + "documents": [ + {"id": "1", "text": "Hello world"}, + {"id": "2", "text": "Bonjour tout le monde"}, + {"id": "3", "text": "Hola mundo"}, + {"id": "4", "text": "Tumhara naam kya hai?"}, + ] + }, + "kind": "LanguageDetection", + "parameters": {"modelVersion": "latest"}, + }, + ) + print(response) + + +# x-ms-original-file: 2026-05-15-preview/SuccessfulLanguageDetectionRequest.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_pii_entity_recognition_exclusion_request.py b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_pii_entity_recognition_exclusion_request.py new file mode 100644 index 000000000000..6300afe35b84 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_pii_entity_recognition_exclusion_request.py @@ -0,0 +1,48 @@ +# pylint: disable=line-too-long,useless-suppression +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.textanalytics import TextAnalysisClient + +""" +# PREREQUISITES + pip install azure-ai-textanalytics +# USAGE + python successful_pii_entity_recognition_exclusion_request.py +""" + + +def main(): + client = TextAnalysisClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + ) + + response = client.analyze_text( + body={ + "analysisInput": { + "documents": [ + {"id": "1", "language": "en", "text": "My SSN is 859-98-0987"}, + { + "id": "2", + "language": "en", + "text": "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check.", + }, + {"id": "3", "language": "en", "text": "Is 998.214.865-68 your Brazilian CPF number?"}, + ] + }, + "kind": "PiiEntityRecognition", + "parameters": {"excludePiiCategories": ["USSocialSecurityNumber"], "modelVersion": "latest"}, + }, + ) + print(response) + + +# x-ms-original-file: 2026-05-15-preview/SuccessfulPiiEntityRecognitionExclusionRequest.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_pii_entity_recognition_masked_entities.py b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_pii_entity_recognition_masked_entities.py new file mode 100644 index 000000000000..b730432e4abf --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_pii_entity_recognition_masked_entities.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.textanalytics import TextAnalysisClient + +""" +# PREREQUISITES + pip install azure-ai-textanalytics +# USAGE + python successful_pii_entity_recognition_masked_entities.py +""" + + +def main(): + client = TextAnalysisClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + ) + + response = client.analyze_text( + body={ + "analysisInput": { + "documents": [ + {"id": "1", "language": "en", "text": "My name is John Doe My phone number is 424 878 9192"} + ] + }, + "kind": "PiiEntityRecognition", + "parameters": {"modelVersion": "latest", "redactionPolicies": [{"policyKind": "entityMask"}]}, + }, + ) + print(response) + + +# x-ms-original-file: 2026-05-15-preview/SuccessfulPiiEntityRecognitionMaskedEntities.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_pii_entity_recognition_redaction_policy_request.py b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_pii_entity_recognition_redaction_policy_request.py new file mode 100644 index 000000000000..e0ace3aa53e0 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_pii_entity_recognition_redaction_policy_request.py @@ -0,0 +1,51 @@ +# pylint: disable=line-too-long,useless-suppression +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.textanalytics import TextAnalysisClient + +""" +# PREREQUISITES + pip install azure-ai-textanalytics +# USAGE + python successful_pii_entity_recognition_redaction_policy_request.py +""" + + +def main(): + client = TextAnalysisClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + ) + + response = client.analyze_text( + body={ + "analysisInput": { + "documents": [ + {"id": "1", "language": "en", "text": "My SSN is 859-98-0987"}, + { + "id": "2", + "language": "en", + "text": "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check.", + }, + {"id": "3", "language": "en", "text": "Is 998.214.865-68 your Brazilian CPF number?"}, + ] + }, + "kind": "PiiEntityRecognition", + "parameters": { + "modelVersion": "latest", + "redactionPolicies": [{"policyKind": "characterMask", "redactionCharacter": "-"}], + }, + }, + ) + print(response) + + +# x-ms-original-file: 2026-05-15-preview/SuccessfulPiiEntityRecognitionRedactionPolicyRequest.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_pii_entity_recognition_request.py b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_pii_entity_recognition_request.py new file mode 100644 index 000000000000..0a1631c9c809 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_pii_entity_recognition_request.py @@ -0,0 +1,48 @@ +# pylint: disable=line-too-long,useless-suppression +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.textanalytics import TextAnalysisClient + +""" +# PREREQUISITES + pip install azure-ai-textanalytics +# USAGE + python successful_pii_entity_recognition_request.py +""" + + +def main(): + client = TextAnalysisClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + ) + + response = client.analyze_text( + body={ + "analysisInput": { + "documents": [ + {"id": "1", "language": "en", "text": "My SSN is 859-98-0987"}, + { + "id": "2", + "language": "en", + "text": "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check.", + }, + {"id": "3", "language": "en", "text": "Is 998.214.865-68 your Brazilian CPF number?"}, + ] + }, + "kind": "PiiEntityRecognition", + "parameters": {"modelVersion": "latest"}, + }, + ) + print(response) + + +# x-ms-original-file: 2026-05-15-preview/SuccessfulPiiEntityRecognitionRequest.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_sentiment_analysis_request.py b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_sentiment_analysis_request.py new file mode 100644 index 000000000000..aa61b5283ce3 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_samples/successful_sentiment_analysis_request.py @@ -0,0 +1,46 @@ +# pylint: disable=line-too-long,useless-suppression +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.textanalytics import TextAnalysisClient + +""" +# PREREQUISITES + pip install azure-ai-textanalytics +# USAGE + python successful_sentiment_analysis_request.py +""" + + +def main(): + client = TextAnalysisClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + ) + + response = client.analyze_text( + body={ + "analysisInput": { + "documents": [ + { + "id": "1", + "language": "en", + "text": "Great atmosphere. Close to plenty of restaurants, hotels, and transit! Staff are friendly and helpful.", + } + ] + }, + "kind": "SentimentAnalysis", + "parameters": {"modelVersion": "latest"}, + }, + ) + print(response) + + +# x-ms-original-file: 2026-05-15-preview/SuccessfulSentimentAnalysisRequest.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/generated_tests/conftest.py b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_tests/conftest.py new file mode 100644 index 000000000000..ccd8191281d6 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_tests/conftest.py @@ -0,0 +1,37 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# For security, please avoid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + textanalysis_subscription_id = os.environ.get( + "TEXTANALYSIS_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" + ) + textanalysis_tenant_id = os.environ.get("TEXTANALYSIS_TENANT_ID", "00000000-0000-0000-0000-000000000000") + textanalysis_client_id = os.environ.get("TEXTANALYSIS_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + textanalysis_client_secret = os.environ.get("TEXTANALYSIS_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=textanalysis_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=textanalysis_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=textanalysis_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=textanalysis_client_secret, value="00000000-0000-0000-0000-000000000000") + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/generated_tests/test_text_analysis.py b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_tests/test_text_analysis.py new file mode 100644 index 000000000000..630d309a5db9 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_tests/test_text_analysis.py @@ -0,0 +1,69 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils import recorded_by_proxy +from testpreparer import TextAnalysisClientTestBase, TextAnalysisPreparer + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestTextAnalysis(TextAnalysisClientTestBase): + @TextAnalysisPreparer() + @recorded_by_proxy + def test_analyze_text(self, textanalysis_endpoint): + client = self.create_client(endpoint=textanalysis_endpoint) + response = client.analyze_text( + body={ + "kind": "EntityLinking", + "analysisInput": {"documents": [{"id": "str", "text": "str", "language": "str"}]}, + "parameters": {"loggingOptOut": bool, "modelVersion": "str", "stringIndexType": "str"}, + }, + ) + + # please add some check logic here by yourself + # ... + + @TextAnalysisPreparer() + @recorded_by_proxy + def test_get_job_status(self, textanalysis_endpoint): + client = self.create_client(endpoint=textanalysis_endpoint) + response = client.get_job_status( + job_id="str", + ) + + # please add some check logic here by yourself + # ... + + @TextAnalysisPreparer() + @recorded_by_proxy + def test_begin_analyze_text_job(self, textanalysis_endpoint): + client = self.create_client(endpoint=textanalysis_endpoint) + response = client.begin_analyze_text_job( + body={ + "analysisInput": {"documents": [{"id": "str", "text": "str", "language": "str"}]}, + "tasks": ["analyze_text_operation_action"], + "cancelAfter": 0.0, + "defaultLanguage": "str", + "displayName": "str", + }, + text_input={"documents": [{"id": "str", "text": "str", "language": "str"}]}, + actions=["analyze_text_operation_action"], + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @TextAnalysisPreparer() + @recorded_by_proxy + def test_begin_cancel_job(self, textanalysis_endpoint): + client = self.create_client(endpoint=textanalysis_endpoint) + response = client.begin_cancel_job( + job_id="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/generated_tests/test_text_analysis_async.py b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_tests/test_text_analysis_async.py new file mode 100644 index 000000000000..8e958080d835 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_tests/test_text_analysis_async.py @@ -0,0 +1,74 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils.aio import recorded_by_proxy_async +from testpreparer import TextAnalysisPreparer +from testpreparer_async import TextAnalysisClientTestBaseAsync + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestTextAnalysisAsync(TextAnalysisClientTestBaseAsync): + @TextAnalysisPreparer() + @recorded_by_proxy_async + async def test_analyze_text(self, textanalysis_endpoint): + client = self.create_async_client(endpoint=textanalysis_endpoint) + response = await client.analyze_text( + body={ + "kind": "EntityLinking", + "analysisInput": {"documents": [{"id": "str", "text": "str", "language": "str"}]}, + "parameters": {"loggingOptOut": bool, "modelVersion": "str", "stringIndexType": "str"}, + }, + ) + + # please add some check logic here by yourself + # ... + + @TextAnalysisPreparer() + @recorded_by_proxy_async + async def test_get_job_status(self, textanalysis_endpoint): + client = self.create_async_client(endpoint=textanalysis_endpoint) + response = await client.get_job_status( + job_id="str", + ) + + # please add some check logic here by yourself + # ... + + @TextAnalysisPreparer() + @recorded_by_proxy_async + async def test_begin_analyze_text_job(self, textanalysis_endpoint): + client = self.create_async_client(endpoint=textanalysis_endpoint) + response = await ( + await client.begin_analyze_text_job( + body={ + "analysisInput": {"documents": [{"id": "str", "text": "str", "language": "str"}]}, + "tasks": ["analyze_text_operation_action"], + "cancelAfter": 0.0, + "defaultLanguage": "str", + "displayName": "str", + }, + text_input={"documents": [{"id": "str", "text": "str", "language": "str"}]}, + actions=["analyze_text_operation_action"], + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @TextAnalysisPreparer() + @recorded_by_proxy_async + async def test_begin_cancel_job(self, textanalysis_endpoint): + client = self.create_async_client(endpoint=textanalysis_endpoint) + response = await ( + await client.begin_cancel_job( + job_id="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/generated_tests/testpreparer.py b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_tests/testpreparer.py new file mode 100644 index 000000000000..7f2384bf46a8 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_tests/testpreparer.py @@ -0,0 +1,26 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from azure.ai.textanalytics import TextAnalysisClient +from devtools_testutils import AzureRecordedTestCase, PowerShellPreparer +import functools + + +class TextAnalysisClientTestBase(AzureRecordedTestCase): + + def create_client(self, endpoint): + credential = self.get_credential(TextAnalysisClient) + return self.create_client_from_credential( + TextAnalysisClient, + credential=credential, + endpoint=endpoint, + ) + + +TextAnalysisPreparer = functools.partial( + PowerShellPreparer, "textanalysis", textanalysis_endpoint="https://fake_textanalysis_endpoint.com" +) diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/generated_tests/testpreparer_async.py b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_tests/testpreparer_async.py new file mode 100644 index 000000000000..daa67de13e8c --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/generated_tests/testpreparer_async.py @@ -0,0 +1,20 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from azure.ai.textanalytics.aio import TextAnalysisClient +from devtools_testutils import AzureRecordedTestCase + + +class TextAnalysisClientTestBaseAsync(AzureRecordedTestCase): + + def create_async_client(self, endpoint): + credential = self.get_credential(TextAnalysisClient, is_async=True) + return self.create_client_from_credential( + TextAnalysisClient, + credential=credential, + endpoint=endpoint, + ) diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/pyproject.toml b/sdk/cognitivelanguage/azure-ai-textanalytics/pyproject.toml index e37e0b87d524..f4bec33fca4c 100644 --- a/sdk/cognitivelanguage/azure-ai-textanalytics/pyproject.toml +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/samples/async_samples/sample_authentication_async.py b/sdk/cognitivelanguage/azure-ai-textanalytics/samples/async_samples/sample_authentication_async.py index a2bdfba0ff80..5f8c837a8185 100644 --- a/sdk/cognitivelanguage/azure-ai-textanalytics/samples/async_samples/sample_authentication_async.py +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/samples/async_samples/sample_authentication_async.py @@ -39,7 +39,7 @@ async def sample_authentication_api_key_async(): endpoint = os.environ["AZURE_TEXT_ENDPOINT"] key = os.environ["AZURE_TEXT_KEY"] - text_client = TextAnalysisClient(endpoint, AzureKeyCredential(key)) # pylint:disable=unused-variable + text_client = TextAnalysisClient(endpoint, AzureKeyCredential(key)) # pylint:disable=unused-variable # [END create_ta_client_with_key_async] @@ -56,7 +56,7 @@ async def sample_authentication_with_aad(): endpoint = os.environ["AZURE_TEXT_ENDPOINT"] credential = DefaultAzureCredential() - text_client = TextAnalysisClient(endpoint, credential=credential) # pylint:disable=unused-variable + text_client = TextAnalysisClient(endpoint, credential=credential) # pylint:disable=unused-variable # [END create_ta_client_with_aad_async] diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/samples/sample_authentication.py b/sdk/cognitivelanguage/azure-ai-textanalytics/samples/sample_authentication.py index 780f1988ff0a..6b692a2de691 100644 --- a/sdk/cognitivelanguage/azure-ai-textanalytics/samples/sample_authentication.py +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/samples/sample_authentication.py @@ -38,7 +38,7 @@ def sample_authentication_api_key(): endpoint = os.environ["AZURE_TEXT_ENDPOINT"] key = os.environ["AZURE_TEXT_KEY"] - text_client = TextAnalysisClient(endpoint, AzureKeyCredential(key)) # pylint:disable=unused-variable + text_client = TextAnalysisClient(endpoint, AzureKeyCredential(key)) # pylint:disable=unused-variable # [END create_ta_client_with_key] @@ -55,7 +55,7 @@ def sample_authentication_with_aad(): endpoint = os.environ["AZURE_TEXT_ENDPOINT"] credential = DefaultAzureCredential() - text_client = TextAnalysisClient(endpoint, credential=credential) # pylint:disable=unused-variable + text_client = TextAnalysisClient(endpoint, credential=credential) # pylint:disable=unused-variable # [END create_ta_client_with_aad] diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/tests/test_abstract_summary_async.py b/sdk/cognitivelanguage/azure-ai-textanalytics/tests/test_abstract_summary_async.py index c1abc6af1d27..b088aa088ea5 100644 --- a/sdk/cognitivelanguage/azure-ai-textanalytics/tests/test_abstract_summary_async.py +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/tests/test_abstract_summary_async.py @@ -44,9 +44,7 @@ class TestTextAnalysisCaseAsync(TestTextAnalysisAsync): @TextAnalysisPreparer() @recorded_by_proxy_async @pytest.mark.asyncio - async def test_abstract_summary_async( - self, text_analysis_endpoint, text_analysis_key - ): + async def test_abstract_summary_async(self, text_analysis_endpoint, text_analysis_key): async with self.create_client(text_analysis_endpoint, text_analysis_key) as client: text_a = ( "Windows 365 was in the works before COVID-19 sent companies around the world on a scramble to secure " diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/tests/test_extract_summary_async.py b/sdk/cognitivelanguage/azure-ai-textanalytics/tests/test_extract_summary_async.py index 2815c3f92c96..9b9ae42605f3 100644 --- a/sdk/cognitivelanguage/azure-ai-textanalytics/tests/test_extract_summary_async.py +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/tests/test_extract_summary_async.py @@ -42,9 +42,7 @@ class TestTextAnalysisCaseAsync(TestTextAnalysisAsync): @TextAnalysisPreparer() @recorded_by_proxy_async @pytest.mark.asyncio - async def test_extract_summary_async( - self, text_analysis_endpoint, text_analysis_key - ): + async def test_extract_summary_async(self, text_analysis_endpoint, text_analysis_key): async with self.create_client(text_analysis_endpoint, text_analysis_key) as client: text_a = ( "Windows 365 was in the works before COVID-19 sent companies around the world on a scramble to secure " diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/tests/test_multi_label_classify_async.py b/sdk/cognitivelanguage/azure-ai-textanalytics/tests/test_multi_label_classify_async.py index a1b1f1ad3d60..c8e1f4c3cd85 100644 --- a/sdk/cognitivelanguage/azure-ai-textanalytics/tests/test_multi_label_classify_async.py +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/tests/test_multi_label_classify_async.py @@ -44,9 +44,7 @@ class TestTextAnalysisCaseAsync(TestTextAnalysisAsync): @TextAnalysisPreparer() @recorded_by_proxy_async @pytest.mark.asyncio - async def test_multi_label_classify_async( - self, text_analysis_endpoint, text_analysis_key - ): + async def test_multi_label_classify_async(self, text_analysis_endpoint, text_analysis_key): async with self.create_client(text_analysis_endpoint, text_analysis_key) as client: project_name = "multi-class-project" deployment_name = "multiclassdeployment" diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/tests/test_recognize_pii_confidence_score.py b/sdk/cognitivelanguage/azure-ai-textanalytics/tests/test_recognize_pii_confidence_score.py index 4d7e0e7dcf31..3b1d164816a1 100644 --- a/sdk/cognitivelanguage/azure-ai-textanalytics/tests/test_recognize_pii_confidence_score.py +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/tests/test_recognize_pii_confidence_score.py @@ -54,9 +54,7 @@ def test_recognize_pii_confidence_score(self, text_analysis_endpoint, text_analy email_override = ConfidenceScoreThresholdOverride(value=0.9, entity="Email") confidence_threshold = ConfidenceScoreThreshold(default=0.3, overrides=[ssn_override, email_override]) # Parameters - parameters = PiiActionContent( - pii_categories=["All"], confidence_score_threshold=confidence_threshold - ) + parameters = PiiActionContent(pii_categories=["All"], confidence_score_threshold=confidence_threshold) body = TextPiiEntitiesRecognitionInput(text_input=text_input, action_content=parameters) diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/tests/test_recognize_pii_confidence_score_async.py b/sdk/cognitivelanguage/azure-ai-textanalytics/tests/test_recognize_pii_confidence_score_async.py index 4e40209054fd..59183735f2ae 100644 --- a/sdk/cognitivelanguage/azure-ai-textanalytics/tests/test_recognize_pii_confidence_score_async.py +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/tests/test_recognize_pii_confidence_score_async.py @@ -43,7 +43,7 @@ class TestTextAnalysisCase_NewPIIThresholds(TestTextAnalysis): @TextAnalysisPreparer() @recorded_by_proxy_async @pytest.mark.asyncio - async def test_recognize_pii_confidence_score_async( # pylint: disable=name-too-long + async def test_recognize_pii_confidence_score_async( # pylint: disable=name-too-long self, text_analysis_endpoint, text_analysis_key ): async with self.create_client(text_analysis_endpoint, text_analysis_key) as client: @@ -64,9 +64,7 @@ async def test_recognize_pii_confidence_score_async( # pylint: disable=name-too- confidence_threshold = ConfidenceScoreThreshold(default=0.3, overrides=[ssn_override, email_override]) # Parameters - parameters = PiiActionContent( - pii_categories=["All"], confidence_score_threshold=confidence_threshold - ) + parameters = PiiActionContent(pii_categories=["All"], confidence_score_threshold=confidence_threshold) body = TextPiiEntitiesRecognitionInput(text_input=text_input, action_content=parameters) diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/tests/test_recognize_pii_redaction_policies_async.py b/sdk/cognitivelanguage/azure-ai-textanalytics/tests/test_recognize_pii_redaction_policies_async.py index b87de711542f..8a367ace568f 100644 --- a/sdk/cognitivelanguage/azure-ai-textanalytics/tests/test_recognize_pii_redaction_policies_async.py +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/tests/test_recognize_pii_redaction_policies_async.py @@ -43,7 +43,9 @@ class TestTextAnalysisCase(TestTextAnalysis): @TextAnalysisPreparer() @recorded_by_proxy_async @pytest.mark.asyncio - async def test_recognize_pii_redaction_policies_async(self, text_analysis_endpoint, text_analysis_key): # pylint: disable=name-too-long + async def test_recognize_pii_redaction_policies_async( + self, text_analysis_endpoint, text_analysis_key + ): # pylint: disable=name-too-long async with self.create_client(text_analysis_endpoint, text_analysis_key) as client: # Documents diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/tests/test_single_label_classify_async.py b/sdk/cognitivelanguage/azure-ai-textanalytics/tests/test_single_label_classify_async.py index 886e7d50fea6..f4a7ea156492 100644 --- a/sdk/cognitivelanguage/azure-ai-textanalytics/tests/test_single_label_classify_async.py +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/tests/test_single_label_classify_async.py @@ -44,9 +44,7 @@ class TestTextAnalysisCaseAsync(TestTextAnalysisAsync): @TextAnalysisPreparer() @recorded_by_proxy_async @pytest.mark.asyncio - async def test_single_label_classify_async( - self, text_analysis_endpoint, text_analysis_key - ): + async def test_single_label_classify_async(self, text_analysis_endpoint, text_analysis_key): async with self.create_client(text_analysis_endpoint, text_analysis_key) as client: project_name = "single-class-project" deployment_name = "deployment1" diff --git a/sdk/cognitivelanguage/azure-ai-textanalytics/tsp-location.yaml b/sdk/cognitivelanguage/azure-ai-textanalytics/tsp-location.yaml index 57f76ef2f135..dd34775c6a12 100644 --- a/sdk/cognitivelanguage/azure-ai-textanalytics/tsp-location.yaml +++ b/sdk/cognitivelanguage/azure-ai-textanalytics/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/cognitiveservices/data-plane/LanguageAnalyzeText -commit: 8986f6564d8771fa1628a342a705991fe50ddcb4 +commit: 04869e1f580276ee3e7e51b74dd7e23df50902b8 repo: Azure/azure-rest-api-specs additionalDirectories: