azure-ai-textanalytics 5.3.0b2__py3-none-any.whl → 6.0.0b1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of azure-ai-textanalytics might be problematic. Click here for more details.
- azure/ai/textanalytics/__init__.py +26 -193
- azure/ai/textanalytics/_client.py +111 -0
- azure/ai/textanalytics/_configuration.py +73 -0
- azure/ai/textanalytics/{_generated/v2022_05_01/operations → _operations}/__init__.py +13 -8
- azure/ai/textanalytics/_operations/_operations.py +716 -0
- azure/ai/textanalytics/{_generated/v2022_05_01/models → _operations}/_patch.py +8 -6
- azure/ai/textanalytics/_patch.py +350 -0
- azure/ai/textanalytics/{_generated/aio → _utils}/__init__.py +1 -5
- azure/ai/textanalytics/_utils/model_base.py +1237 -0
- azure/ai/textanalytics/{_generated/_serialization.py → _utils/serialization.py} +640 -616
- azure/ai/textanalytics/{_generated/v2022_05_01/aio/_vendor.py → _utils/utils.py} +10 -12
- azure/ai/textanalytics/_version.py +8 -7
- azure/ai/textanalytics/aio/__init__.py +25 -14
- azure/ai/textanalytics/aio/_client.py +115 -0
- azure/ai/textanalytics/aio/_configuration.py +75 -0
- azure/ai/textanalytics/{_generated/v2022_10_01_preview/aio/operations → aio/_operations}/__init__.py +13 -8
- azure/ai/textanalytics/aio/_operations/_operations.py +623 -0
- azure/ai/textanalytics/{_generated/v2022_05_01 → aio/_operations}/_patch.py +8 -6
- azure/ai/textanalytics/aio/_patch.py +344 -0
- azure/ai/textanalytics/models/__init__.py +402 -0
- azure/ai/textanalytics/models/_enums.py +1979 -0
- azure/ai/textanalytics/models/_models.py +6641 -0
- azure/ai/textanalytics/{_generated/v2022_05_01/aio → models}/_patch.py +8 -6
- azure/ai/textanalytics/py.typed +1 -0
- {azure_ai_textanalytics-5.3.0b2.dist-info → azure_ai_textanalytics-6.0.0b1.dist-info}/METADATA +668 -403
- azure_ai_textanalytics-6.0.0b1.dist-info/RECORD +29 -0
- {azure_ai_textanalytics-5.3.0b2.dist-info → azure_ai_textanalytics-6.0.0b1.dist-info}/WHEEL +1 -1
- azure/ai/textanalytics/_base_client.py +0 -113
- azure/ai/textanalytics/_check.py +0 -22
- azure/ai/textanalytics/_dict_mixin.py +0 -57
- azure/ai/textanalytics/_generated/__init__.py +0 -16
- azure/ai/textanalytics/_generated/_configuration.py +0 -70
- azure/ai/textanalytics/_generated/_operations_mixin.py +0 -795
- azure/ai/textanalytics/_generated/_text_analytics_client.py +0 -126
- azure/ai/textanalytics/_generated/_version.py +0 -8
- azure/ai/textanalytics/_generated/aio/_configuration.py +0 -66
- azure/ai/textanalytics/_generated/aio/_operations_mixin.py +0 -776
- azure/ai/textanalytics/_generated/aio/_text_analytics_client.py +0 -124
- azure/ai/textanalytics/_generated/models.py +0 -8
- azure/ai/textanalytics/_generated/v2022_05_01/__init__.py +0 -20
- azure/ai/textanalytics/_generated/v2022_05_01/_configuration.py +0 -72
- azure/ai/textanalytics/_generated/v2022_05_01/_text_analytics_client.py +0 -100
- azure/ai/textanalytics/_generated/v2022_05_01/_vendor.py +0 -45
- azure/ai/textanalytics/_generated/v2022_05_01/aio/__init__.py +0 -20
- azure/ai/textanalytics/_generated/v2022_05_01/aio/_configuration.py +0 -71
- azure/ai/textanalytics/_generated/v2022_05_01/aio/_text_analytics_client.py +0 -97
- azure/ai/textanalytics/_generated/v2022_05_01/aio/operations/__init__.py +0 -18
- azure/ai/textanalytics/_generated/v2022_05_01/aio/operations/_patch.py +0 -121
- azure/ai/textanalytics/_generated/v2022_05_01/aio/operations/_text_analytics_client_operations.py +0 -603
- azure/ai/textanalytics/_generated/v2022_05_01/models/__init__.py +0 -281
- azure/ai/textanalytics/_generated/v2022_05_01/models/_models_py3.py +0 -5722
- azure/ai/textanalytics/_generated/v2022_05_01/models/_text_analytics_client_enums.py +0 -439
- azure/ai/textanalytics/_generated/v2022_05_01/operations/_patch.py +0 -120
- azure/ai/textanalytics/_generated/v2022_05_01/operations/_text_analytics_client_operations.py +0 -744
- azure/ai/textanalytics/_generated/v2022_10_01_preview/__init__.py +0 -20
- azure/ai/textanalytics/_generated/v2022_10_01_preview/_configuration.py +0 -72
- azure/ai/textanalytics/_generated/v2022_10_01_preview/_patch.py +0 -19
- azure/ai/textanalytics/_generated/v2022_10_01_preview/_text_analytics_client.py +0 -100
- azure/ai/textanalytics/_generated/v2022_10_01_preview/_vendor.py +0 -45
- azure/ai/textanalytics/_generated/v2022_10_01_preview/aio/__init__.py +0 -20
- azure/ai/textanalytics/_generated/v2022_10_01_preview/aio/_configuration.py +0 -71
- azure/ai/textanalytics/_generated/v2022_10_01_preview/aio/_patch.py +0 -19
- azure/ai/textanalytics/_generated/v2022_10_01_preview/aio/_text_analytics_client.py +0 -97
- azure/ai/textanalytics/_generated/v2022_10_01_preview/aio/_vendor.py +0 -27
- azure/ai/textanalytics/_generated/v2022_10_01_preview/aio/operations/_patch.py +0 -121
- azure/ai/textanalytics/_generated/v2022_10_01_preview/aio/operations/_text_analytics_client_operations.py +0 -603
- azure/ai/textanalytics/_generated/v2022_10_01_preview/models/__init__.py +0 -405
- azure/ai/textanalytics/_generated/v2022_10_01_preview/models/_models_py3.py +0 -8420
- azure/ai/textanalytics/_generated/v2022_10_01_preview/models/_patch.py +0 -486
- azure/ai/textanalytics/_generated/v2022_10_01_preview/models/_text_analytics_client_enums.py +0 -729
- azure/ai/textanalytics/_generated/v2022_10_01_preview/operations/__init__.py +0 -18
- azure/ai/textanalytics/_generated/v2022_10_01_preview/operations/_patch.py +0 -120
- azure/ai/textanalytics/_generated/v2022_10_01_preview/operations/_text_analytics_client_operations.py +0 -744
- azure/ai/textanalytics/_generated/v3_0/__init__.py +0 -20
- azure/ai/textanalytics/_generated/v3_0/_configuration.py +0 -66
- azure/ai/textanalytics/_generated/v3_0/_patch.py +0 -31
- azure/ai/textanalytics/_generated/v3_0/_text_analytics_client.py +0 -96
- azure/ai/textanalytics/_generated/v3_0/_vendor.py +0 -33
- azure/ai/textanalytics/_generated/v3_0/aio/__init__.py +0 -20
- azure/ai/textanalytics/_generated/v3_0/aio/_configuration.py +0 -65
- azure/ai/textanalytics/_generated/v3_0/aio/_patch.py +0 -31
- azure/ai/textanalytics/_generated/v3_0/aio/_text_analytics_client.py +0 -93
- azure/ai/textanalytics/_generated/v3_0/aio/_vendor.py +0 -27
- azure/ai/textanalytics/_generated/v3_0/aio/operations/__init__.py +0 -18
- azure/ai/textanalytics/_generated/v3_0/aio/operations/_patch.py +0 -19
- azure/ai/textanalytics/_generated/v3_0/aio/operations/_text_analytics_client_operations.py +0 -428
- azure/ai/textanalytics/_generated/v3_0/models/__init__.py +0 -81
- azure/ai/textanalytics/_generated/v3_0/models/_models_py3.py +0 -1467
- azure/ai/textanalytics/_generated/v3_0/models/_patch.py +0 -19
- azure/ai/textanalytics/_generated/v3_0/models/_text_analytics_client_enums.py +0 -58
- azure/ai/textanalytics/_generated/v3_0/operations/__init__.py +0 -18
- azure/ai/textanalytics/_generated/v3_0/operations/_patch.py +0 -19
- azure/ai/textanalytics/_generated/v3_0/operations/_text_analytics_client_operations.py +0 -604
- azure/ai/textanalytics/_generated/v3_1/__init__.py +0 -20
- azure/ai/textanalytics/_generated/v3_1/_configuration.py +0 -66
- azure/ai/textanalytics/_generated/v3_1/_patch.py +0 -31
- azure/ai/textanalytics/_generated/v3_1/_text_analytics_client.py +0 -98
- azure/ai/textanalytics/_generated/v3_1/_vendor.py +0 -45
- azure/ai/textanalytics/_generated/v3_1/aio/__init__.py +0 -20
- azure/ai/textanalytics/_generated/v3_1/aio/_configuration.py +0 -65
- azure/ai/textanalytics/_generated/v3_1/aio/_patch.py +0 -31
- azure/ai/textanalytics/_generated/v3_1/aio/_text_analytics_client.py +0 -95
- azure/ai/textanalytics/_generated/v3_1/aio/_vendor.py +0 -27
- azure/ai/textanalytics/_generated/v3_1/aio/operations/__init__.py +0 -18
- azure/ai/textanalytics/_generated/v3_1/aio/operations/_patch.py +0 -19
- azure/ai/textanalytics/_generated/v3_1/aio/operations/_text_analytics_client_operations.py +0 -1291
- azure/ai/textanalytics/_generated/v3_1/models/__init__.py +0 -205
- azure/ai/textanalytics/_generated/v3_1/models/_models_py3.py +0 -3976
- azure/ai/textanalytics/_generated/v3_1/models/_patch.py +0 -19
- azure/ai/textanalytics/_generated/v3_1/models/_text_analytics_client_enums.py +0 -367
- azure/ai/textanalytics/_generated/v3_1/operations/__init__.py +0 -18
- azure/ai/textanalytics/_generated/v3_1/operations/_patch.py +0 -19
- azure/ai/textanalytics/_generated/v3_1/operations/_text_analytics_client_operations.py +0 -1709
- azure/ai/textanalytics/_lro.py +0 -553
- azure/ai/textanalytics/_models.py +0 -3158
- azure/ai/textanalytics/_policies.py +0 -66
- azure/ai/textanalytics/_request_handlers.py +0 -104
- azure/ai/textanalytics/_response_handlers.py +0 -583
- azure/ai/textanalytics/_text_analytics_client.py +0 -2081
- azure/ai/textanalytics/_user_agent.py +0 -8
- azure/ai/textanalytics/_validate.py +0 -113
- azure/ai/textanalytics/aio/_base_client_async.py +0 -98
- azure/ai/textanalytics/aio/_lro_async.py +0 -503
- azure/ai/textanalytics/aio/_response_handlers_async.py +0 -94
- azure/ai/textanalytics/aio/_text_analytics_client_async.py +0 -2077
- azure_ai_textanalytics-5.3.0b2.dist-info/RECORD +0 -115
- {azure_ai_textanalytics-5.3.0b2.dist-info → azure_ai_textanalytics-6.0.0b1.dist-info/licenses}/LICENSE +0 -0
- {azure_ai_textanalytics-5.3.0b2.dist-info → azure_ai_textanalytics-6.0.0b1.dist-info}/top_level.txt +0 -0
|
@@ -1,199 +1,32 @@
|
|
|
1
|
-
#
|
|
2
|
-
#
|
|
3
|
-
#
|
|
4
|
-
#
|
|
1
|
+
# coding=utf-8
|
|
2
|
+
# --------------------------------------------------------------------------
|
|
3
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
# Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
+
# Code generated by Microsoft (R) Python Code Generator.
|
|
6
|
+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
|
+
# --------------------------------------------------------------------------
|
|
8
|
+
# pylint: disable=wrong-import-position
|
|
5
9
|
|
|
6
|
-
from
|
|
10
|
+
from typing import TYPE_CHECKING
|
|
11
|
+
|
|
12
|
+
if TYPE_CHECKING:
|
|
13
|
+
from ._patch import * # pylint: disable=unused-wildcard-import
|
|
14
|
+
|
|
15
|
+
from ._client import TextAnalysisClient # type: ignore
|
|
7
16
|
from ._version import VERSION
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
RecognizeEntitiesResult,
|
|
18
|
-
DetectLanguageResult,
|
|
19
|
-
TextAnalyticsError,
|
|
20
|
-
TextAnalyticsWarning,
|
|
21
|
-
ExtractKeyPhrasesResult,
|
|
22
|
-
RecognizeLinkedEntitiesResult,
|
|
23
|
-
TextDocumentStatistics,
|
|
24
|
-
LinkedEntityMatch,
|
|
25
|
-
TextDocumentBatchStatistics,
|
|
26
|
-
SentenceSentiment,
|
|
27
|
-
SentimentConfidenceScores,
|
|
28
|
-
MinedOpinion,
|
|
29
|
-
TargetSentiment,
|
|
30
|
-
AssessmentSentiment,
|
|
31
|
-
RecognizePiiEntitiesResult,
|
|
32
|
-
PiiEntity,
|
|
33
|
-
PiiEntityDomain,
|
|
34
|
-
AnalyzeHealthcareEntitiesResult,
|
|
35
|
-
HealthcareEntity,
|
|
36
|
-
HealthcareEntityDataSource,
|
|
37
|
-
RecognizeEntitiesAction,
|
|
38
|
-
RecognizeLinkedEntitiesAction,
|
|
39
|
-
RecognizePiiEntitiesAction,
|
|
40
|
-
ExtractKeyPhrasesAction,
|
|
41
|
-
_AnalyzeActionsType,
|
|
42
|
-
HealthcareRelation,
|
|
43
|
-
HealthcareRelationRole,
|
|
44
|
-
HealthcareEntityAssertion,
|
|
45
|
-
AnalyzeSentimentAction,
|
|
46
|
-
PiiEntityCategory,
|
|
47
|
-
HealthcareEntityRelation,
|
|
48
|
-
EntityConditionality,
|
|
49
|
-
EntityCertainty,
|
|
50
|
-
EntityAssociation,
|
|
51
|
-
HealthcareEntityCategory,
|
|
52
|
-
RecognizeCustomEntitiesAction,
|
|
53
|
-
RecognizeCustomEntitiesResult,
|
|
54
|
-
SingleLabelClassifyAction,
|
|
55
|
-
MultiLabelClassifyAction,
|
|
56
|
-
ClassifyDocumentResult,
|
|
57
|
-
ClassificationCategory,
|
|
58
|
-
AnalyzeHealthcareEntitiesAction,
|
|
59
|
-
TextAnalysisKind,
|
|
60
|
-
ExtractSummaryAction,
|
|
61
|
-
ExtractSummaryResult,
|
|
62
|
-
SummarySentence,
|
|
63
|
-
AbstractiveSummaryResult,
|
|
64
|
-
AbstractiveSummary,
|
|
65
|
-
SummaryContext,
|
|
66
|
-
AbstractiveSummaryAction,
|
|
67
|
-
DynamicClassificationResult,
|
|
68
|
-
)
|
|
69
|
-
from ._generated.models import (
|
|
70
|
-
HealthcareDocumentType,
|
|
71
|
-
ResolutionKind,
|
|
72
|
-
AgeResolution,
|
|
73
|
-
AreaResolution,
|
|
74
|
-
CurrencyResolution,
|
|
75
|
-
DateTimeResolution,
|
|
76
|
-
InformationResolution,
|
|
77
|
-
LengthResolution,
|
|
78
|
-
NumberResolution,
|
|
79
|
-
NumericRangeResolution,
|
|
80
|
-
OrdinalResolution,
|
|
81
|
-
SpeedResolution,
|
|
82
|
-
TemperatureResolution,
|
|
83
|
-
TemporalSpanResolution,
|
|
84
|
-
VolumeResolution,
|
|
85
|
-
WeightResolution,
|
|
86
|
-
AgeUnit,
|
|
87
|
-
AreaUnit,
|
|
88
|
-
TemporalModifier,
|
|
89
|
-
InformationUnit,
|
|
90
|
-
LengthUnit,
|
|
91
|
-
NumberKind,
|
|
92
|
-
RangeKind,
|
|
93
|
-
RelativeTo,
|
|
94
|
-
SpeedUnit,
|
|
95
|
-
TemperatureUnit,
|
|
96
|
-
VolumeUnit,
|
|
97
|
-
WeightUnit,
|
|
98
|
-
ClassificationType,
|
|
99
|
-
DateTimeSubKind,
|
|
100
|
-
)
|
|
101
|
-
from ._lro import AnalyzeHealthcareEntitiesLROPoller, AnalyzeActionsLROPoller, TextAnalysisLROPoller
|
|
17
|
+
|
|
18
|
+
__version__ = VERSION
|
|
19
|
+
|
|
20
|
+
try:
|
|
21
|
+
from ._patch import __all__ as _patch_all
|
|
22
|
+
from ._patch import *
|
|
23
|
+
except ImportError:
|
|
24
|
+
_patch_all = []
|
|
25
|
+
from ._patch import patch_sdk as _patch_sdk
|
|
102
26
|
|
|
103
27
|
__all__ = [
|
|
104
|
-
"
|
|
105
|
-
"TextAnalyticsClient",
|
|
106
|
-
"DetectLanguageInput",
|
|
107
|
-
"TextDocumentInput",
|
|
108
|
-
"DetectedLanguage",
|
|
109
|
-
"RecognizeEntitiesResult",
|
|
110
|
-
"DetectLanguageResult",
|
|
111
|
-
"CategorizedEntity",
|
|
112
|
-
"TextAnalyticsError",
|
|
113
|
-
"TextAnalyticsWarning",
|
|
114
|
-
"ExtractKeyPhrasesResult",
|
|
115
|
-
"RecognizeLinkedEntitiesResult",
|
|
116
|
-
"AnalyzeSentimentResult",
|
|
117
|
-
"TextDocumentStatistics",
|
|
118
|
-
"DocumentError",
|
|
119
|
-
"LinkedEntity",
|
|
120
|
-
"LinkedEntityMatch",
|
|
121
|
-
"TextDocumentBatchStatistics",
|
|
122
|
-
"SentenceSentiment",
|
|
123
|
-
"SentimentConfidenceScores",
|
|
124
|
-
"MinedOpinion",
|
|
125
|
-
"TargetSentiment",
|
|
126
|
-
"AssessmentSentiment",
|
|
127
|
-
"RecognizePiiEntitiesResult",
|
|
128
|
-
"PiiEntity",
|
|
129
|
-
"PiiEntityDomain",
|
|
130
|
-
"AnalyzeHealthcareEntitiesResult",
|
|
131
|
-
"HealthcareEntity",
|
|
132
|
-
"HealthcareEntityDataSource",
|
|
133
|
-
"RecognizeEntitiesAction",
|
|
134
|
-
"RecognizeLinkedEntitiesAction",
|
|
135
|
-
"RecognizePiiEntitiesAction",
|
|
136
|
-
"ExtractKeyPhrasesAction",
|
|
137
|
-
"_AnalyzeActionsType",
|
|
138
|
-
"PiiEntityCategory",
|
|
139
|
-
"HealthcareEntityRelation",
|
|
140
|
-
"HealthcareRelation",
|
|
141
|
-
"HealthcareRelationRole",
|
|
142
|
-
"HealthcareEntityAssertion",
|
|
143
|
-
"EntityConditionality",
|
|
144
|
-
"EntityCertainty",
|
|
145
|
-
"EntityAssociation",
|
|
146
|
-
"AnalyzeSentimentAction",
|
|
147
|
-
"AnalyzeHealthcareEntitiesLROPoller",
|
|
148
|
-
"AnalyzeActionsLROPoller",
|
|
149
|
-
"HealthcareEntityCategory",
|
|
150
|
-
"RecognizeCustomEntitiesAction",
|
|
151
|
-
"RecognizeCustomEntitiesResult",
|
|
152
|
-
"SingleLabelClassifyAction",
|
|
153
|
-
"MultiLabelClassifyAction",
|
|
154
|
-
"ClassifyDocumentResult",
|
|
155
|
-
"ClassificationCategory",
|
|
156
|
-
"AnalyzeHealthcareEntitiesAction",
|
|
157
|
-
"TextAnalysisLROPoller",
|
|
158
|
-
"TextAnalysisKind",
|
|
159
|
-
"ExtractSummaryAction",
|
|
160
|
-
"ExtractSummaryResult",
|
|
161
|
-
"SummarySentence",
|
|
162
|
-
"HealthcareDocumentType",
|
|
163
|
-
"ResolutionKind",
|
|
164
|
-
"AgeResolution",
|
|
165
|
-
"AreaResolution",
|
|
166
|
-
"CurrencyResolution",
|
|
167
|
-
"DateTimeResolution",
|
|
168
|
-
"InformationResolution",
|
|
169
|
-
"LengthResolution",
|
|
170
|
-
"NumberResolution",
|
|
171
|
-
"NumericRangeResolution",
|
|
172
|
-
"OrdinalResolution",
|
|
173
|
-
"SpeedResolution",
|
|
174
|
-
"TemperatureResolution",
|
|
175
|
-
"TemporalSpanResolution",
|
|
176
|
-
"VolumeResolution",
|
|
177
|
-
"WeightResolution",
|
|
178
|
-
"AgeUnit",
|
|
179
|
-
"AreaUnit",
|
|
180
|
-
"TemporalModifier",
|
|
181
|
-
"InformationUnit",
|
|
182
|
-
"LengthUnit",
|
|
183
|
-
"NumberKind",
|
|
184
|
-
"RangeKind",
|
|
185
|
-
"RelativeTo",
|
|
186
|
-
"SpeedUnit",
|
|
187
|
-
"TemperatureUnit",
|
|
188
|
-
"VolumeUnit",
|
|
189
|
-
"WeightUnit",
|
|
190
|
-
"AbstractiveSummaryResult",
|
|
191
|
-
"AbstractiveSummary",
|
|
192
|
-
"SummaryContext",
|
|
193
|
-
"AbstractiveSummaryAction",
|
|
194
|
-
"ClassificationType",
|
|
195
|
-
"DynamicClassificationResult",
|
|
196
|
-
"DateTimeSubKind",
|
|
28
|
+
"TextAnalysisClient",
|
|
197
29
|
]
|
|
30
|
+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
|
|
198
31
|
|
|
199
|
-
|
|
32
|
+
_patch_sdk()
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# pylint: disable=line-too-long,useless-suppression
|
|
2
|
+
# coding=utf-8
|
|
3
|
+
# --------------------------------------------------------------------------
|
|
4
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
+
# Licensed under the MIT License. See License.txt in the project root for license information.
|
|
6
|
+
# Code generated by Microsoft (R) Python Code Generator.
|
|
7
|
+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
8
|
+
# --------------------------------------------------------------------------
|
|
9
|
+
|
|
10
|
+
from copy import deepcopy
|
|
11
|
+
from typing import Any, TYPE_CHECKING, Union
|
|
12
|
+
from typing_extensions import Self
|
|
13
|
+
|
|
14
|
+
from azure.core import PipelineClient
|
|
15
|
+
from azure.core.credentials import AzureKeyCredential
|
|
16
|
+
from azure.core.pipeline import policies
|
|
17
|
+
from azure.core.rest import HttpRequest, HttpResponse
|
|
18
|
+
|
|
19
|
+
from ._configuration import TextAnalysisClientConfiguration
|
|
20
|
+
from ._operations import _TextAnalysisClientOperationsMixin
|
|
21
|
+
from ._utils.serialization import Deserializer, Serializer
|
|
22
|
+
|
|
23
|
+
if TYPE_CHECKING:
|
|
24
|
+
from azure.core.credentials import TokenCredential
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class TextAnalysisClient(_TextAnalysisClientOperationsMixin):
|
|
28
|
+
"""The language service API is a suite of natural language processing (NLP) skills built with
|
|
29
|
+
best-in-class Microsoft machine learning algorithms. The API can be used to analyze
|
|
30
|
+
unstructured text for tasks such as sentiment analysis, key phrase extraction, language
|
|
31
|
+
detection and question answering. Further documentation can be found in <a
|
|
32
|
+
href=\\"`https://learn.microsoft.com/azure/cognitive-services/language-service/overview\\">https://learn.microsoft.com/azure/cognitive-services/language-service/overview
|
|
33
|
+
<https://learn.microsoft.com/azure/cognitive-services/language-service/overview\\">https://learn.microsoft.com/azure/cognitive-services/language-service/overview>`_</a>.0.
|
|
34
|
+
|
|
35
|
+
:param endpoint: Supported Cognitive Services endpoint (e.g.,
|
|
36
|
+
https://<resource-name>.api.cognitiveservices.azure.com). Required.
|
|
37
|
+
:type endpoint: str
|
|
38
|
+
:param credential: Credential used to authenticate requests to the service. Is either a key
|
|
39
|
+
credential type or a token credential type. Required.
|
|
40
|
+
:type credential: ~azure.core.credentials.AzureKeyCredential or
|
|
41
|
+
~azure.core.credentials.TokenCredential
|
|
42
|
+
:keyword api_version: The API version to use for this operation. Default value is
|
|
43
|
+
"2025-05-15-preview". Note that overriding this default value may result in unsupported
|
|
44
|
+
behavior.
|
|
45
|
+
:paramtype api_version: str
|
|
46
|
+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
|
47
|
+
Retry-After header is present.
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None:
|
|
51
|
+
_endpoint = "{Endpoint}/language"
|
|
52
|
+
self._config = TextAnalysisClientConfiguration(endpoint=endpoint, credential=credential, **kwargs)
|
|
53
|
+
|
|
54
|
+
_policies = kwargs.pop("policies", None)
|
|
55
|
+
if _policies is None:
|
|
56
|
+
_policies = [
|
|
57
|
+
policies.RequestIdPolicy(**kwargs),
|
|
58
|
+
self._config.headers_policy,
|
|
59
|
+
self._config.user_agent_policy,
|
|
60
|
+
self._config.proxy_policy,
|
|
61
|
+
policies.ContentDecodePolicy(**kwargs),
|
|
62
|
+
self._config.redirect_policy,
|
|
63
|
+
self._config.retry_policy,
|
|
64
|
+
self._config.authentication_policy,
|
|
65
|
+
self._config.custom_hook_policy,
|
|
66
|
+
self._config.logging_policy,
|
|
67
|
+
policies.DistributedTracingPolicy(**kwargs),
|
|
68
|
+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
|
|
69
|
+
self._config.http_logging_policy,
|
|
70
|
+
]
|
|
71
|
+
self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
|
|
72
|
+
|
|
73
|
+
self._serialize = Serializer()
|
|
74
|
+
self._deserialize = Deserializer()
|
|
75
|
+
self._serialize.client_side_validation = False
|
|
76
|
+
|
|
77
|
+
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
|
|
78
|
+
"""Runs the network request through the client's chained policies.
|
|
79
|
+
|
|
80
|
+
>>> from azure.core.rest import HttpRequest
|
|
81
|
+
>>> request = HttpRequest("GET", "https://www.example.org/")
|
|
82
|
+
<HttpRequest [GET], url: 'https://www.example.org/'>
|
|
83
|
+
>>> response = client.send_request(request)
|
|
84
|
+
<HttpResponse: 200 OK>
|
|
85
|
+
|
|
86
|
+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
|
|
87
|
+
|
|
88
|
+
:param request: The network request you want to make. Required.
|
|
89
|
+
:type request: ~azure.core.rest.HttpRequest
|
|
90
|
+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
|
|
91
|
+
:return: The response of your network call. Does not do error handling on your response.
|
|
92
|
+
:rtype: ~azure.core.rest.HttpResponse
|
|
93
|
+
"""
|
|
94
|
+
|
|
95
|
+
request_copy = deepcopy(request)
|
|
96
|
+
path_format_arguments = {
|
|
97
|
+
"Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True),
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
|
|
101
|
+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
|
|
102
|
+
|
|
103
|
+
def close(self) -> None:
|
|
104
|
+
self._client.close()
|
|
105
|
+
|
|
106
|
+
def __enter__(self) -> Self:
|
|
107
|
+
self._client.__enter__()
|
|
108
|
+
return self
|
|
109
|
+
|
|
110
|
+
def __exit__(self, *exc_details: Any) -> None:
|
|
111
|
+
self._client.__exit__(*exc_details)
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# coding=utf-8
|
|
2
|
+
# --------------------------------------------------------------------------
|
|
3
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
# Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
+
# Code generated by Microsoft (R) Python Code Generator.
|
|
6
|
+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
|
+
# --------------------------------------------------------------------------
|
|
8
|
+
|
|
9
|
+
from typing import Any, TYPE_CHECKING, Union
|
|
10
|
+
|
|
11
|
+
from azure.core.credentials import AzureKeyCredential
|
|
12
|
+
from azure.core.pipeline import policies
|
|
13
|
+
|
|
14
|
+
from ._version import VERSION
|
|
15
|
+
|
|
16
|
+
if TYPE_CHECKING:
|
|
17
|
+
from azure.core.credentials import TokenCredential
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class TextAnalysisClientConfiguration: # pylint: disable=too-many-instance-attributes
|
|
21
|
+
"""Configuration for TextAnalysisClient.
|
|
22
|
+
|
|
23
|
+
Note that all parameters used to create this instance are saved as instance
|
|
24
|
+
attributes.
|
|
25
|
+
|
|
26
|
+
:param endpoint: Supported Cognitive Services endpoint (e.g.,
|
|
27
|
+
https://<resource-name>.api.cognitiveservices.azure.com). Required.
|
|
28
|
+
:type endpoint: str
|
|
29
|
+
:param credential: Credential used to authenticate requests to the service. Is either a key
|
|
30
|
+
credential type or a token credential type. Required.
|
|
31
|
+
:type credential: ~azure.core.credentials.AzureKeyCredential or
|
|
32
|
+
~azure.core.credentials.TokenCredential
|
|
33
|
+
:keyword api_version: The API version to use for this operation. Default value is
|
|
34
|
+
"2025-05-15-preview". Note that overriding this default value may result in unsupported
|
|
35
|
+
behavior.
|
|
36
|
+
:paramtype api_version: str
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None:
|
|
40
|
+
api_version: str = kwargs.pop("api_version", "2025-05-15-preview")
|
|
41
|
+
|
|
42
|
+
if endpoint is None:
|
|
43
|
+
raise ValueError("Parameter 'endpoint' must not be None.")
|
|
44
|
+
if credential is None:
|
|
45
|
+
raise ValueError("Parameter 'credential' must not be None.")
|
|
46
|
+
|
|
47
|
+
self.endpoint = endpoint
|
|
48
|
+
self.credential = credential
|
|
49
|
+
self.api_version = api_version
|
|
50
|
+
self.credential_scopes = kwargs.pop("credential_scopes", ["https://cognitiveservices.azure.com/.default"])
|
|
51
|
+
kwargs.setdefault("sdk_moniker", "ai-textanalytics/{}".format(VERSION))
|
|
52
|
+
self.polling_interval = kwargs.get("polling_interval", 30)
|
|
53
|
+
self._configure(**kwargs)
|
|
54
|
+
|
|
55
|
+
def _infer_policy(self, **kwargs):
|
|
56
|
+
if isinstance(self.credential, AzureKeyCredential):
|
|
57
|
+
return policies.AzureKeyCredentialPolicy(self.credential, "Ocp-Apim-Subscription-Key", **kwargs)
|
|
58
|
+
if hasattr(self.credential, "get_token"):
|
|
59
|
+
return policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
|
|
60
|
+
raise TypeError(f"Unsupported credential: {self.credential}")
|
|
61
|
+
|
|
62
|
+
def _configure(self, **kwargs: Any) -> None:
|
|
63
|
+
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
|
|
64
|
+
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
|
|
65
|
+
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
|
|
66
|
+
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
|
|
67
|
+
self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs)
|
|
68
|
+
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
|
|
69
|
+
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
|
|
70
|
+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
|
|
71
|
+
self.authentication_policy = kwargs.get("authentication_policy")
|
|
72
|
+
if self.credential and not self.authentication_policy:
|
|
73
|
+
self.authentication_policy = self._infer_policy(**kwargs)
|
|
@@ -2,17 +2,22 @@
|
|
|
2
2
|
# --------------------------------------------------------------------------
|
|
3
3
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
4
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
-
# Code generated by Microsoft (R)
|
|
5
|
+
# Code generated by Microsoft (R) Python Code Generator.
|
|
6
6
|
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
7
|
# --------------------------------------------------------------------------
|
|
8
|
+
# pylint: disable=wrong-import-position
|
|
8
9
|
|
|
9
|
-
from
|
|
10
|
+
from typing import TYPE_CHECKING
|
|
11
|
+
|
|
12
|
+
if TYPE_CHECKING:
|
|
13
|
+
from ._patch import * # pylint: disable=unused-wildcard-import
|
|
14
|
+
|
|
15
|
+
from ._operations import _TextAnalysisClientOperationsMixin # type: ignore # pylint: disable=unused-import
|
|
10
16
|
|
|
11
17
|
from ._patch import __all__ as _patch_all
|
|
12
|
-
from ._patch import *
|
|
18
|
+
from ._patch import *
|
|
13
19
|
from ._patch import patch_sdk as _patch_sdk
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
]
|
|
17
|
-
|
|
18
|
-
_patch_sdk()
|
|
20
|
+
|
|
21
|
+
__all__ = []
|
|
22
|
+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
|
|
23
|
+
_patch_sdk()
|