-
Notifications
You must be signed in to change notification settings - Fork 248
/
Copy pathazure.ai.formrecognizer.FormTrainingClient.yml
337 lines (282 loc) · 12.3 KB
/
azure.ai.formrecognizer.FormTrainingClient.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
### YamlMime:PythonClass
uid: azure.ai.formrecognizer.FormTrainingClient
name: FormTrainingClient
fullName: azure.ai.formrecognizer.FormTrainingClient
module: azure.ai.formrecognizer
inheritances:
- azure.ai.formrecognizer._form_base_client.FormRecognizerClientBase
summary: 'FormTrainingClient is the Form Recognizer interface to use for creating
and managing custom models. It provides methods for training models on the forms
you provide, as well as methods for viewing and deleting models, accessing
account properties, copying models to another Form Recognizer resource, and
composing models from a collection of existing models trained with labels.
> [!NOTE]
> FormTrainingClient should be used with API versions <=v2.1.
>
> To use API versions 2022-08-31 and up, instantiate a DocumentModelAdministrationClient.
>'
constructor:
syntax: 'FormTrainingClient(endpoint: str, credential: AzureKeyCredential | TokenCredential,
**kwargs: Any)'
parameters:
- name: endpoint
description: 'Supported Cognitive Services endpoints (protocol and hostname,
for example: [https://westus2.api.cognitive.microsoft.com](https://westus2.api.cognitive.microsoft.com)).'
isRequired: true
types:
- <xref:str>
- name: credential
description: 'Credentials needed for the client to connect to Azure.
This is an instance of AzureKeyCredential if using an API key or a token
credential from <xref:azure.identity>.'
isRequired: true
types:
- <xref:azure.core.credentials.AzureKeyCredential>
- <xref:azure.core.credentials.TokenCredential>
- name: api_version
description: 'The API version of the service to use for requests. It defaults
to API version v2.1.
Setting to an older version may result in reduced feature compatibility. To
use the
latest supported API version and features, instantiate a DocumentModelAdministrationClient
instead.'
types:
- <xref:str>
- <xref:azure.ai.formrecognizer.FormRecognizerApiVersion>
methods:
- uid: azure.ai.formrecognizer.FormTrainingClient.begin_copy_model
name: begin_copy_model
summary: 'Copy a custom model stored in this resource (the source) to the user specified
target Form Recognizer resource. This should be called with the source Form Recognizer
resource
(with the model that is intended to be copied). The *target* parameter should
be supplied from the
target resource''s output from calling the <xref:azure.ai.formrecognizer.FormTrainingClient.get_copy_authorization>
method.'
signature: 'begin_copy_model(model_id: str, target: Dict[str, str | int], **kwargs:
Any) -> LROPoller[CustomFormModelInfo]'
parameters:
- name: model_id
description: Model identifier of the model to copy to target resource.
isRequired: true
types:
- <xref:str>
- name: target
description: 'The copy authorization generated from the target resource''s call
to
<xref:azure.ai.formrecognizer.FormTrainingClient.get_copy_authorization>.'
isRequired: true
types:
- <xref:Dict>[<xref:str>, <xref:Union>[<xref:str>, <xref:int>]]
- name: continuation_token
description: A continuation token to restart a poller from a saved state.
types:
- <xref:str>
return:
description: 'An instance of an LROPoller. Call *result()* on the poller
object to return a <xref:azure.ai.formrecognizer.CustomFormModelInfo>.'
types:
- <xref:azure.core.polling.LROPoller>[<xref:azure.ai.formrecognizer.CustomFormModelInfo>]
exceptions:
- type: azure.core.exceptions.HttpResponseError
- uid: azure.ai.formrecognizer.FormTrainingClient.begin_create_composed_model
name: begin_create_composed_model
summary: 'Creates a composed model from a collection of existing models that were
trained with labels.
A composed model allows multiple models to be called with a single model ID. When
a document is
submitted to be analyzed with a composed model ID, a classification step is first
performed to
route it to the correct custom model.
New in version v2.1: The *begin_create_composed_model* client method'
signature: 'begin_create_composed_model(model_ids: List[str], **kwargs: Any) ->
LROPoller[CustomFormModel]'
parameters:
- name: model_ids
description: List of model IDs to use in the composed model.
isRequired: true
types:
- <xref:list>[<xref:str>]
- name: model_name
description: An optional, user-defined name to associate with your model.
types:
- <xref:str>
- name: continuation_token
description: A continuation token to restart a poller from a saved state.
types:
- <xref:str>
return:
description: 'An instance of an LROPoller. Call *result()* on the poller
object to return a <xref:azure.ai.formrecognizer.CustomFormModel>.'
types:
- <xref:azure.core.polling.LROPoller>[<xref:azure.ai.formrecognizer.CustomFormModel>]
exceptions:
- type: azure.core.exceptions.HttpResponseError
- uid: azure.ai.formrecognizer.FormTrainingClient.begin_training
name: begin_training
summary: 'Create and train a custom model. The request must include a *training_files_url*
parameter that is an
externally accessible Azure storage blob container URI (preferably a Shared Access
Signature URI). Note that
a container URI (without SAS) is accepted only when the container is public or
has a managed identity
configured, see more about configuring managed identities to work with Form Recognizer
here:
[https://docs.microsoft.com/azure/applied-ai-services/form-recognizer/managed-identities](https://docs.microsoft.com/azure/applied-ai-services/form-recognizer/managed-identities).
Models are trained using documents that are of the following content type - ''application/pdf'',
''image/jpeg'', ''image/png'', ''image/tiff'', or ''image/bmp''. Other types of
content in the container is ignored.
New in version v2.1: The *model_name* keyword argument'
signature: 'begin_training(training_files_url: str, use_training_labels: bool, **kwargs:
Any) -> LROPoller[CustomFormModel]'
parameters:
- name: training_files_url
description: 'An Azure Storage blob container''s SAS URI. A container URI (without
SAS)
can be used if the container is public or has a managed identity configured.
For more information on
setting up a training data set, see: [https://aka.ms/azsdk/formrecognizer/buildtrainingset](https://aka.ms/azsdk/formrecognizer/buildtrainingset).'
isRequired: true
types:
- <xref:str>
- name: use_training_labels
description: 'Whether to train with labels or not. Corresponding labeled files
must
exist in the blob container if set to *True*.'
isRequired: true
types:
- <xref:bool>
- name: prefix
description: 'A case-sensitive prefix string to filter documents in the source
path for
training. For example, when using an Azure storage blob URI, use the prefix
to restrict sub
folders for training.'
types:
- <xref:str>
- name: include_subfolders
description: 'A flag to indicate if subfolders within the set of prefix folders
will also need to be included when searching for content to be preprocessed.
Not supported if
training with labels.'
types:
- <xref:bool>
- name: model_name
description: An optional, user-defined name to associate with your model.
types:
- <xref:str>
- name: continuation_token
description: A continuation token to restart a poller from a saved state.
types:
- <xref:str>
return:
description: 'An instance of an LROPoller. Call *result()* on the poller
object to return a <xref:azure.ai.formrecognizer.CustomFormModel>.'
types:
- <xref:azure.core.polling.LROPoller>[<xref:azure.ai.formrecognizer.CustomFormModel>]
exceptions:
- type: azure.core.exceptions.HttpResponseError
description: 'Note that if the training fails, the exception is raised, but a
model with an
"invalid" status is still created. You can delete this model by calling'
- type: azure.ai.formrecognizer.FormTrainingClient.delete_model
- uid: azure.ai.formrecognizer.FormTrainingClient.close
name: close
summary: Close the <xref:azure.ai.formrecognizer.FormTrainingClient> session.
signature: close() -> None
- uid: azure.ai.formrecognizer.FormTrainingClient.delete_model
name: delete_model
summary: 'Mark model for deletion. Model artifacts will be permanently
removed within a predetermined period.'
signature: 'delete_model(model_id: str, **kwargs: Any) -> None'
parameters:
- name: model_id
description: Model identifier.
isRequired: true
types:
- <xref:str>
return:
types:
- <xref:None>
exceptions:
- type: azure.core.exceptions.HttpResponseError
- type: azure.core.exceptions.ResourceNotFoundError
- uid: azure.ai.formrecognizer.FormTrainingClient.get_account_properties
name: get_account_properties
summary: Get information about the models on the form recognizer account.
signature: 'get_account_properties(**kwargs: Any) -> AccountProperties'
return:
description: 'Summary of models on account - custom model count,
custom model limit.'
types:
- <xref:azure.ai.formrecognizer.AccountProperties>
exceptions:
- type: azure.core.exceptions.HttpResponseError
- uid: azure.ai.formrecognizer.FormTrainingClient.get_copy_authorization
name: get_copy_authorization
summary: 'Generate authorization for copying a custom model into the target Form
Recognizer resource.
This should be called by the target resource (where the model will be copied to)
and the output can be passed as the *target* parameter into <xref:azure.ai.formrecognizer.FormTrainingClient.begin_copy_model>.'
signature: 'get_copy_authorization(resource_id: str, resource_region: str, **kwargs:
Any) -> Dict[str, str | int]'
parameters:
- name: resource_id
description: 'Azure Resource Id of the target Form Recognizer resource
where the model will be copied to.'
isRequired: true
types:
- <xref:str>
- name: resource_region
description: 'Location of the target Form Recognizer resource. A valid Azure
region name supported by Cognitive Services. For example, ''westus'', ''eastus''
etc.
See [https://azure.microsoft.com/global-infrastructure/services/?products=cognitive-services](https://azure.microsoft.com/global-infrastructure/services/?products=cognitive-services)
for the regional availability of Cognitive Services.'
isRequired: true
types:
- <xref:str>
return:
description: 'A dictionary with values for the copy authorization -
"modelId", "accessToken", "resourceId", "resourceRegion", and "expirationDateTimeTicks".'
types:
- <xref:Dict>[<xref:str>, <xref:Union>[<xref:str>, <xref:int>]]
exceptions:
- type: azure.core.exceptions.HttpResponseError
- uid: azure.ai.formrecognizer.FormTrainingClient.get_custom_model
name: get_custom_model
summary: 'Get a description of a custom model, including the types of forms
it can recognize, and the fields it will extract for each form type.'
signature: 'get_custom_model(model_id: str, **kwargs: Any) -> CustomFormModel'
parameters:
- name: model_id
description: Model identifier.
isRequired: true
types:
- <xref:str>
return:
description: CustomFormModel
types:
- <xref:azure.ai.formrecognizer.CustomFormModel>
exceptions:
- type: azure.core.exceptions.HttpResponseError
- type: azure.core.exceptions.ResourceNotFoundError
- uid: azure.ai.formrecognizer.FormTrainingClient.get_form_recognizer_client
name: get_form_recognizer_client
summary: Get an instance of a FormRecognizerClient from FormTrainingClient.
signature: 'get_form_recognizer_client(**kwargs: Any) -> FormRecognizerClient'
return:
description: A FormRecognizerClient
types:
- <xref:azure.ai.formrecognizer.FormRecognizerClient>
- uid: azure.ai.formrecognizer.FormTrainingClient.list_custom_models
name: list_custom_models
summary: 'List information for each model, including model id,
model status, and when it was created and last modified.'
signature: 'list_custom_models(**kwargs: Any) -> ItemPaged[CustomFormModelInfo]'
return:
description: ItemPaged[<xref:azure.ai.formrecognizer.CustomFormModelInfo>]
types:
- <xref:azure.core.paging.ItemPaged>
exceptions:
- type: azure.core.exceptions.HttpResponseError