diff --git a/sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md b/sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md index 91e0015cbed6..acf0b9bc2fdb 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md +++ b/sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md @@ -11,6 +11,7 @@ **New Features** - Added enums `EntityConditionality`, `EntityCertainty`, and `EntityAssociation`. - Added `AnalyzeSentimentAction` as a supported action type for `begin_analyze_batch_actions`. +- Added kwarg `disable_service_logs`. If set to true, you opt-out of having your text input logged on the service side for troubleshooting. ## 5.1.0b6 (2021-03-09) @@ -114,7 +115,7 @@ used in conjunction with the Bing Entity Search API to fetch additional relevant - Removed `grapheme_offset` and `grapheme_length` from `CategorizedEntity`, `SentenceSentiment`, and `LinkedEntityMatch` - `TextDocumentStatistics` attribute `grapheme_count` has been renamed to `character_count` -## 1.0.0b5 +## 1.0.0b5 - This was a broken release diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_models.py b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_models.py index dca3c7fb434c..b0b9af28efff 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_models.py +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_models.py @@ -1438,26 +1438,44 @@ class RecognizeEntitiesAction(DictMixin): `UnicodeCodePoint`, the Python encoding, is the default. To override the Python default, you can also pass in `Utf16CodePoint` or TextElement_v8`. For additional information see https://aka.ms/text-analytics-offsets + :keyword bool disable_service_logs: If set to true, you opt-out of having your text input + logged on the service side for troubleshooting. By default, Text Analytics logs your + input text for 48 hours, solely to allow for troubleshooting issues in providing you with + the Text Analytics natural language processing functions. Setting this parameter to true, + disables input logging and may limit our ability to remediate issues that occur. Please see + Cognitive Services Compliance and Privacy notes at https://aka.ms/cs-compliance for + additional details, and Microsoft Responsible AI principles at + https://www.microsoft.com/ai/responsible-ai. :ivar str model_version: The model version to use for the analysis. :ivar str string_index_type: Specifies the method used to interpret string offsets. `UnicodeCodePoint`, the Python encoding, is the default. To override the Python default, you can also pass in `Utf16CodePoint` or TextElement_v8`. For additional information see https://aka.ms/text-analytics-offsets + :ivar bool disable_service_logs: If set to true, you opt-out of having your text input + logged on the service side for troubleshooting. By default, Text Analytics logs your + input text for 48 hours, solely to allow for troubleshooting issues in providing you with + the Text Analytics natural language processing functions. Setting this parameter to true, + disables input logging and may limit our ability to remediate issues that occur. Please see + Cognitive Services Compliance and Privacy notes at https://aka.ms/cs-compliance for + additional details, and Microsoft Responsible AI principles at + https://www.microsoft.com/ai/responsible-ai. """ def __init__(self, **kwargs): self.model_version = kwargs.get("model_version", "latest") self.string_index_type = kwargs.get("string_index_type", "UnicodeCodePoint") + self.disable_service_logs = kwargs.get("disable_service_logs", False) def __repr__(self, **kwargs): - return "RecognizeEntitiesAction(model_version={}, string_index_type={})" \ - .format(self.model_version, self.string_index_type)[:1024] + return "RecognizeEntitiesAction(model_version={}, string_index_type={}, disable_service_logs={})" \ + .format(self.model_version, self.string_index_type, self.disable_service_logs)[:1024] def to_generated(self): return _latest_preview_models.EntitiesTask( parameters=_latest_preview_models.EntitiesTaskParameters( model_version=self.model_version, - string_index_type=self.string_index_type + string_index_type=self.string_index_type, + logging_opt_out=self.disable_service_logs, ) ) @@ -1480,6 +1498,14 @@ class AnalyzeSentimentAction(DictMixin): `UnicodeCodePoint`, the Python encoding, is the default. To override the Python default, you can also pass in `Utf16CodePoint` or TextElement_v8`. For additional information see https://aka.ms/text-analytics-offsets + :keyword bool disable_service_logs: If set to true, you opt-out of having your text input + logged on the service side for troubleshooting. By default, Text Analytics logs your + input text for 48 hours, solely to allow for troubleshooting issues in providing you with + the Text Analytics natural language processing functions. Setting this parameter to true, + disables input logging and may limit our ability to remediate issues that occur. Please see + Cognitive Services Compliance and Privacy notes at https://aka.ms/cs-compliance for + additional details, and Microsoft Responsible AI principles at + https://www.microsoft.com/ai/responsible-ai. :ivar str model_version: The model version to use for the analysis. :ivar bool show_opinion_mining: Whether to mine the opinions of a sentence and conduct more granular analysis around the aspects of a product or service (also known as @@ -1490,18 +1516,29 @@ class AnalyzeSentimentAction(DictMixin): `UnicodeCodePoint`, the Python encoding, is the default. To override the Python default, you can also pass in `Utf16CodePoint` or TextElement_v8`. For additional information see https://aka.ms/text-analytics-offsets + :ivar bool disable_service_logs: If set to true, you opt-out of having your text input + logged on the service side for troubleshooting. By default, Text Analytics logs your + input text for 48 hours, solely to allow for troubleshooting issues in providing you with + the Text Analytics natural language processing functions. Setting this parameter to true, + disables input logging and may limit our ability to remediate issues that occur. Please see + Cognitive Services Compliance and Privacy notes at https://aka.ms/cs-compliance for + additional details, and Microsoft Responsible AI principles at + https://www.microsoft.com/ai/responsible-ai. """ def __init__(self, **kwargs): self.model_version = kwargs.get('model_version', "latest") self.show_opinion_mining = kwargs.get('show_opinion_mining', False) self.string_index_type = kwargs.get('string_index_type', None) + self.disable_service_logs = kwargs.get("disable_service_logs", False) def __repr__(self, **kwargs): - return "AnalyzeSentimentAction(model_version={}, show_opinion_mining={}, string_index_type={}".format( + return "AnalyzeSentimentAction(model_version={}, show_opinion_mining={}, string_index_type={}, "\ + "disable_service_logs={}".format( self.model_version, self.show_opinion_mining, - self.string_index_type + self.string_index_type, + self.disable_service_logs, )[:1024] def to_generated(self): @@ -1509,7 +1546,8 @@ def to_generated(self): parameters=_latest_preview_models.SentimentAnalysisTaskParameters( model_version=self.model_version, opinion_mining=self.show_opinion_mining, - string_index_type=self.string_index_type + string_index_type=self.string_index_type, + logging_opt_out=self.disable_service_logs, ) ) @@ -1529,6 +1567,14 @@ class RecognizePiiEntitiesAction(DictMixin): `UnicodeCodePoint`, the Python encoding, is the default. To override the Python default, you can also pass in `Utf16CodePoint` or TextElement_v8`. For additional information see https://aka.ms/text-analytics-offsets + :keyword bool disable_service_logs: If set to true, you opt-out of having your text input + logged on the service side for troubleshooting. By default, Text Analytics logs your + input text for 48 hours, solely to allow for troubleshooting issues in providing you with + the Text Analytics natural language processing functions. Setting this parameter to true, + disables input logging and may limit our ability to remediate issues that occur. Please see + Cognitive Services Compliance and Privacy notes at https://aka.ms/cs-compliance for + additional details, and Microsoft Responsible AI principles at + https://www.microsoft.com/ai/responsible-ai. :ivar str model_version: The model version to use for the analysis. :ivar str domain_filter: An optional string to set the PII domain to include only a subset of the PII entity categories. Possible values include 'phi' or None. @@ -1536,18 +1582,29 @@ class RecognizePiiEntitiesAction(DictMixin): `UnicodeCodePoint`, the Python encoding, is the default. To override the Python default, you can also pass in `Utf16CodePoint` or TextElement_v8`. For additional information see https://aka.ms/text-analytics-offsets + :ivar bool disable_service_logs: If set to true, you opt-out of having your text input + logged on the service side for troubleshooting. By default, Text Analytics logs your + input text for 48 hours, solely to allow for troubleshooting issues in providing you with + the Text Analytics natural language processing functions. Setting this parameter to true, + disables input logging and may limit our ability to remediate issues that occur. Please see + Cognitive Services Compliance and Privacy notes at https://aka.ms/cs-compliance for + additional details, and Microsoft Responsible AI principles at + https://www.microsoft.com/ai/responsible-ai. """ def __init__(self, **kwargs): self.model_version = kwargs.get("model_version", "latest") self.domain_filter = kwargs.get("domain_filter", None) self.string_index_type = kwargs.get("string_index_type", "UnicodeCodePoint") + self.disable_service_logs = kwargs.get("disable_service_logs", False) def __repr__(self, **kwargs): - return "RecognizePiiEntitiesAction(model_version={}, domain_filter={}, string_index_type={}".format( + return "RecognizePiiEntitiesAction(model_version={}, domain_filter={}, string_index_type={}, "\ + "disable_service_logs={}".format( self.model_version, self.domain_filter, - self.string_index_type + self.string_index_type, + self.disable_service_logs, )[:1024] def to_generated(self): @@ -1555,7 +1612,8 @@ def to_generated(self): parameters=_latest_preview_models.PiiTaskParameters( model_version=self.model_version, domain=self.domain_filter, - string_index_type=self.string_index_type + string_index_type=self.string_index_type, + logging_opt_out=self.disable_service_logs ) ) @@ -1569,26 +1627,44 @@ class ExtractKeyPhrasesAction(DictMixin): of interfacing with this model. :keyword str model_version: The model version to use for the analysis. + :keyword bool disable_service_logs: If set to true, you opt-out of having your text input + logged on the service side for troubleshooting. By default, Text Analytics logs your + input text for 48 hours, solely to allow for troubleshooting issues in providing you with + the Text Analytics natural language processing functions. Setting this parameter to true, + disables input logging and may limit our ability to remediate issues that occur. Please see + Cognitive Services Compliance and Privacy notes at https://aka.ms/cs-compliance for + additional details, and Microsoft Responsible AI principles at + https://www.microsoft.com/ai/responsible-ai. :ivar str model_version: The model version to use for the analysis. + :ivar bool disable_service_logs: If set to true, you opt-out of having your text input + logged on the service side for troubleshooting. By default, Text Analytics logs your + input text for 48 hours, solely to allow for troubleshooting issues in providing you with + the Text Analytics natural language processing functions. Setting this parameter to true, + disables input logging and may limit our ability to remediate issues that occur. Please see + Cognitive Services Compliance and Privacy notes at https://aka.ms/cs-compliance for + additional details, and Microsoft Responsible AI principles at + https://www.microsoft.com/ai/responsible-ai. """ def __init__(self, **kwargs): self.model_version = kwargs.get("model_version", "latest") + self.disable_service_logs = kwargs.get("disable_service_logs", False) def __repr__(self, **kwargs): - return "ExtractKeyPhrasesAction(model_version={})" \ - .format(self.model_version)[:1024] + return "ExtractKeyPhrasesAction(model_version={}, disable_service_logs={})" \ + .format(self.model_version, self.disable_service_logs)[:1024] def to_generated(self): return _latest_preview_models.KeyPhrasesTask( parameters=_latest_preview_models.KeyPhrasesTaskParameters( - model_version=self.model_version + model_version=self.model_version, + logging_opt_out=self.disable_service_logs, ) ) class RecognizeLinkedEntitiesAction(DictMixin): - """RecognizeEntitiesAction encapsulates the parameters for starting a long-running Linked Entities + """RecognizeLinkedEntitiesAction encapsulates the parameters for starting a long-running Linked Entities Recognition operation. If you just want to recognize linked entities in a list of documents, and not perform multiple @@ -1600,26 +1676,46 @@ class RecognizeLinkedEntitiesAction(DictMixin): `UnicodeCodePoint`, the Python encoding, is the default. To override the Python default, you can also pass in `Utf16CodePoint` or TextElement_v8`. For additional information see https://aka.ms/text-analytics-offsets + :keyword bool disable_service_logs: If set to true, you opt-out of having your text input + logged on the service side for troubleshooting. By default, Text Analytics logs your + input text for 48 hours, solely to allow for troubleshooting issues in providing you with + the Text Analytics natural language processing functions. Setting this parameter to true, + disables input logging and may limit our ability to remediate issues that occur. Please see + Cognitive Services Compliance and Privacy notes at https://aka.ms/cs-compliance for + additional details, and Microsoft Responsible AI principles at + https://www.microsoft.com/ai/responsible-ai. :ivar str model_version: The model version to use for the analysis. :ivar str string_index_type: Specifies the method used to interpret string offsets. `UnicodeCodePoint`, the Python encoding, is the default. To override the Python default, you can also pass in `Utf16CodePoint` or TextElement_v8`. For additional information see https://aka.ms/text-analytics-offsets + :ivar bool disable_service_logs: If set to true, you opt-out of having your text input + logged on the service side for troubleshooting. By default, Text Analytics logs your + input text for 48 hours, solely to allow for troubleshooting issues in providing you with + the Text Analytics natural language processing functions. Setting this parameter to true, + disables input logging and may limit our ability to remediate issues that occur. Please see + Cognitive Services Compliance and Privacy notes at https://aka.ms/cs-compliance for + additional details, and Microsoft Responsible AI principles at + https://www.microsoft.com/ai/responsible-ai. """ def __init__(self, **kwargs): self.model_version = kwargs.get("model_version", "latest") self.string_index_type = kwargs.get("string_index_type", "UnicodeCodePoint") + self.disable_service_logs = kwargs.get("disable_service_logs", False) def __repr__(self, **kwargs): - return "RecognizeLinkedEntitiesAction(model_version={}, string_index_type={})" \ - .format(self.model_version, self.string_index_type)[:1024] + return "RecognizeLinkedEntitiesAction(model_version={}, string_index_type={}), " \ + "disable_service_logs={}".format( + self.model_version, self.string_index_type, self.disable_service_logs + )[:1024] def to_generated(self): return _latest_preview_models.EntityLinkingTask( parameters=_latest_preview_models.EntityLinkingTaskParameters( model_version=self.model_version, - string_index_type=self.string_index_type + string_index_type=self.string_index_type, + logging_opt_out=self.disable_service_logs, ) ) diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_text_analytics_client.py b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_text_analytics_client.py index 5479207f2f77..c8737a4501fc 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_text_analytics_client.py +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_text_analytics_client.py @@ -3,7 +3,7 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ - +import copy from typing import ( # pylint: disable=unused-import Union, Optional, @@ -157,6 +157,14 @@ def detect_language( # type: ignore See here for more info: https://aka.ms/text-analytics-model-versioning :keyword bool show_stats: If set to true, response will contain document level statistics in the `statistics` field of the document-level response. + :keyword bool disable_service_logs: If set to true, you opt-out of having your text input + logged on the service side for troubleshooting. By default, Text Analytics logs your + input text for 48 hours, solely to allow for troubleshooting issues in providing you with + the Text Analytics natural language processing functions. Setting this parameter to true, + disables input logging and may limit our ability to remediate issues that occur. Please see + Cognitive Services Compliance and Privacy notes at https://aka.ms/cs-compliance for + additional details, and Microsoft Responsible AI principles at + https://www.microsoft.com/ai/responsible-ai. :return: The combined list of :class:`~azure.ai.textanalytics.DetectLanguageResult` and :class:`~azure.ai.textanalytics.DocumentError` in the order the original documents were passed in. @@ -178,6 +186,9 @@ def detect_language( # type: ignore docs = _validate_input(documents, "country_hint", country_hint) model_version = kwargs.pop("model_version", None) show_stats = kwargs.pop("show_stats", False) + disable_service_logs = kwargs.pop("disable_service_logs", None) + if disable_service_logs is not None: + kwargs['logging_opt_out'] = disable_service_logs try: return self._client.languages( documents=docs, @@ -228,6 +239,14 @@ def recognize_entities( # type: ignore `UnicodeCodePoint`, the Python encoding, is the default. To override the Python default, you can also pass in `Utf16CodePoint` or TextElement_v8`. For additional information see https://aka.ms/text-analytics-offsets + :keyword bool disable_service_logs: If set to true, you opt-out of having your text input + logged on the service side for troubleshooting. By default, Text Analytics logs your + input text for 48 hours, solely to allow for troubleshooting issues in providing you with + the Text Analytics natural language processing functions. Setting this parameter to true, + disables input logging and may limit our ability to remediate issues that occur. Please see + Cognitive Services Compliance and Privacy notes at https://aka.ms/cs-compliance for + additional details, and Microsoft Responsible AI principles at + https://www.microsoft.com/ai/responsible-ai. :return: The combined list of :class:`~azure.ai.textanalytics.RecognizeEntitiesResult` and :class:`~azure.ai.textanalytics.DocumentError` in the order the original documents were passed in. @@ -256,6 +275,9 @@ def recognize_entities( # type: ignore ) if string_index_type: kwargs.update({"string_index_type": string_index_type}) + disable_service_logs = kwargs.pop("disable_service_logs", None) + if disable_service_logs is not None: + kwargs['logging_opt_out'] = disable_service_logs try: return self._client.entities_recognition_general( @@ -316,6 +338,14 @@ def recognize_pii_entities( # type: ignore `UnicodeCodePoint`, the Python encoding, is the default. To override the Python default, you can also pass in `Utf16CodePoint` or `TextElement_v8`. For additional information see https://aka.ms/text-analytics-offsets + :keyword bool disable_service_logs: If set to true, you opt-out of having your text input + logged on the service side for troubleshooting. By default, Text Analytics logs your + input text for 48 hours, solely to allow for troubleshooting issues in providing you with + the Text Analytics natural language processing functions. Setting this parameter to true, + disables input logging and may limit our ability to remediate issues that occur. Please see + Cognitive Services Compliance and Privacy notes at https://aka.ms/cs-compliance for + additional details, and Microsoft Responsible AI principles at + https://www.microsoft.com/ai/responsible-ai. :return: The combined list of :class:`~azure.ai.textanalytics.RecognizePiiEntitiesResult` and :class:`~azure.ai.textanalytics.DocumentError` in the order the original documents were passed in. @@ -347,6 +377,9 @@ def recognize_pii_entities( # type: ignore ) if string_index_type: kwargs.update({"string_index_type": string_index_type}) + disable_service_logs = kwargs.pop("disable_service_logs", None) + if disable_service_logs is not None: + kwargs['logging_opt_out'] = disable_service_logs try: return self._client.entities_recognition_pii( @@ -407,6 +440,14 @@ def recognize_linked_entities( # type: ignore `UnicodeCodePoint`, the Python encoding, is the default. To override the Python default, you can also pass in `Utf16CodePoint` or `TextElement_v8`. For additional information see https://aka.ms/text-analytics-offsets + :keyword bool disable_service_logs: If set to true, you opt-out of having your text input + logged on the service side for troubleshooting. By default, Text Analytics logs your + input text for 48 hours, solely to allow for troubleshooting issues in providing you with + the Text Analytics natural language processing functions. Setting this parameter to true, + disables input logging and may limit our ability to remediate issues that occur. Please see + Cognitive Services Compliance and Privacy notes at https://aka.ms/cs-compliance for + additional details, and Microsoft Responsible AI principles at + https://www.microsoft.com/ai/responsible-ai. :return: The combined list of :class:`~azure.ai.textanalytics.RecognizeLinkedEntitiesResult` and :class:`~azure.ai.textanalytics.DocumentError` in the order the original documents were passed in. @@ -428,6 +469,9 @@ def recognize_linked_entities( # type: ignore docs = _validate_input(documents, "language", language) model_version = kwargs.pop("model_version", None) show_stats = kwargs.pop("show_stats", False) + disable_service_logs = kwargs.pop("disable_service_logs", None) + if disable_service_logs is not None: + kwargs['logging_opt_out'] = disable_service_logs string_index_type = _check_string_index_type_arg( kwargs.pop("string_index_type", None), @@ -503,6 +547,14 @@ def begin_analyze_healthcare_entities( # type: ignore :keyword int polling_interval: Waiting time between two polls for LRO operations if no Retry-After header is present. Defaults to 5 seconds. :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword bool disable_service_logs: If set to true, you opt-out of having your text input + logged on the service side for troubleshooting. By default, Text Analytics logs your + input text for 48 hours, solely to allow for troubleshooting issues in providing you with + the Text Analytics natural language processing functions. Setting this parameter to true, + disables input logging and may limit our ability to remediate issues that occur. Please see + Cognitive Services Compliance and Privacy notes at https://aka.ms/cs-compliance for + additional details, and Microsoft Responsible AI principles at + https://www.microsoft.com/ai/responsible-ai. :return: An instance of an AnalyzeHealthcareEntitiesLROPoller. Call `result()` on the this object to return a pageable of :class:`~azure.ai.textanalytics.AnalyzeHealthcareEntitiesResultItem`. :rtype: @@ -529,22 +581,30 @@ def begin_analyze_healthcare_entities( # type: ignore string_index_type = kwargs.pop("string_index_type", self._string_index_type_default) doc_id_order = [doc.get("id") for doc in docs] + my_cls = kwargs.pop( + "cls", partial(self._healthcare_result_callback, doc_id_order, show_stats=show_stats) + ) + disable_service_logs = kwargs.pop("disable_service_logs", None) + polling_kwargs = kwargs + operation_kwargs = copy.copy(kwargs) + if disable_service_logs is not None: + operation_kwargs['logging_opt_out'] = disable_service_logs try: return self._client.begin_health( docs, model_version=model_version, string_index_type=string_index_type, - cls=kwargs.pop("cls", partial(self._healthcare_result_callback, doc_id_order, show_stats=show_stats)), + cls=my_cls, polling=AnalyzeHealthcareEntitiesLROPollingMethod( text_analytics_client=self._client, timeout=polling_interval, lro_algorithms=[ TextAnalyticsOperationResourcePolling(show_stats=show_stats) ], - **kwargs), + **polling_kwargs), continuation_token=continuation_token, - **kwargs + **operation_kwargs ) except ValueError as error: @@ -595,6 +655,14 @@ def extract_key_phrases( # type: ignore See here for more info: https://aka.ms/text-analytics-model-versioning :keyword bool show_stats: If set to true, response will contain document level statistics in the `statistics` field of the document-level response. + :keyword bool disable_service_logs: If set to true, you opt-out of having your text input + logged on the service side for troubleshooting. By default, Text Analytics logs your + input text for 48 hours, solely to allow for troubleshooting issues in providing you with + the Text Analytics natural language processing functions. Setting this parameter to true, + disables input logging and may limit our ability to remediate issues that occur. Please see + Cognitive Services Compliance and Privacy notes at https://aka.ms/cs-compliance for + additional details, and Microsoft Responsible AI principles at + https://www.microsoft.com/ai/responsible-ai. :return: The combined list of :class:`~azure.ai.textanalytics.ExtractKeyPhrasesResult` and :class:`~azure.ai.textanalytics.DocumentError` in the order the original documents were passed in. @@ -616,6 +684,10 @@ def extract_key_phrases( # type: ignore docs = _validate_input(documents, "language", language) model_version = kwargs.pop("model_version", None) show_stats = kwargs.pop("show_stats", False) + disable_service_logs = kwargs.pop("disable_service_logs", None) + if disable_service_logs is not None: + kwargs['logging_opt_out'] = disable_service_logs + try: return self._client.key_phrases( documents=docs, @@ -672,6 +744,14 @@ def analyze_sentiment( # type: ignore `UnicodeCodePoint`, the Python encoding, is the default. To override the Python default, you can also pass in `Utf16CodePoint` or `TextElement_v8`. For additional information see https://aka.ms/text-analytics-offsets + :keyword bool disable_service_logs: If set to true, you opt-out of having your text input + logged on the service side for troubleshooting. By default, Text Analytics logs your + input text for 48 hours, solely to allow for troubleshooting issues in providing you with + the Text Analytics natural language processing functions. Setting this parameter to true, + disables input logging and may limit our ability to remediate issues that occur. Please see + Cognitive Services Compliance and Privacy notes at https://aka.ms/cs-compliance for + additional details, and Microsoft Responsible AI principles at + https://www.microsoft.com/ai/responsible-ai. .. versionadded:: v3.1-preview The *show_opinion_mining* parameter. The *string_index_type* parameter. @@ -697,6 +777,9 @@ def analyze_sentiment( # type: ignore model_version = kwargs.pop("model_version", None) show_stats = kwargs.pop("show_stats", False) show_opinion_mining = kwargs.pop("show_opinion_mining", None) + disable_service_logs = kwargs.pop("disable_service_logs", None) + if disable_service_logs is not None: + kwargs['logging_opt_out'] = disable_service_logs string_index_type = _check_string_index_type_arg( kwargs.pop("string_index_type", None), diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/aio/_text_analytics_client_async.py b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/aio/_text_analytics_client_async.py index 10953341bb4b..c64a395f7494 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/aio/_text_analytics_client_async.py +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/aio/_text_analytics_client_async.py @@ -3,7 +3,7 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ - +import copy from typing import ( # pylint: disable=unused-import Union, Optional, @@ -153,6 +153,14 @@ async def detect_language( # type: ignore See here for more info: https://aka.ms/text-analytics-model-versioning :keyword bool show_stats: If set to true, response will contain document level statistics in the `statistics` field of the document-level response. + :keyword bool disable_service_logs: If set to true, you opt-out of having your text input + logged on the service side for troubleshooting. By default, Text Analytics logs your + input text for 48 hours, solely to allow for troubleshooting issues in providing you with + the Text Analytics natural language processing functions. Setting this parameter to true, + disables input logging and may limit our ability to remediate issues that occur. Please see + Cognitive Services Compliance and Privacy notes at https://aka.ms/cs-compliance for + additional details, and Microsoft Responsible AI principles at + https://www.microsoft.com/ai/responsible-ai. :return: The combined list of :class:`~azure.ai.textanalytics.DetectLanguageResult` and :class:`~azure.ai.textanalytics.DocumentError` in the order the original documents were passed in. @@ -174,6 +182,9 @@ async def detect_language( # type: ignore docs = _validate_input(documents, "country_hint", country_hint) model_version = kwargs.pop("model_version", None) show_stats = kwargs.pop("show_stats", False) + disable_service_logs = kwargs.pop("disable_service_logs", None) + if disable_service_logs is not None: + kwargs['logging_opt_out'] = disable_service_logs try: return await self._client.languages( documents=docs, @@ -222,6 +233,14 @@ async def recognize_entities( # type: ignore :keyword str string_index_type: Specifies the method used to interpret string offsets. Can be one of 'UnicodeCodePoint' (default), 'Utf16CodePoint', or 'TextElement_v8'. For additional information see https://aka.ms/text-analytics-offsets + :keyword bool disable_service_logs: If set to true, you opt-out of having your text input + logged on the service side for troubleshooting. By default, Text Analytics logs your + input text for 48 hours, solely to allow for troubleshooting issues in providing you with + the Text Analytics natural language processing functions. Setting this parameter to true, + disables input logging and may limit our ability to remediate issues that occur. Please see + Cognitive Services Compliance and Privacy notes at https://aka.ms/cs-compliance for + additional details, and Microsoft Responsible AI principles at + https://www.microsoft.com/ai/responsible-ai. :return: The combined list of :class:`~azure.ai.textanalytics.RecognizeEntitiesResult` and :class:`~azure.ai.textanalytics.DocumentError` in the order the original documents were passed in. @@ -243,6 +262,9 @@ async def recognize_entities( # type: ignore docs = _validate_input(documents, "language", language) model_version = kwargs.pop("model_version", None) show_stats = kwargs.pop("show_stats", False) + disable_service_logs = kwargs.pop("disable_service_logs", None) + if disable_service_logs is not None: + kwargs['logging_opt_out'] = disable_service_logs string_index_type = _check_string_index_type_arg( kwargs.pop("string_index_type", None), @@ -309,6 +331,14 @@ async def recognize_pii_entities( # type: ignore :keyword str string_index_type: Specifies the method used to interpret string offsets. Can be one of 'UnicodeCodePoint' (default), 'Utf16CodePoint', or 'TextElement_v8'. For additional information see https://aka.ms/text-analytics-offsets + :keyword bool disable_service_logs: If set to true, you opt-out of having your text input + logged on the service side for troubleshooting. By default, Text Analytics logs your + input text for 48 hours, solely to allow for troubleshooting issues in providing you with + the Text Analytics natural language processing functions. Setting this parameter to true, + disables input logging and may limit our ability to remediate issues that occur. Please see + Cognitive Services Compliance and Privacy notes at https://aka.ms/cs-compliance for + additional details, and Microsoft Responsible AI principles at + https://www.microsoft.com/ai/responsible-ai. :return: The combined list of :class:`~azure.ai.textanalytics.RecognizePiiEntitiesResult` and :class:`~azure.ai.textanalytics.DocumentError` in the order the original documents were passed in. @@ -340,6 +370,9 @@ async def recognize_pii_entities( # type: ignore ) if string_index_type: kwargs.update({"string_index_type": string_index_type}) + disable_service_logs = kwargs.pop("disable_service_logs", None) + if disable_service_logs is not None: + kwargs['logging_opt_out'] = disable_service_logs try: return await self._client.entities_recognition_pii( @@ -398,6 +431,14 @@ async def recognize_linked_entities( # type: ignore :keyword str string_index_type: Specifies the method used to interpret string offsets. Can be one of 'UnicodeCodePoint' (default), 'Utf16CodePoint', or 'TextElement_v8'. For additional information see https://aka.ms/text-analytics-offsets + :keyword bool disable_service_logs: If set to true, you opt-out of having your text input + logged on the service side for troubleshooting. By default, Text Analytics logs your + input text for 48 hours, solely to allow for troubleshooting issues in providing you with + the Text Analytics natural language processing functions. Setting this parameter to true, + disables input logging and may limit our ability to remediate issues that occur. Please see + Cognitive Services Compliance and Privacy notes at https://aka.ms/cs-compliance for + additional details, and Microsoft Responsible AI principles at + https://www.microsoft.com/ai/responsible-ai. :return: The combined list of :class:`~azure.ai.textanalytics.RecognizeLinkedEntitiesResult` and :class:`~azure.ai.textanalytics.DocumentError` in the order the original documents were passed in. @@ -419,6 +460,9 @@ async def recognize_linked_entities( # type: ignore docs = _validate_input(documents, "language", language) model_version = kwargs.pop("model_version", None) show_stats = kwargs.pop("show_stats", False) + disable_service_logs = kwargs.pop("disable_service_logs", None) + if disable_service_logs is not None: + kwargs['logging_opt_out'] = disable_service_logs string_index_type = _check_string_index_type_arg( kwargs.pop("string_index_type", None), @@ -474,6 +518,14 @@ async def extract_key_phrases( # type: ignore See here for more info: https://aka.ms/text-analytics-model-versioning :keyword bool show_stats: If set to true, response will contain document level statistics in the `statistics` field of the document-level response. + :keyword bool disable_service_logs: If set to true, you opt-out of having your text input + logged on the service side for troubleshooting. By default, Text Analytics logs your + input text for 48 hours, solely to allow for troubleshooting issues in providing you with + the Text Analytics natural language processing functions. Setting this parameter to true, + disables input logging and may limit our ability to remediate issues that occur. Please see + Cognitive Services Compliance and Privacy notes at https://aka.ms/cs-compliance for + additional details, and Microsoft Responsible AI principles at + https://www.microsoft.com/ai/responsible-ai. :return: The combined list of :class:`~azure.ai.textanalytics.ExtractKeyPhrasesResult` and :class:`~azure.ai.textanalytics.DocumentError` in the order the original documents were passed in. @@ -495,6 +547,9 @@ async def extract_key_phrases( # type: ignore docs = _validate_input(documents, "language", language) model_version = kwargs.pop("model_version", None) show_stats = kwargs.pop("show_stats", False) + disable_service_logs = kwargs.pop("disable_service_logs", None) + if disable_service_logs is not None: + kwargs['logging_opt_out'] = disable_service_logs try: return await self._client.key_phrases( documents=docs, @@ -549,6 +604,14 @@ async def analyze_sentiment( # type: ignore :keyword str string_index_type: Specifies the method used to interpret string offsets. Can be one of 'UnicodeCodePoint' (default), 'Utf16CodePoint', or 'TextElement_v8'. For additional information see https://aka.ms/text-analytics-offsets + :keyword bool disable_service_logs: If set to true, you opt-out of having your text input + logged on the service side for troubleshooting. By default, Text Analytics logs your + input text for 48 hours, solely to allow for troubleshooting issues in providing you with + the Text Analytics natural language processing functions. Setting this parameter to true, + disables input logging and may limit our ability to remediate issues that occur. Please see + Cognitive Services Compliance and Privacy notes at https://aka.ms/cs-compliance for + additional details, and Microsoft Responsible AI principles at + https://www.microsoft.com/ai/responsible-ai. .. versionadded:: v3.1-preview The *show_opinion_mining* parameter. :return: The combined list of :class:`~azure.ai.textanalytics.AnalyzeSentimentResult` and @@ -573,6 +636,9 @@ async def analyze_sentiment( # type: ignore model_version = kwargs.pop("model_version", None) show_stats = kwargs.pop("show_stats", False) show_opinion_mining = kwargs.pop("show_opinion_mining", None) + disable_service_logs = kwargs.pop("disable_service_logs", None) + if disable_service_logs is not None: + kwargs['logging_opt_out'] = disable_service_logs string_index_type = _check_string_index_type_arg( kwargs.pop("string_index_type", None), @@ -656,6 +722,14 @@ async def begin_analyze_healthcare_entities( # type: ignore :keyword int polling_interval: Waiting time between two polls for LRO operations if no Retry-After header is present. Defaults to 5 seconds. :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword bool disable_service_logs: If set to true, you opt-out of having your text input + logged on the service side for troubleshooting. By default, Text Analytics logs your + input text for 48 hours, solely to allow for troubleshooting issues in providing you with + the Text Analytics natural language processing functions. Setting this parameter to true, + disables input logging and may limit our ability to remediate issues that occur. Please see + Cognitive Services Compliance and Privacy notes at https://aka.ms/cs-compliance for + additional details, and Microsoft Responsible AI principles at + https://www.microsoft.com/ai/responsible-ai. :return: An instance of an AnalyzeHealthcareEntitiesAsyncLROPoller. Call `result()` on the poller object to return a pageable of :class:`~azure.ai.textanalytics.AnalyzeHealthcareResultItem`. :rtype: @@ -680,24 +754,31 @@ async def begin_analyze_healthcare_entities( # type: ignore polling_interval = kwargs.pop("polling_interval", 5) continuation_token = kwargs.pop("continuation_token", None) string_index_type = kwargs.pop("string_index_type", self._string_code_unit) - + disable_service_logs = kwargs.pop("disable_service_logs", None) doc_id_order = [doc.get("id") for doc in docs] + my_cls = kwargs.pop( + "cls", partial(self._healthcare_result_callback, doc_id_order, show_stats=show_stats) + ) + polling_kwargs = kwargs + operation_kwargs = copy.copy(kwargs) + if disable_service_logs is not None: + operation_kwargs['logging_opt_out'] = disable_service_logs try: return await self._client.begin_health( docs, model_version=model_version, string_index_type=string_index_type, - cls=kwargs.pop("cls", partial(self._healthcare_result_callback, doc_id_order, show_stats=show_stats)), + cls=my_cls, polling=AnalyzeHealthcareEntitiesAsyncLROPollingMethod( text_analytics_client=self._client, timeout=polling_interval, lro_algorithms=[ TextAnalyticsOperationResourcePolling(show_stats=show_stats) ], - **kwargs), + **polling_kwargs), continuation_token=continuation_token, - **kwargs + **operation_kwargs ) except ValueError as error: diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_analyze.test_disable_service_logs.yaml b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_analyze.test_disable_service_logs.yaml new file mode 100644 index 000000000000..10bda34eca77 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_analyze.test_disable_service_logs.yaml @@ -0,0 +1,84 @@ +interactions: +- request: + body: '{"tasks": {"entityRecognitionTasks": [{"parameters": {"model-version": + "latest", "loggingOptOut": true, "stringIndexType": "UnicodeCodePoint"}}], "entityRecognitionPiiTasks": + [{"parameters": {"model-version": "latest", "loggingOptOut": true, "stringIndexType": + "UnicodeCodePoint"}}], "keyPhraseExtractionTasks": [{"parameters": {"model-version": + "latest", "loggingOptOut": true}}], "entityLinkingTasks": [{"parameters": {"model-version": + "latest", "loggingOptOut": true, "stringIndexType": "UnicodeCodePoint"}}], "sentimentAnalysisTasks": + [{"parameters": {"model-version": "latest", "loggingOptOut": true, "opinionMining": + false}}]}, "analysisInput": {"documents": [{"id": "0", "text": "Test for logging + disable", "language": "en"}]}}' + headers: + Accept: + - application/json, text/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '734' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-textanalytics/5.1.0b7 Python/3.9.1 (macOS-10.16-x86_64-i386-64bit) + method: POST + uri: https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/analyze + response: + body: + string: '' + headers: + apim-request-id: + - be2db9b3-eb5c-4655-9874-c6ffc80bb365 + date: + - Thu, 13 May 2021 23:45:06 GMT + operation-location: + - https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/analyze/jobs/e6eef8c2-76b5-40df-a2ff-98afce0e0912 + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '7798' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-ai-textanalytics/5.1.0b7 Python/3.9.1 (macOS-10.16-x86_64-i386-64bit) + method: GET + uri: https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/analyze/jobs/e6eef8c2-76b5-40df-a2ff-98afce0e0912 + response: + body: + string: '{"jobId":"e6eef8c2-76b5-40df-a2ff-98afce0e0912","lastUpdateDateTime":"2021-05-13T23:45:08Z","createdDateTime":"2021-05-13T23:44:58Z","expirationDateTime":"2021-05-14T23:44:58Z","status":"running","errors":[],"displayName":"NA","tasks":{"details":{"name":"NA","lastUpdateDateTime":"2021-05-13T23:45:08Z"},"completed":1,"failed":0,"inProgress":4,"total":5,"entityLinkingTasks":[{"lastUpdateDateTime":"2021-05-13T23:45:07.5074977Z","name":"NA","state":"succeeded","results":{"documents":[{"id":"0","entities":[{"name":"Test + (assessment)","matches":[{"text":"Test","offset":0,"length":4,"confidenceScore":0.04}],"language":"en","id":"Test + (assessment)","url":"https://en.wikipedia.org/wiki/Test_(assessment)","dataSource":"Wikipedia"}],"warnings":[]}],"errors":[],"modelVersion":"2020-02-01"}}]}}' + headers: + apim-request-id: + - c03b8012-4fc9-464e-8cd1-211d3fe0bda4 + content-type: + - application/json; charset=utf-8 + date: + - Thu, 13 May 2021 23:45:11 GMT + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '33' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_analyze_async.test_disable_service_logs.yaml b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_analyze_async.test_disable_service_logs.yaml new file mode 100644 index 000000000000..10d4aacf7314 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_analyze_async.test_disable_service_logs.yaml @@ -0,0 +1,112 @@ +interactions: +- request: + body: '{"tasks": {"entityRecognitionTasks": [{"parameters": {"model-version": + "latest", "loggingOptOut": true, "stringIndexType": "UnicodeCodePoint"}}], "entityRecognitionPiiTasks": + [{"parameters": {"model-version": "latest", "loggingOptOut": true, "stringIndexType": + "UnicodeCodePoint"}}], "keyPhraseExtractionTasks": [{"parameters": {"model-version": + "latest", "loggingOptOut": true}}], "entityLinkingTasks": [{"parameters": {"model-version": + "latest", "loggingOptOut": true, "stringIndexType": "UnicodeCodePoint"}}], "sentimentAnalysisTasks": + [{"parameters": {"model-version": "latest", "loggingOptOut": true, "opinionMining": + false}}]}, "analysisInput": {"documents": [{"id": "0", "text": "Test for logging + disable", "language": "en"}]}}' + headers: + Accept: + - application/json, text/json + Content-Length: + - '734' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-textanalytics/5.1.0b7 Python/3.9.1 (macOS-10.16-x86_64-i386-64bit) + method: POST + uri: https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/analyze + response: + body: + string: '' + headers: + apim-request-id: 323657d2-890c-4f62-a2ef-dca4bdcbee41 + date: Thu, 13 May 2021 23:45:01 GMT + operation-location: https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/analyze/jobs/55569390-b460-41a9-ba6b-9042a7f1ede1 + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '2893' + status: + code: 202 + message: Accepted + url: https://centralus.api.cognitive.microsoft.com//text/analytics/v3.1-preview.5/analyze +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-textanalytics/5.1.0b7 Python/3.9.1 (macOS-10.16-x86_64-i386-64bit) + method: GET + uri: https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/analyze/jobs/55569390-b460-41a9-ba6b-9042a7f1ede1 + response: + body: + string: '{"jobId":"55569390-b460-41a9-ba6b-9042a7f1ede1","lastUpdateDateTime":"2021-05-13T23:45:07Z","createdDateTime":"2021-05-13T23:44:59Z","expirationDateTime":"2021-05-14T23:44:59Z","status":"running","errors":[],"displayName":"NA","tasks":{"details":{"name":"NA","lastUpdateDateTime":"2021-05-13T23:45:07Z"},"completed":1,"failed":0,"inProgress":4,"total":5,"entityLinkingTasks":[{"lastUpdateDateTime":"2021-05-13T23:45:03.3358832Z","name":"NA","state":"succeeded","results":{"documents":[{"id":"0","entities":[{"name":"Test + (assessment)","matches":[{"text":"Test","offset":0,"length":4,"confidenceScore":0.04}],"language":"en","id":"Test + (assessment)","url":"https://en.wikipedia.org/wiki/Test_(assessment)","dataSource":"Wikipedia"}],"warnings":[]}],"errors":[],"modelVersion":"2020-02-01"}}]}}' + headers: + apim-request-id: c127cfd4-14ab-45f0-a809-7f0dc242341c + content-type: application/json; charset=utf-8 + date: Thu, 13 May 2021 23:45:07 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '909' + status: + code: 200 + message: OK + url: https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/analyze/jobs/55569390-b460-41a9-ba6b-9042a7f1ede1 +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-textanalytics/5.1.0b7 Python/3.9.1 (macOS-10.16-x86_64-i386-64bit) + method: GET + uri: https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/analyze/jobs/55569390-b460-41a9-ba6b-9042a7f1ede1 + response: + body: + string: '{"jobId":"55569390-b460-41a9-ba6b-9042a7f1ede1","lastUpdateDateTime":"2021-05-13T23:45:07Z","createdDateTime":"2021-05-13T23:44:59Z","expirationDateTime":"2021-05-14T23:44:59Z","status":"running","errors":[],"displayName":"NA","tasks":{"details":{"name":"NA","lastUpdateDateTime":"2021-05-13T23:45:07Z"},"completed":1,"failed":0,"inProgress":4,"total":5,"entityLinkingTasks":[{"lastUpdateDateTime":"2021-05-13T23:45:03.3358832Z","name":"NA","state":"succeeded","results":{"documents":[{"id":"0","entities":[{"name":"Test + (assessment)","matches":[{"text":"Test","offset":0,"length":4,"confidenceScore":0.04}],"language":"en","id":"Test + (assessment)","url":"https://en.wikipedia.org/wiki/Test_(assessment)","dataSource":"Wikipedia"}],"warnings":[]}],"errors":[],"modelVersion":"2020-02-01"}}]}}' + headers: + apim-request-id: 541ff22c-befe-4627-b1a4-eb4455160410 + content-type: application/json; charset=utf-8 + date: Thu, 13 May 2021 23:45:25 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '12647' + status: + code: 200 + message: OK + url: https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/analyze/jobs/55569390-b460-41a9-ba6b-9042a7f1ede1 +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-textanalytics/5.1.0b7 Python/3.9.1 (macOS-10.16-x86_64-i386-64bit) + method: GET + uri: https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/analyze/jobs/55569390-b460-41a9-ba6b-9042a7f1ede1 + response: + body: + string: '{"jobId":"55569390-b460-41a9-ba6b-9042a7f1ede1","lastUpdateDateTime":"2021-05-13T23:45:30Z","createdDateTime":"2021-05-13T23:44:59Z","expirationDateTime":"2021-05-14T23:44:59Z","status":"succeeded","errors":[],"displayName":"NA","tasks":{"details":{"name":"NA","lastUpdateDateTime":"2021-05-13T23:45:30Z"},"completed":5,"failed":0,"inProgress":0,"total":5,"entityRecognitionTasks":[{"lastUpdateDateTime":"2021-05-13T23:45:30.8404617Z","name":"NA","state":"succeeded","results":{"documents":[{"id":"0","entities":[{"text":"logging","category":"Skill","offset":9,"length":7,"confidenceScore":0.8}],"warnings":[]}],"errors":[],"modelVersion":"2021-01-15"}}],"entityLinkingTasks":[{"lastUpdateDateTime":"2021-05-13T23:45:03.3358832Z","name":"NA","state":"succeeded","results":{"documents":[{"id":"0","entities":[{"name":"Test + (assessment)","matches":[{"text":"Test","offset":0,"length":4,"confidenceScore":0.04}],"language":"en","id":"Test + (assessment)","url":"https://en.wikipedia.org/wiki/Test_(assessment)","dataSource":"Wikipedia"}],"warnings":[]}],"errors":[],"modelVersion":"2020-02-01"}}],"entityRecognitionPiiTasks":[{"lastUpdateDateTime":"2021-05-13T23:45:23.5565427Z","name":"NA","state":"succeeded","results":{"documents":[{"redactedText":"Test + for logging disable","id":"0","entities":[],"warnings":[]}],"errors":[],"modelVersion":"2021-01-15"}}],"keyPhraseExtractionTasks":[{"lastUpdateDateTime":"2021-05-13T23:45:25.8666784Z","name":"NA","state":"succeeded","results":{"documents":[{"id":"0","keyPhrases":["Test","logging"],"warnings":[]}],"errors":[],"modelVersion":"2020-07-01"}}],"sentimentAnalysisTasks":[{"lastUpdateDateTime":"2021-05-13T23:45:28.5048381Z","name":"NA","state":"succeeded","results":{"documents":[{"id":"0","sentiment":"negative","confidenceScores":{"positive":0.02,"neutral":0.12,"negative":0.86},"sentences":[{"sentiment":"negative","confidenceScores":{"positive":0.02,"neutral":0.12,"negative":0.86},"offset":0,"length":24,"text":"Test + for logging disable"}],"warnings":[]}],"errors":[],"modelVersion":"2020-04-01"}}]}}' + headers: + apim-request-id: 1929d0fd-e2ed-4a1f-a98f-fa74d9aa74e5 + content-type: application/json; charset=utf-8 + date: Thu, 13 May 2021 23:45:30 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '207' + status: + code: 200 + message: OK + url: https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/analyze/jobs/55569390-b460-41a9-ba6b-9042a7f1ede1 +version: 1 diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_analyze_healthcare.test_disable_service_logs.yaml b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_analyze_healthcare.test_disable_service_logs.yaml new file mode 100644 index 000000000000..da9e8654b4b8 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_analyze_healthcare.test_disable_service_logs.yaml @@ -0,0 +1,75 @@ +interactions: +- request: + body: '{"documents": [{"id": "0", "text": "Test for logging disable", "language": + "en"}]}' + headers: + Accept: + - application/json, text/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '82' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-textanalytics/5.1.0b7 Python/3.9.1 (macOS-10.16-x86_64-i386-64bit) + method: POST + uri: https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/entities/health/jobs?stringIndexType=UnicodeCodePoint&loggingOptOut=true + response: + body: + string: '' + headers: + apim-request-id: + - c9aaa6dc-99b6-4a75-b8c4-3bc0f667be23 + date: + - Thu, 13 May 2021 23:45:02 GMT + operation-location: + - https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/entities/health/jobs/0efc93bf-471e-4509-9e56-37d90fb41fba + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '5183' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-ai-textanalytics/5.1.0b7 Python/3.9.1 (macOS-10.16-x86_64-i386-64bit) + method: GET + uri: https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/entities/health/jobs/0efc93bf-471e-4509-9e56-37d90fb41fba + response: + body: + string: '{"jobId":"0efc93bf-471e-4509-9e56-37d90fb41fba","lastUpdateDateTime":"2021-05-13T23:45:12Z","createdDateTime":"2021-05-13T23:44:58Z","expirationDateTime":"2021-05-14T23:44:58Z","status":"succeeded","errors":[],"results":{"documents":[{"id":"0","entities":[],"relations":[],"warnings":[]}],"errors":[],"modelVersion":"2021-03-01"}}' + headers: + apim-request-id: + - b4996314-b57a-4b33-be75-4e7d14ddb2a9 + content-type: + - application/json; charset=utf-8 + date: + - Thu, 13 May 2021 23:45:15 GMT + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '7770' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_analyze_healthcare_async.test_disable_service_logs.yaml b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_analyze_healthcare_async.test_disable_service_logs.yaml new file mode 100644 index 000000000000..d4887dc4c273 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_analyze_healthcare_async.test_disable_service_logs.yaml @@ -0,0 +1,75 @@ +interactions: +- request: + body: '{"documents": [{"id": "0", "text": "Test for logging disable", "language": + "en"}]}' + headers: + Accept: + - application/json, text/json + Content-Length: + - '82' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-textanalytics/5.1.0b7 Python/3.9.1 (macOS-10.16-x86_64-i386-64bit) + method: POST + uri: https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/entities/health/jobs?stringIndexType=UnicodeCodePoint&loggingOptOut=true + response: + body: + string: '' + headers: + apim-request-id: c3e5f97a-0a75-45aa-b3db-9023851ed0e0 + date: Thu, 13 May 2021 23:45:02 GMT + operation-location: https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/entities/health/jobs/7a3f4c4a-2c47-47b3-89aa-f452a357ad2b + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '5184' + status: + code: 202 + message: Accepted + url: https://centralus.api.cognitive.microsoft.com//text/analytics/v3.1-preview.5/entities/health/jobs?stringIndexType=UnicodeCodePoint&loggingOptOut=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-textanalytics/5.1.0b7 Python/3.9.1 (macOS-10.16-x86_64-i386-64bit) + method: GET + uri: https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/entities/health/jobs/7a3f4c4a-2c47-47b3-89aa-f452a357ad2b + response: + body: + string: '{"jobId":"7a3f4c4a-2c47-47b3-89aa-f452a357ad2b","lastUpdateDateTime":"2021-05-13T23:45:03Z","createdDateTime":"2021-05-13T23:44:58Z","expirationDateTime":"2021-05-14T23:44:58Z","status":"notStarted","errors":[]}' + headers: + apim-request-id: 1d0414af-f5c1-4731-9c63-38efd9238931 + content-type: application/json; charset=utf-8 + date: Thu, 13 May 2021 23:45:07 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '7' + status: + code: 200 + message: OK + url: https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/entities/health/jobs/7a3f4c4a-2c47-47b3-89aa-f452a357ad2b +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-textanalytics/5.1.0b7 Python/3.9.1 (macOS-10.16-x86_64-i386-64bit) + method: GET + uri: https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/entities/health/jobs/7a3f4c4a-2c47-47b3-89aa-f452a357ad2b + response: + body: + string: '{"jobId":"7a3f4c4a-2c47-47b3-89aa-f452a357ad2b","lastUpdateDateTime":"2021-05-13T23:45:12Z","createdDateTime":"2021-05-13T23:44:58Z","expirationDateTime":"2021-05-14T23:44:58Z","status":"succeeded","errors":[],"results":{"documents":[{"id":"0","entities":[],"relations":[],"warnings":[]}],"errors":[],"modelVersion":"2021-03-01"}}' + headers: + apim-request-id: 7955365c-bbd8-46f2-96e0-75a61df01250 + content-type: application/json; charset=utf-8 + date: Thu, 13 May 2021 23:45:18 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '5123' + status: + code: 200 + message: OK + url: https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/entities/health/jobs/7a3f4c4a-2c47-47b3-89aa-f452a357ad2b +version: 1 diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_analyze_sentiment.test_disable_service_logs.yaml b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_analyze_sentiment.test_disable_service_logs.yaml new file mode 100644 index 000000000000..25ff6d155f08 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_analyze_sentiment.test_disable_service_logs.yaml @@ -0,0 +1,44 @@ +interactions: +- request: + body: '{"documents": [{"id": "0", "text": "Test for logging disable", "language": + "en"}]}' + headers: + Accept: + - application/json, text/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '82' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-textanalytics/5.1.0b7 Python/3.9.1 (macOS-10.16-x86_64-i386-64bit) + method: POST + uri: https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/sentiment?showStats=false&loggingOptOut=true&stringIndexType=UnicodeCodePoint + response: + body: + string: '{"documents":[{"id":"0","sentiment":"negative","confidenceScores":{"positive":0.02,"neutral":0.12,"negative":0.86},"sentences":[{"sentiment":"negative","confidenceScores":{"positive":0.02,"neutral":0.12,"negative":0.86},"offset":0,"length":24,"text":"Test + for logging disable"}],"warnings":[]}],"errors":[],"modelVersion":"2020-04-01"}' + headers: + apim-request-id: + - d242dc2e-d790-4b0e-bf0a-4a16f40c7e6d + content-type: + - application/json; charset=utf-8 + csp-billing-usage: + - CognitiveServices.TextAnalytics.BatchScoring=1,CognitiveServices.TextAnalytics.TextRecords=1 + date: + - Thu, 13 May 2021 23:44:58 GMT + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '109' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_analyze_sentiment_async.test_disable_service_logs.yaml b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_analyze_sentiment_async.test_disable_service_logs.yaml new file mode 100644 index 000000000000..e25dcb15d8df --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_analyze_sentiment_async.test_disable_service_logs.yaml @@ -0,0 +1,33 @@ +interactions: +- request: + body: '{"documents": [{"id": "0", "text": "Test for logging disable", "language": + "en"}]}' + headers: + Accept: + - application/json, text/json + Content-Length: + - '82' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-textanalytics/5.1.0b7 Python/3.9.1 (macOS-10.16-x86_64-i386-64bit) + method: POST + uri: https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/sentiment?showStats=false&loggingOptOut=true&stringIndexType=UnicodeCodePoint + response: + body: + string: '{"documents":[{"id":"0","sentiment":"negative","confidenceScores":{"positive":0.02,"neutral":0.12,"negative":0.86},"sentences":[{"sentiment":"negative","confidenceScores":{"positive":0.02,"neutral":0.12,"negative":0.86},"offset":0,"length":24,"text":"Test + for logging disable"}],"warnings":[]}],"errors":[],"modelVersion":"2020-04-01"}' + headers: + apim-request-id: d9dafbcc-8dcb-4095-8da0-977d9c99facc + content-type: application/json; charset=utf-8 + csp-billing-usage: CognitiveServices.TextAnalytics.BatchScoring=1,CognitiveServices.TextAnalytics.TextRecords=1 + date: Thu, 13 May 2021 23:44:58 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '158' + status: + code: 200 + message: OK + url: https://centralus.api.cognitive.microsoft.com//text/analytics/v3.1-preview.5/sentiment?showStats=false&loggingOptOut=true&stringIndexType=UnicodeCodePoint +version: 1 diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_detect_language.test_disable_service_logs.yaml b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_detect_language.test_disable_service_logs.yaml new file mode 100644 index 000000000000..a9a351a6d769 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_detect_language.test_disable_service_logs.yaml @@ -0,0 +1,43 @@ +interactions: +- request: + body: '{"documents": [{"id": "0", "text": "Test for logging disable", "countryHint": + "US"}]}' + headers: + Accept: + - application/json, text/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '85' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-textanalytics/5.1.0b7 Python/3.9.1 (macOS-10.16-x86_64-i386-64bit) + method: POST + uri: https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/languages?showStats=false&loggingOptOut=true + response: + body: + string: '{"documents":[{"id":"0","detectedLanguage":{"name":"English","iso6391Name":"en","confidenceScore":0.88},"warnings":[]}],"errors":[],"modelVersion":"2021-01-05"}' + headers: + apim-request-id: + - 3f9ac6b4-05b5-41e5-a54d-95ccd3e80ba7 + content-type: + - application/json; charset=utf-8 + csp-billing-usage: + - CognitiveServices.TextAnalytics.BatchScoring=1,CognitiveServices.TextAnalytics.TextRecords=1 + date: + - Thu, 13 May 2021 23:44:57 GMT + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '19' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_detect_language_async.test_disable_service_logs.yaml b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_detect_language_async.test_disable_service_logs.yaml new file mode 100644 index 000000000000..9917e5aff5a6 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_detect_language_async.test_disable_service_logs.yaml @@ -0,0 +1,32 @@ +interactions: +- request: + body: '{"documents": [{"id": "0", "text": "Test for logging disable", "countryHint": + "US"}]}' + headers: + Accept: + - application/json, text/json + Content-Length: + - '85' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-textanalytics/5.1.0b7 Python/3.9.1 (macOS-10.16-x86_64-i386-64bit) + method: POST + uri: https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/languages?showStats=false&loggingOptOut=true + response: + body: + string: '{"documents":[{"id":"0","detectedLanguage":{"name":"English","iso6391Name":"en","confidenceScore":0.88},"warnings":[]}],"errors":[],"modelVersion":"2021-01-05"}' + headers: + apim-request-id: 3fefd94c-eb23-4dc8-9dc0-6dd51d1f010d + content-type: application/json; charset=utf-8 + csp-billing-usage: CognitiveServices.TextAnalytics.BatchScoring=1,CognitiveServices.TextAnalytics.TextRecords=1 + date: Thu, 13 May 2021 23:44:57 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '9' + status: + code: 200 + message: OK + url: https://centralus.api.cognitive.microsoft.com//text/analytics/v3.1-preview.5/languages?showStats=false&loggingOptOut=true +version: 1 diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_extract_key_phrases.test_disable_service_logs.yaml b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_extract_key_phrases.test_disable_service_logs.yaml new file mode 100644 index 000000000000..4b8a01b11db7 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_extract_key_phrases.test_disable_service_logs.yaml @@ -0,0 +1,43 @@ +interactions: +- request: + body: '{"documents": [{"id": "0", "text": "Test for logging disable", "language": + "en"}]}' + headers: + Accept: + - application/json, text/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '82' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-textanalytics/5.1.0b7 Python/3.9.1 (macOS-10.16-x86_64-i386-64bit) + method: POST + uri: https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/keyPhrases?showStats=false&loggingOptOut=true + response: + body: + string: '{"documents":[{"id":"0","keyPhrases":["Test","logging"],"warnings":[]}],"errors":[],"modelVersion":"2020-07-01"}' + headers: + apim-request-id: + - ec1c1512-d011-443c-b8c2-941464667788 + content-type: + - application/json; charset=utf-8 + csp-billing-usage: + - CognitiveServices.TextAnalytics.BatchScoring=1,CognitiveServices.TextAnalytics.TextRecords=1 + date: + - Thu, 13 May 2021 23:45:01 GMT + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '2519' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_extract_key_phrases_async.test_disable_service_logs.yaml b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_extract_key_phrases_async.test_disable_service_logs.yaml new file mode 100644 index 000000000000..a57bbb2fe330 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_extract_key_phrases_async.test_disable_service_logs.yaml @@ -0,0 +1,32 @@ +interactions: +- request: + body: '{"documents": [{"id": "0", "text": "Test for logging disable", "language": + "en"}]}' + headers: + Accept: + - application/json, text/json + Content-Length: + - '82' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-textanalytics/5.1.0b7 Python/3.9.1 (macOS-10.16-x86_64-i386-64bit) + method: POST + uri: https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/keyPhrases?showStats=false&loggingOptOut=true + response: + body: + string: '{"documents":[{"id":"0","keyPhrases":["Test","logging"],"warnings":[]}],"errors":[],"modelVersion":"2020-07-01"}' + headers: + apim-request-id: f8facd99-4e8f-4e33-8789-675baab65c39 + content-type: application/json; charset=utf-8 + csp-billing-usage: CognitiveServices.TextAnalytics.BatchScoring=1,CognitiveServices.TextAnalytics.TextRecords=1 + date: Thu, 13 May 2021 23:45:02 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '5022' + status: + code: 200 + message: OK + url: https://centralus.api.cognitive.microsoft.com//text/analytics/v3.1-preview.5/keyPhrases?showStats=false&loggingOptOut=true +version: 1 diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_recognize_entities.test_disable_service_logs.yaml b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_recognize_entities.test_disable_service_logs.yaml new file mode 100644 index 000000000000..e101fb2e184a --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_recognize_entities.test_disable_service_logs.yaml @@ -0,0 +1,43 @@ +interactions: +- request: + body: '{"documents": [{"id": "0", "text": "Test for logging disable", "language": + "en"}]}' + headers: + Accept: + - application/json, text/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '82' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-textanalytics/5.1.0b7 Python/3.9.1 (macOS-10.16-x86_64-i386-64bit) + method: POST + uri: https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/entities/recognition/general?showStats=false&loggingOptOut=true&stringIndexType=UnicodeCodePoint + response: + body: + string: '{"documents":[{"id":"0","entities":[{"text":"logging","category":"Skill","offset":9,"length":7,"confidenceScore":0.8}],"warnings":[]}],"errors":[],"modelVersion":"2021-01-15"}' + headers: + apim-request-id: + - 84785826-3668-447c-9d39-649591a715e3 + content-type: + - application/json; charset=utf-8 + csp-billing-usage: + - CognitiveServices.TextAnalytics.BatchScoring=1,CognitiveServices.TextAnalytics.TextRecords=1 + date: + - Thu, 13 May 2021 23:44:58 GMT + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '50' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_recognize_entities_async.test_disable_service_logs.yaml b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_recognize_entities_async.test_disable_service_logs.yaml new file mode 100644 index 000000000000..046fea4e03e0 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_recognize_entities_async.test_disable_service_logs.yaml @@ -0,0 +1,32 @@ +interactions: +- request: + body: '{"documents": [{"id": "0", "text": "Test for logging disable", "language": + "en"}]}' + headers: + Accept: + - application/json, text/json + Content-Length: + - '82' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-textanalytics/5.1.0b7 Python/3.9.1 (macOS-10.16-x86_64-i386-64bit) + method: POST + uri: https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/entities/recognition/general?showStats=false&loggingOptOut=true&stringIndexType=UnicodeCodePoint + response: + body: + string: '{"documents":[{"id":"0","entities":[{"text":"logging","category":"Skill","offset":9,"length":7,"confidenceScore":0.8}],"warnings":[]}],"errors":[],"modelVersion":"2021-01-15"}' + headers: + apim-request-id: a5d9aff9-dd0f-4464-a797-6af4897b1a7e + content-type: application/json; charset=utf-8 + csp-billing-usage: CognitiveServices.TextAnalytics.BatchScoring=1,CognitiveServices.TextAnalytics.TextRecords=1 + date: Thu, 13 May 2021 23:45:03 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '5037' + status: + code: 200 + message: OK + url: https://centralus.api.cognitive.microsoft.com//text/analytics/v3.1-preview.5/entities/recognition/general?showStats=false&loggingOptOut=true&stringIndexType=UnicodeCodePoint +version: 1 diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_recognize_linked_entities.test_disable_service_logs.yaml b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_recognize_linked_entities.test_disable_service_logs.yaml new file mode 100644 index 000000000000..fe75cf084cc8 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_recognize_linked_entities.test_disable_service_logs.yaml @@ -0,0 +1,45 @@ +interactions: +- request: + body: '{"documents": [{"id": "0", "text": "Test for logging disable", "language": + "en"}]}' + headers: + Accept: + - application/json, text/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '82' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-textanalytics/5.1.0b7 Python/3.9.1 (macOS-10.16-x86_64-i386-64bit) + method: POST + uri: https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/entities/linking?showStats=false&loggingOptOut=true&stringIndexType=UnicodeCodePoint + response: + body: + string: '{"documents":[{"id":"0","entities":[{"bingId":"a7b11e27-5b63-19a5-b4dd-37b71149ecac","name":"Test + (assessment)","matches":[{"text":"Test","offset":0,"length":4,"confidenceScore":0.04}],"language":"en","id":"Test + (assessment)","url":"https://en.wikipedia.org/wiki/Test_(assessment)","dataSource":"Wikipedia"}],"warnings":[]}],"errors":[],"modelVersion":"2020-02-01"}' + headers: + apim-request-id: + - 2422711a-281f-4b0b-832f-46630c61f639 + content-type: + - application/json; charset=utf-8 + csp-billing-usage: + - CognitiveServices.TextAnalytics.BatchScoring=1,CognitiveServices.TextAnalytics.TextRecords=1 + date: + - Thu, 13 May 2021 23:45:16 GMT + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '5030' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_recognize_linked_entities_async.test_disable_service_logs.yaml b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_recognize_linked_entities_async.test_disable_service_logs.yaml new file mode 100644 index 000000000000..8f91494dd20d --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_recognize_linked_entities_async.test_disable_service_logs.yaml @@ -0,0 +1,34 @@ +interactions: +- request: + body: '{"documents": [{"id": "0", "text": "Test for logging disable", "language": + "en"}]}' + headers: + Accept: + - application/json, text/json + Content-Length: + - '82' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-textanalytics/5.1.0b7 Python/3.9.1 (macOS-10.16-x86_64-i386-64bit) + method: POST + uri: https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/entities/linking?showStats=false&loggingOptOut=true&stringIndexType=UnicodeCodePoint + response: + body: + string: '{"documents":[{"id":"0","entities":[{"bingId":"a7b11e27-5b63-19a5-b4dd-37b71149ecac","name":"Test + (assessment)","matches":[{"text":"Test","offset":0,"length":4,"confidenceScore":0.04}],"language":"en","id":"Test + (assessment)","url":"https://en.wikipedia.org/wiki/Test_(assessment)","dataSource":"Wikipedia"}],"warnings":[]}],"errors":[],"modelVersion":"2020-02-01"}' + headers: + apim-request-id: bd2608d8-6acc-486d-95b0-9b9badcffac9 + content-type: application/json; charset=utf-8 + csp-billing-usage: CognitiveServices.TextAnalytics.BatchScoring=1,CognitiveServices.TextAnalytics.TextRecords=1 + date: Thu, 13 May 2021 23:45:31 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '25' + status: + code: 200 + message: OK + url: https://centralus.api.cognitive.microsoft.com//text/analytics/v3.1-preview.5/entities/linking?showStats=false&loggingOptOut=true&stringIndexType=UnicodeCodePoint +version: 1 diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_recognize_pii_entities.test_disable_service_logs.yaml b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_recognize_pii_entities.test_disable_service_logs.yaml new file mode 100644 index 000000000000..312993195d9d --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_recognize_pii_entities.test_disable_service_logs.yaml @@ -0,0 +1,43 @@ +interactions: +- request: + body: '{"documents": [{"id": "0", "text": "Test for logging disable", "language": + "en"}]}' + headers: + Accept: + - application/json, text/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '82' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-textanalytics/5.1.0b7 Python/3.9.1 (macOS-10.16-x86_64-i386-64bit) + method: POST + uri: https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/entities/recognition/pii?showStats=false&loggingOptOut=true&stringIndexType=UnicodeCodePoint + response: + body: + string: '{"documents":[{"redactedText":"Test for logging disable","id":"0","entities":[],"warnings":[]}],"errors":[],"modelVersion":"2021-01-15"}' + headers: + apim-request-id: + - 38fe47f1-384c-4681-af66-12271138fdaa + content-type: + - application/json; charset=utf-8 + csp-billing-usage: + - CognitiveServices.TextAnalytics.BatchScoring=1,CognitiveServices.TextAnalytics.TextRecords=1 + date: + - Thu, 13 May 2021 23:45:19 GMT + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '2533' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_recognize_pii_entities_async.test_disable_service_logs.yaml b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_recognize_pii_entities_async.test_disable_service_logs.yaml new file mode 100644 index 000000000000..79e2ddcc3b9c --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_recognize_pii_entities_async.test_disable_service_logs.yaml @@ -0,0 +1,32 @@ +interactions: +- request: + body: '{"documents": [{"id": "0", "text": "Test for logging disable", "language": + "en"}]}' + headers: + Accept: + - application/json, text/json + Content-Length: + - '82' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-textanalytics/5.1.0b7 Python/3.9.1 (macOS-10.16-x86_64-i386-64bit) + method: POST + uri: https://centralus.api.cognitive.microsoft.com/text/analytics/v3.1-preview.5/entities/recognition/pii?showStats=false&loggingOptOut=true&stringIndexType=UnicodeCodePoint + response: + body: + string: '{"documents":[{"redactedText":"Test for logging disable","id":"0","entities":[],"warnings":[]}],"errors":[],"modelVersion":"2021-01-15"}' + headers: + apim-request-id: 01d77205-0dc3-49c2-a93a-f2deb6375c29 + content-type: application/json; charset=utf-8 + csp-billing-usage: CognitiveServices.TextAnalytics.BatchScoring=1,CognitiveServices.TextAnalytics.TextRecords=1 + date: Thu, 13 May 2021 23:45:18 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '42' + status: + code: 200 + message: OK + url: https://centralus.api.cognitive.microsoft.com//text/analytics/v3.1-preview.5/entities/recognition/pii?showStats=false&loggingOptOut=true&stringIndexType=UnicodeCodePoint +version: 1 diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze.py b/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze.py index f72a950bc846..55819cfad94c 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze.py +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze.py @@ -10,6 +10,7 @@ import functools import itertools import datetime +import json from azure.core.exceptions import HttpResponseError, ClientAuthenticationError from azure.core.credentials import AzureKeyCredential @@ -655,3 +656,30 @@ def test_too_many_documents(self, client): polling_interval=self._interval(), ) assert excinfo.value.status_code == 400 + + @GlobalTextAnalyticsAccountPreparer() + @TextAnalyticsClientPreparer() + def test_disable_service_logs(self, client): + actions = [ + RecognizeEntitiesAction(disable_service_logs=True), + ExtractKeyPhrasesAction(disable_service_logs=True), + RecognizePiiEntitiesAction(disable_service_logs=True), + RecognizeLinkedEntitiesAction(disable_service_logs=True), + AnalyzeSentimentAction(disable_service_logs=True), + ] + + for action in actions: + assert action.disable_service_logs + + def callback(resp): + tasks = json.loads(resp.http_request.body)["tasks"] + assert len(tasks) == len(actions) + for task in tasks.values(): + assert task[0]["parameters"]["loggingOptOut"] + + client.begin_analyze_actions( + documents=["Test for logging disable"], + actions=actions, + polling_interval=self._interval(), + raw_response_hook=callback, + ).result() diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze_async.py b/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze_async.py index 438f3ec509c6..32253f51810b 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze_async.py +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze_async.py @@ -9,6 +9,8 @@ import platform import functools import itertools +import json +import time from azure.core.exceptions import HttpResponseError, ClientAuthenticationError from azure.core.pipeline.transport import AioHttpTransport @@ -697,3 +699,23 @@ async def test_too_many_documents(self, client): polling_interval=self._interval() )).result() assert excinfo.value.status_code == 400 + + @GlobalTextAnalyticsAccountPreparer() + @TextAnalyticsClientPreparer() + async def test_disable_service_logs(self, client): + actions = [ + RecognizeEntitiesAction(disable_service_logs=True), + ExtractKeyPhrasesAction(disable_service_logs=True), + RecognizePiiEntitiesAction(disable_service_logs=True), + RecognizeLinkedEntitiesAction(disable_service_logs=True), + AnalyzeSentimentAction(disable_service_logs=True), + ] + + for action in actions: + assert action.disable_service_logs + + await (await client.begin_analyze_actions( + documents=["Test for logging disable"], + actions=actions, + polling_interval=self._interval(), + )).result() diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze_healthcare.py b/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze_healthcare.py index 3feea4ae0241..120398d51040 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze_healthcare.py +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze_healthcare.py @@ -403,3 +403,17 @@ def test_healthcare_assertion(self, client): meningitis_entity = next(e for e in result[0].entities if e.text == "Meningitis") assert meningitis_entity.assertion.certainty == "negativePossible" + @GlobalTextAnalyticsAccountPreparer() + @TextAnalyticsClientPreparer() + def test_disable_service_logs(self, client): + def callback(resp): + # this is called for both the initial post + # and the gets. Only care about the initial post + if resp.http_request.method == "POST": + assert resp.http_request.query['loggingOptOut'] + client.begin_analyze_healthcare_entities( + documents=["Test for logging disable"], + polling_interval=self._interval(), + disable_service_logs=True, + raw_response_hook=callback, + ).result() diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze_healthcare_async.py b/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze_healthcare_async.py index adf7a5bafdc5..d769c7e98498 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze_healthcare_async.py +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze_healthcare_async.py @@ -457,3 +457,18 @@ async def test_healthcare_assertion(self, client): # have an issue to update https://github.com/Azure/azure-sdk-for-python/issues/17088 meningitis_entity = next(e for e in result[0].entities if e.text == "Meningitis") assert meningitis_entity.assertion.certainty == "negativePossible" + + @GlobalTextAnalyticsAccountPreparer() + @TextAnalyticsClientPreparer() + async def test_disable_service_logs(self, client): + def callback(resp): + # this is called for both the initial post + # and the gets. Only care about the initial post + if resp.http_request.method == "POST": + assert resp.http_request.query['loggingOptOut'] + await (await client.begin_analyze_healthcare_entities( + documents=["Test for logging disable"], + polling_interval=self._interval(), + disable_service_logs=True, + raw_response_hook=callback, + )).result() diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze_sentiment.py b/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze_sentiment.py index ba97135c8384..5156b7b33c87 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze_sentiment.py +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze_sentiment.py @@ -747,3 +747,14 @@ def callback(response): string_index_type="TextElements_v8", raw_response_hook=callback ) + + @GlobalTextAnalyticsAccountPreparer() + @TextAnalyticsClientPreparer() + def test_disable_service_logs(self, client): + def callback(resp): + assert resp.http_request.query['loggingOptOut'] + client.analyze_sentiment( + documents=["Test for logging disable"], + disable_service_logs=True, + raw_response_hook=callback, + ) diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze_sentiment_async.py b/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze_sentiment_async.py index f80097493f08..b690a11563a0 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze_sentiment_async.py +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze_sentiment_async.py @@ -762,3 +762,14 @@ def callback(response): string_index_type="TextElements_v8", raw_response_hook=callback ) + + @GlobalTextAnalyticsAccountPreparer() + @TextAnalyticsClientPreparer() + async def test_disable_service_logs(self, client): + def callback(resp): + assert resp.http_request.query['loggingOptOut'] + await client.analyze_sentiment( + documents=["Test for logging disable"], + disable_service_logs=True, + raw_response_hook=callback, + ) \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/test_detect_language.py b/sdk/textanalytics/azure-ai-textanalytics/tests/test_detect_language.py index abc85d1358fa..6f1af4462adb 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/tests/test_detect_language.py +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/test_detect_language.py @@ -598,3 +598,14 @@ def test_string_index_type_not_fail_v3(self, client): # make sure that the addition of the string_index_type kwarg for v3.1-preview.1 doesn't # cause v3.0 calls to fail client.detect_language(["please don't fail"]) + + @GlobalTextAnalyticsAccountPreparer() + @TextAnalyticsClientPreparer() + def test_disable_service_logs(self, client): + def callback(resp): + assert resp.http_request.query['loggingOptOut'] + client.detect_language( + documents=["Test for logging disable"], + disable_service_logs=True, + raw_response_hook=callback, + ) diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/test_detect_language_async.py b/sdk/textanalytics/azure-ai-textanalytics/tests/test_detect_language_async.py index cfd7965b517a..4a1a9a1d21a4 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/tests/test_detect_language_async.py +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/test_detect_language_async.py @@ -611,3 +611,14 @@ async def test_string_index_type_not_fail_v3(self, client): # make sure that the addition of the string_index_type kwarg for v3.1-preview.1 doesn't # cause v3.0 calls to fail await client.detect_language(["please don't fail"]) + + @GlobalTextAnalyticsAccountPreparer() + @TextAnalyticsClientPreparer() + async def test_disable_service_logs(self, client): + def callback(resp): + assert resp.http_request.query['loggingOptOut'] + await client.detect_language( + documents=["Test for logging disable"], + disable_service_logs=True, + raw_response_hook=callback, + ) diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/test_extract_key_phrases.py b/sdk/textanalytics/azure-ai-textanalytics/tests/test_extract_key_phrases.py index a8f843e9e409..893634a9c6f5 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/tests/test_extract_key_phrases.py +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/test_extract_key_phrases.py @@ -535,3 +535,14 @@ def test_string_index_type_not_fail_v3(self, client): # make sure that the addition of the string_index_type kwarg for v3.1-preview.1 doesn't # cause v3.0 calls to fail client.extract_key_phrases(["please don't fail"]) + + @GlobalTextAnalyticsAccountPreparer() + @TextAnalyticsClientPreparer() + def test_disable_service_logs(self, client): + def callback(resp): + assert resp.http_request.query['loggingOptOut'] + client.extract_key_phrases( + documents=["Test for logging disable"], + disable_service_logs=True, + raw_response_hook=callback, + ) diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/test_extract_key_phrases_async.py b/sdk/textanalytics/azure-ai-textanalytics/tests/test_extract_key_phrases_async.py index b9a7b9960e59..f42a3d8ad2b6 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/tests/test_extract_key_phrases_async.py +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/test_extract_key_phrases_async.py @@ -550,3 +550,14 @@ async def test_string_index_type_not_fail_v3(self, client): # make sure that the addition of the string_index_type kwarg for v3.1-preview.1 doesn't # cause v3.0 calls to fail await client.extract_key_phrases(["please don't fail"]) + + @GlobalTextAnalyticsAccountPreparer() + @TextAnalyticsClientPreparer() + async def test_disable_service_logs(self, client): + def callback(resp): + assert resp.http_request.query['loggingOptOut'] + await client.extract_key_phrases( + documents=["Test for logging disable"], + disable_service_logs=True, + raw_response_hook=callback, + ) diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/test_recognize_entities.py b/sdk/textanalytics/azure-ai-textanalytics/tests/test_recognize_entities.py index ca8e4832ebda..9c8b7fef4f7c 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/tests/test_recognize_entities.py +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/test_recognize_entities.py @@ -600,3 +600,13 @@ def callback(response): raw_response_hook=callback ) + @GlobalTextAnalyticsAccountPreparer() + @TextAnalyticsClientPreparer() + def test_disable_service_logs(self, client): + def callback(resp): + assert resp.http_request.query['loggingOptOut'] + client.recognize_entities( + documents=["Test for logging disable"], + disable_service_logs=True, + raw_response_hook=callback, + ) diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/test_recognize_entities_async.py b/sdk/textanalytics/azure-ai-textanalytics/tests/test_recognize_entities_async.py index 6f9e69ade61c..29c73d0961eb 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/tests/test_recognize_entities_async.py +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/test_recognize_entities_async.py @@ -618,3 +618,14 @@ def callback(response): string_index_type="TextElements_v8", raw_response_hook=callback ) + + @GlobalTextAnalyticsAccountPreparer() + @TextAnalyticsClientPreparer() + async def test_disable_service_logs(self, client): + def callback(resp): + assert resp.http_request.query['loggingOptOut'] + await client.recognize_entities( + documents=["Test for logging disable"], + disable_service_logs=True, + raw_response_hook=callback, + ) \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/test_recognize_linked_entities.py b/sdk/textanalytics/azure-ai-textanalytics/tests/test_recognize_linked_entities.py index 65e5a081700f..bb10a45879f7 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/tests/test_recognize_linked_entities.py +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/test_recognize_linked_entities.py @@ -613,4 +613,15 @@ def callback(response): documents=["Hello world"], string_index_type="TextElements_v8", raw_response_hook=callback - ) \ No newline at end of file + ) + + @GlobalTextAnalyticsAccountPreparer() + @TextAnalyticsClientPreparer() + def test_disable_service_logs(self, client): + def callback(resp): + assert resp.http_request.query['loggingOptOut'] + client.recognize_linked_entities( + documents=["Test for logging disable"], + disable_service_logs=True, + raw_response_hook=callback, + ) diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/test_recognize_linked_entities_async.py b/sdk/textanalytics/azure-ai-textanalytics/tests/test_recognize_linked_entities_async.py index e8dfc9c0c6d0..5caddb045e46 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/tests/test_recognize_linked_entities_async.py +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/test_recognize_linked_entities_async.py @@ -649,4 +649,15 @@ def callback(response): documents=["Hello world"], string_index_type="TextElements_v8", raw_response_hook=callback - ) \ No newline at end of file + ) + + @GlobalTextAnalyticsAccountPreparer() + @TextAnalyticsClientPreparer() + async def test_disable_service_logs(self, client): + def callback(resp): + assert resp.http_request.query['loggingOptOut'] + await client.recognize_linked_entities( + documents=["Test for logging disable"], + disable_service_logs=True, + raw_response_hook=callback, + ) diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/test_recognize_pii_entities.py b/sdk/textanalytics/azure-ai-textanalytics/tests/test_recognize_pii_entities.py index 0d818cc6a90e..e1b4b07e056d 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/tests/test_recognize_pii_entities.py +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/test_recognize_pii_entities.py @@ -658,3 +658,14 @@ def callback(response): string_index_type="TextElements_v8", raw_response_hook=callback ) + + @GlobalTextAnalyticsAccountPreparer() + @TextAnalyticsClientPreparer() + def test_disable_service_logs(self, client): + def callback(resp): + assert resp.http_request.query['loggingOptOut'] + client.recognize_pii_entities( + documents=["Test for logging disable"], + disable_service_logs=True, + raw_response_hook=callback, + ) \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/test_recognize_pii_entities_async.py b/sdk/textanalytics/azure-ai-textanalytics/tests/test_recognize_pii_entities_async.py index 845ada97af1c..82f1e0dfaace 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/tests/test_recognize_pii_entities_async.py +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/test_recognize_pii_entities_async.py @@ -658,4 +658,15 @@ def callback(response): documents=["Hello world"], string_index_type="TextElements_v8", raw_response_hook=callback - ) \ No newline at end of file + ) + + @GlobalTextAnalyticsAccountPreparer() + @TextAnalyticsClientPreparer() + async def test_disable_service_logs(self, client): + def callback(resp): + assert resp.http_request.query['loggingOptOut'] + await client.recognize_pii_entities( + documents=["Test for logging disable"], + disable_service_logs=True, + raw_response_hook=callback, + )