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] default to v3.1-preview.2, have it listed under enum V3_1_PREVIEW #13708

Merged
merged 6 commits into from
Sep 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 5 additions & 6 deletions sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
## 5.1.0b1 (Unreleased)

**New features**
- We are now targeting the service's v3.1-preview.1 API as the default. If you would like to still use version v3.0 of the service,
- We are now targeting the service's v3.1-preview API as the default. If you would like to still use version v3.0 of the service,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could be confusing to the user, especially that you referred to the concrete preview version before in older changelog notes here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's fair, but I think with these two new versions, it's unnecessary to support both, and once the service GAs, we're also only going to support v3.0 and v3.1, so I'm comfortable squashing v3.1-preview.1 and v3.1-preview.2 into one api version

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my comment is not about supporting both but rather about being consistent with the service naming of the endpoints. Otherwise the user would wonder what is v3.1-preview because no such version exist in the service docs.

Copy link
Contributor Author

@iscai-msft iscai-msft Sep 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see your point, @kristapratico and I had discussed this, and I think we both overall prefer exposing it as v3.0 and v3.1-preview instead of v3.1-preivew.2. Since we've never actually done a release on our side targeting the v3.1-preview.1 API, I think it would be weird to come out directly with a v3.1-preview.2, and I think it overall reduces some overhead for the user exposing it as v3.1-preview version instead of specifically v3.1-preview.2 in all of the docstrings. How strongly do you feel about this @deyaaeldeen ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deyaaeldeen what I meant by overhead was having to explicitly now that this was the second preview version. Since there's no reason for a user to discern between 3.1-preview.1 and 3.1-preview.2, I think it would be cleaner to just combine them as 3.1-preview

pass in `v3.0` to the kwarg `api_version` when creating your TextAnalyticsClient
- We have added an API `recognize_pii_entities` which returns entities containing personal information for a batch of documents. Only available for API version v3.1-preview.1 and up.
- In API version v3.1-preview.2 and up, the redacted text of the document is returned on the top-level result object `RecognizePiiEntitiesResult` through property `redacted_text`.
- Added `offset` and `length` properties for `CategorizedEntity`, `SentenceSentiment`, and `LinkedEntityMatch`. These properties are only available for API versions v3.1-preview.1 and up.
- We have added an API `recognize_pii_entities` which returns entities containing personally identifiable information for a batch of documents. Only available for API version v3.1-preview and up.
- Added `offset` and `length` properties for `CategorizedEntity`, `SentenceSentiment`, and `LinkedEntityMatch`. These properties are only available for API versions v3.1-preview and up.
- `length` is the number of characters in the text of these models
- `offset` is the offset of the text from the start of the document
- We now have added support for opinion mining. To use this feature, you need to make sure you are using the service's
v3.1-preview.1 API. To get this support pass `show_opinion_mining` as True when calling the `analyze_sentiment` endpoint
- Add property `bing_entity_search_api_id` to the `LinkedEntity` class. This property is only available for v3.1-preview.2 and up, and it is to be
v3.1-preview API. To get this support pass `show_opinion_mining` as True when calling the `analyze_sentiment` endpoint
- Add property `bing_entity_search_api_id` to the `LinkedEntity` class. This property is only available for v3.1-preview and up, and it is to be
used in conjunction with the Bing Entity Search API to fetch additional relevant information about the returned entity.

## 5.0.0 (2020-07-27)
Expand Down
2 changes: 1 addition & 1 deletion sdk/textanalytics/azure-ai-textanalytics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ and [supported types][linked_entities_categories].

### Recognize PII entities
[recognize_pii_entities][recognize_pii_entities] recognizes and categorizes Personally Identifiable Information (PII) entities in its input text, such as
Social Security Numbers, bank account information, credit card numbers, and more. This endpoint is only available for v3.1-preview.1 and up.
Social Security Numbers, bank account information, credit card numbers, and more. This endpoint is only available for v3.1-preview and up.

```python
from azure.core.credentials import AzureKeyCredential
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ class TextAnalyticsApiVersion(str, Enum):
"""Text Analytics API versions supported by this package"""

#: this is the default version
V3_1_PREVIEW_1 = "v3.1-preview.1"

# 3.1-preview.2 is not yet the default version since we don't have a
# reliable endpoint
V3_1_PREVIEW_2 = "v3.1-preview.2"
V3_1_PREVIEW = "v3.1-preview.2"
V3_0 = "v3.0"

def _authentication_policy(credential):
Expand All @@ -40,7 +36,7 @@ def __init__(self, endpoint, credential, **kwargs):
self._client = _TextAnalyticsClient(
endpoint=endpoint,
credential=credential,
api_version=kwargs.pop("api_version", TextAnalyticsApiVersion.V3_1_PREVIEW_1),
api_version=kwargs.pop("api_version", TextAnalyticsApiVersion.V3_1_PREVIEW),
sdk_moniker=USER_AGENT,
authentication_policy=_authentication_policy(credential),
custom_hook_policy=TextAnalyticsResponseHookPolicy(**kwargs),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._text_analytics_client_async import TextAnalyticsClient
from ._text_analytics_client import TextAnalyticsClient
__all__ = ['TextAnalyticsClient']
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ async def entities_linking(
"""
api_version = self._get_api_version('entities_linking')
if api_version == 'v3.0':
from ..v3_0.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_0.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.1':
from ..v3_1_preview_1.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_1_preview_1.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.2':
from ..v3_1_preview_2.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_1_preview_2.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
mixin_instance = OperationClass()
Expand Down Expand Up @@ -90,11 +90,11 @@ async def entities_recognition_general(
"""
api_version = self._get_api_version('entities_recognition_general')
if api_version == 'v3.0':
from ..v3_0.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_0.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.1':
from ..v3_1_preview_1.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_1_preview_1.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.2':
from ..v3_1_preview_2.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_1_preview_2.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
mixin_instance = OperationClass()
Expand Down Expand Up @@ -142,9 +142,9 @@ async def entities_recognition_pii(
"""
api_version = self._get_api_version('entities_recognition_pii')
if api_version == 'v3.1-preview.1':
from ..v3_1_preview_1.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_1_preview_1.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.2':
from ..v3_1_preview_2.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_1_preview_2.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
mixin_instance = OperationClass()
Expand Down Expand Up @@ -182,11 +182,11 @@ async def key_phrases(
"""
api_version = self._get_api_version('key_phrases')
if api_version == 'v3.0':
from ..v3_0.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_0.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.1':
from ..v3_1_preview_1.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_1_preview_1.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.2':
from ..v3_1_preview_2.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_1_preview_2.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
mixin_instance = OperationClass()
Expand Down Expand Up @@ -225,11 +225,11 @@ async def languages(
"""
api_version = self._get_api_version('languages')
if api_version == 'v3.0':
from ..v3_0.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_0.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.1':
from ..v3_1_preview_1.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_1_preview_1.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.2':
from ..v3_1_preview_2.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_1_preview_2.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
mixin_instance = OperationClass()
Expand Down Expand Up @@ -268,11 +268,11 @@ async def sentiment(
"""
api_version = self._get_api_version('sentiment')
if api_version == 'v3.0':
from ..v3_0.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_0.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.1':
from ..v3_1_preview_1.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_1_preview_1.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.2':
from ..v3_1_preview_2.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_1_preview_2.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
mixin_instance = OperationClass()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

from azure.profiles import KnownProfiles, ProfileDefinition
from azure.profiles.multiapiclient import MultiApiClientMixin
from ._configuration_async import TextAnalyticsClientConfiguration
from ._operations_mixin_async import TextAnalyticsClientOperationsMixin
from ._configuration import TextAnalyticsClientConfiguration
from ._operations_mixin import TextAnalyticsClientOperationsMixin
class _SDKClient(object):
def __init__(self, *args, **kwargs):
"""This is a fake class to support current implemetation of MultiApiClientMixin."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._text_analytics_client_async import TextAnalyticsClient
from ._text_analytics_client import TextAnalyticsClient
__all__ = ['TextAnalyticsClient']
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential

from ._configuration_async import TextAnalyticsClientConfiguration
from .operations_async import TextAnalyticsClientOperationsMixin
from ._configuration import TextAnalyticsClientConfiguration
from .operations import TextAnalyticsClientOperationsMixin
from .. import models


Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading