Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[text analytics] add logging param #18729

Merged
7 commits merged into from
May 14, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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.
Expand All @@ -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),
Expand Down Expand Up @@ -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:
Expand All @@ -529,6 +581,9 @@ 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]
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.begin_health(
Expand Down Expand Up @@ -595,6 +650,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.
Expand All @@ -616,6 +679,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,
Expand Down Expand Up @@ -672,6 +739,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.
Expand All @@ -697,6 +772,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),
Expand Down
Loading