Skip to content

Commit

Permalink
[textanalytics] regen on 2022-04-01-preview + rerecord (#24280)
Browse files Browse the repository at this point in the history
* regen on april preview version

* updates to handwritten layer for api version change

* rerecord

* fix

* add fhir to cspell

* skip samples due to service bug

* fixes and recordings for healthcare cancel with april api version

* fix tests

* actually fix tests

* oops
  • Loading branch information
kristapratico authored May 4, 2022
1 parent 1a952a6 commit c59eb64
Show file tree
Hide file tree
Showing 648 changed files with 315,599 additions and 8,208 deletions.
4 changes: 3 additions & 1 deletion .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,9 @@
"italiano",
"skrivet",
"verfasst",
"engelska"
"engelska",
"fhir",
"FHIR"
]
},
{
Expand Down
8 changes: 6 additions & 2 deletions scripts/devops_tasks/test_run_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,14 @@
],
"azure-ai-language-questionanswering": ["sample_chat.py"],
"azure-ai-textanalytics": [
"sample_authentication.py",
"sample_authentication_async.py",
"sample_analyze_healthcare_entities_with_cancellation.py",
"sample_analyze_healthcare_entities_with_cancellation_async.py",
"sample_single_category_classify.py",
"sample_multi_category_classify.py",
"sample_recognize_custom_entities.py",
"sample_multi_category_classify_async.py",
"sample_recognize_custom_entities_async.py",
"sample_single_category_classify_async.py",
]
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class TextAnalyticsApiVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Text Analytics API versions supported by this package"""

#: this is the default version
V2022_03_01_PREVIEW = "2022-03-01-preview"
V2022_04_01_PREVIEW = "2022-04-01-preview"
V3_1 = "v3.1"
V3_0 = "v3.0"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,18 @@ def analyze_text(
executed immediately.
:param body: Collection of documents to analyze and a single task to execute.
:type body: ~azure.ai.textanalytics.v2022_03_01_preview.models.AnalyzeTextTask
:type body: ~azure.ai.textanalytics.v2022_04_01_preview.models.AnalyzeTextTask
:param show_stats: (Optional) if set to true, response will contain request and document level
statistics.
:type show_stats: bool
:keyword callable cls: A custom type or function that will be passed the direct response
:return: AnalyzeTextTaskResult, or the result of cls(response)
:rtype: ~azure.ai.textanalytics.v2022_03_01_preview.models.AnalyzeTextTaskResult
:rtype: ~azure.ai.textanalytics.v2022_04_01_preview.models.AnalyzeTextTaskResult
:raises: ~azure.core.exceptions.HttpResponseError
"""
api_version = self._get_api_version('analyze_text')
if api_version == '2022-03-01-preview':
from .v2022_03_01_preview.operations import TextAnalyticsClientOperationsMixin as OperationClass
if api_version == '2022-04-01-preview':
from .v2022_04_01_preview.operations import TextAnalyticsClientOperationsMixin as OperationClass
else:
raise ValueError("API version {} does not have operation 'analyze_text'".format(api_version))
mixin_instance = OperationClass()
Expand Down Expand Up @@ -127,12 +127,12 @@ def analyze_text_job_status(
:type skip: int
:keyword callable cls: A custom type or function that will be passed the direct response
:return: AnalyzeTextJobState, or the result of cls(response)
:rtype: ~azure.ai.textanalytics.v2022_03_01_preview.models.AnalyzeTextJobState
:rtype: ~azure.ai.textanalytics.v2022_04_01_preview.models.AnalyzeTextJobState
:raises: ~azure.core.exceptions.HttpResponseError
"""
api_version = self._get_api_version('analyze_text_job_status')
if api_version == '2022-03-01-preview':
from .v2022_03_01_preview.operations import TextAnalyticsClientOperationsMixin as OperationClass
if api_version == '2022-04-01-preview':
from .v2022_04_01_preview.operations import TextAnalyticsClientOperationsMixin as OperationClass
else:
raise ValueError("API version {} does not have operation 'analyze_text_job_status'".format(api_version))
mixin_instance = OperationClass()
Expand Down Expand Up @@ -207,8 +207,8 @@ def begin_analyze_text_cancel_job( # pylint: disable=inconsistent-return-statem
:raises: ~azure.core.exceptions.HttpResponseError
"""
api_version = self._get_api_version('begin_analyze_text_cancel_job')
if api_version == '2022-03-01-preview':
from .v2022_03_01_preview.operations import TextAnalyticsClientOperationsMixin as OperationClass
if api_version == '2022-04-01-preview':
from .v2022_04_01_preview.operations import TextAnalyticsClientOperationsMixin as OperationClass
else:
raise ValueError("API version {} does not have operation 'begin_analyze_text_cancel_job'".format(api_version))
mixin_instance = OperationClass()
Expand All @@ -231,7 +231,7 @@ def begin_analyze_text_submit_job(
executed as a long-running operation.
:param body: Collection of documents to analyze and one or more tasks to execute.
:type body: ~azure.ai.textanalytics.v2022_03_01_preview.models.AnalyzeTextJobsInput
:type body: ~azure.ai.textanalytics.v2022_04_01_preview.models.AnalyzeTextJobsInput
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AnalyzeActionsLROPollingMethod. Pass
Expand All @@ -243,12 +243,12 @@ def begin_analyze_text_submit_job(
:return: An instance of AnalyzeActionsLROPoller that returns either AnalyzeTextJobState or the
result of cls(response)
:rtype:
~...._lro.AnalyzeActionsLROPoller[~azure.ai.textanalytics.v2022_03_01_preview.models.AnalyzeTextJobState]
~...._lro.AnalyzeActionsLROPoller[~azure.ai.textanalytics.v2022_04_01_preview.models.AnalyzeTextJobState]
:raises: ~azure.core.exceptions.HttpResponseError
"""
api_version = self._get_api_version('begin_analyze_text_submit_job')
if api_version == '2022-03-01-preview':
from .v2022_03_01_preview.operations import TextAnalyticsClientOperationsMixin as OperationClass
if api_version == '2022-04-01-preview':
from .v2022_04_01_preview.operations import TextAnalyticsClientOperationsMixin as OperationClass
else:
raise ValueError("API version {} does not have operation 'begin_analyze_text_submit_job'".format(api_version))
mixin_instance = OperationClass()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ class TextAnalyticsClient(TextAnalyticsClientOperationsMixin, MultiApiClientMixi
LATEST_PROFILE = ProfileDefinition({
_PROFILE_TAG: {
None: DEFAULT_API_VERSION,
'analyze_text': '2022-03-01-preview',
'analyze_text_job_status': '2022-03-01-preview',
'begin_analyze_text_cancel_job': '2022-03-01-preview',
'begin_analyze_text_submit_job': '2022-03-01-preview',
'analyze_text': '2022-04-01-preview',
'analyze_text_job_status': '2022-04-01-preview',
'begin_analyze_text_cancel_job': '2022-04-01-preview',
'begin_analyze_text_submit_job': '2022-04-01-preview',
}},
_PROFILE_TAG + " latest"
)
Expand All @@ -76,7 +76,7 @@ def __init__(
profile=KnownProfiles.default, # type: KnownProfiles
**kwargs # type: Any
):
if api_version == '2022-03-01-preview':
if api_version == '2022-04-01-preview':
base_url = '{Endpoint}/language'
elif api_version == 'v3.0':
base_url = '{Endpoint}/text/analytics/v3.0'
Expand All @@ -99,12 +99,12 @@ def _models_dict(cls, api_version):
def models(cls, api_version=DEFAULT_API_VERSION):
"""Module depends on the API version:
* 2022-03-01-preview: :mod:`v2022_03_01_preview.models<azure.ai.textanalytics.v2022_03_01_preview.models>`
* 2022-04-01-preview: :mod:`v2022_04_01_preview.models<azure.ai.textanalytics.v2022_04_01_preview.models>`
* v3.0: :mod:`v3_0.models<azure.ai.textanalytics.v3_0.models>`
* v3.1: :mod:`v3_1.models<azure.ai.textanalytics.v3_1.models>`
"""
if api_version == '2022-03-01-preview':
from .v2022_03_01_preview import models
if api_version == '2022-04-01-preview':
from .v2022_04_01_preview import models
return models
elif api_version == 'v3.0':
from .v3_0 import models
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,18 @@ async def analyze_text(
executed immediately.
:param body: Collection of documents to analyze and a single task to execute.
:type body: ~azure.ai.textanalytics.v2022_03_01_preview.models.AnalyzeTextTask
:type body: ~azure.ai.textanalytics.v2022_04_01_preview.models.AnalyzeTextTask
:param show_stats: (Optional) if set to true, response will contain request and document level
statistics.
:type show_stats: bool
:keyword callable cls: A custom type or function that will be passed the direct response
:return: AnalyzeTextTaskResult, or the result of cls(response)
:rtype: ~azure.ai.textanalytics.v2022_03_01_preview.models.AnalyzeTextTaskResult
:rtype: ~azure.ai.textanalytics.v2022_04_01_preview.models.AnalyzeTextTaskResult
:raises: ~azure.core.exceptions.HttpResponseError
"""
api_version = self._get_api_version('analyze_text')
if api_version == '2022-03-01-preview':
from ..v2022_03_01_preview.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
if api_version == '2022-04-01-preview':
from ..v2022_04_01_preview.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
else:
raise ValueError("API version {} does not have operation 'analyze_text'".format(api_version))
mixin_instance = OperationClass()
Expand Down Expand Up @@ -120,12 +120,12 @@ async def analyze_text_job_status(
:type skip: int
:keyword callable cls: A custom type or function that will be passed the direct response
:return: AnalyzeTextJobState, or the result of cls(response)
:rtype: ~azure.ai.textanalytics.v2022_03_01_preview.models.AnalyzeTextJobState
:rtype: ~azure.ai.textanalytics.v2022_04_01_preview.models.AnalyzeTextJobState
:raises: ~azure.core.exceptions.HttpResponseError
"""
api_version = self._get_api_version('analyze_text_job_status')
if api_version == '2022-03-01-preview':
from ..v2022_03_01_preview.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
if api_version == '2022-04-01-preview':
from ..v2022_04_01_preview.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
else:
raise ValueError("API version {} does not have operation 'analyze_text_job_status'".format(api_version))
mixin_instance = OperationClass()
Expand Down Expand Up @@ -199,8 +199,8 @@ async def begin_analyze_text_cancel_job( # pylint: disable=inconsistent-return-
:raises: ~azure.core.exceptions.HttpResponseError
"""
api_version = self._get_api_version('begin_analyze_text_cancel_job')
if api_version == '2022-03-01-preview':
from ..v2022_03_01_preview.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
if api_version == '2022-04-01-preview':
from ..v2022_04_01_preview.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
else:
raise ValueError("API version {} does not have operation 'begin_analyze_text_cancel_job'".format(api_version))
mixin_instance = OperationClass()
Expand All @@ -222,7 +222,7 @@ async def begin_analyze_text_submit_job(
executed as a long-running operation.
:param body: Collection of documents to analyze and one or more tasks to execute.
:type body: ~azure.ai.textanalytics.v2022_03_01_preview.models.AnalyzeTextJobsInput
:type body: ~azure.ai.textanalytics.v2022_04_01_preview.models.AnalyzeTextJobsInput
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncAnalyzeActionsLROPollingMethod.
Expand All @@ -234,12 +234,12 @@ async def begin_analyze_text_submit_job(
:return: An instance of AsyncAnalyzeActionsLROPoller that returns either AnalyzeTextJobState or
the result of cls(response)
:rtype:
~.....aio._lro_async.AsyncAnalyzeActionsLROPoller[~azure.ai.textanalytics.v2022_03_01_preview.models.AnalyzeTextJobState]
~.....aio._lro_async.AsyncAnalyzeActionsLROPoller[~azure.ai.textanalytics.v2022_04_01_preview.models.AnalyzeTextJobState]
:raises: ~azure.core.exceptions.HttpResponseError
"""
api_version = self._get_api_version('begin_analyze_text_submit_job')
if api_version == '2022-03-01-preview':
from ..v2022_03_01_preview.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
if api_version == '2022-04-01-preview':
from ..v2022_04_01_preview.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
else:
raise ValueError("API version {} does not have operation 'begin_analyze_text_submit_job'".format(api_version))
mixin_instance = OperationClass()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ class TextAnalyticsClient(TextAnalyticsClientOperationsMixin, MultiApiClientMixi
LATEST_PROFILE = ProfileDefinition({
_PROFILE_TAG: {
None: DEFAULT_API_VERSION,
'analyze_text': '2022-03-01-preview',
'analyze_text_job_status': '2022-03-01-preview',
'begin_analyze_text_cancel_job': '2022-03-01-preview',
'begin_analyze_text_submit_job': '2022-03-01-preview',
'analyze_text': '2022-04-01-preview',
'analyze_text_job_status': '2022-04-01-preview',
'begin_analyze_text_cancel_job': '2022-04-01-preview',
'begin_analyze_text_submit_job': '2022-04-01-preview',
}},
_PROFILE_TAG + " latest"
)
Expand All @@ -75,7 +75,7 @@ def __init__(
profile: KnownProfiles = KnownProfiles.default,
**kwargs # type: Any
) -> None:
if api_version == '2022-03-01-preview':
if api_version == '2022-04-01-preview':
base_url = '{Endpoint}/language'
elif api_version == 'v3.0':
base_url = '{Endpoint}/text/analytics/v3.0'
Expand All @@ -98,12 +98,12 @@ def _models_dict(cls, api_version):
def models(cls, api_version=DEFAULT_API_VERSION):
"""Module depends on the API version:
* 2022-03-01-preview: :mod:`v2022_03_01_preview.models<azure.ai.textanalytics.v2022_03_01_preview.models>`
* 2022-04-01-preview: :mod:`v2022_04_01_preview.models<azure.ai.textanalytics.v2022_04_01_preview.models>`
* v3.0: :mod:`v3_0.models<azure.ai.textanalytics.v3_0.models>`
* v3.1: :mod:`v3_1.models<azure.ai.textanalytics.v3_1.models>`
"""
if api_version == '2022-03-01-preview':
from ..v2022_03_01_preview import models
if api_version == '2022-04-01-preview':
from ..v2022_04_01_preview import models
return models
elif api_version == 'v3.0':
from ..v3_0 import models
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
from .v2022_03_01_preview.models import *
from .v2022_04_01_preview.models import *
from .v3_1.models import *
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class TextAnalyticsClientConfiguration(Configuration): # pylint: disable=too-ma
:param endpoint: Supported Cognitive Services endpoint (e.g.,
https://:code:`<resource-name>`.api.cognitiveservices.azure.com).
:type endpoint: str
:keyword api_version: Api Version. The default value is "2022-03-01-preview". Note that
:keyword api_version: Api Version. The default value is "2022-04-01-preview". Note that
overriding this default value may result in unsupported behavior.
:paramtype api_version: str
"""
Expand All @@ -40,7 +40,7 @@ def __init__(
**kwargs: Any
) -> None:
super(TextAnalyticsClientConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str
api_version = kwargs.pop('api_version', "2022-04-01-preview") # type: str

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
Expand Down
Loading

0 comments on commit c59eb64

Please sign in to comment.