@azure/ai-form-recognizer 5.0.0-alpha.20250227.1 → 5.0.0-alpha.20250303.1
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.
- package/README.md +292 -330
- package/dist/browser/documentAnalysisClient.d.ts +220 -131
- package/dist/browser/documentAnalysisClient.d.ts.map +1 -1
- package/dist/browser/documentAnalysisClient.js +57 -35
- package/dist/browser/documentAnalysisClient.js.map +1 -1
- package/dist/browser/documentModelAdministrationClient.d.ts +291 -123
- package/dist/browser/documentModelAdministrationClient.d.ts.map +1 -1
- package/dist/browser/documentModelAdministrationClient.js +184 -82
- package/dist/browser/documentModelAdministrationClient.js.map +1 -1
- package/dist/browser/lro/util/delayMs.d.ts +1 -1
- package/dist/browser/lro/util/delayMs.js +1 -1
- package/dist/browser/lro/util/delayMs.js.map +1 -1
- package/dist/commonjs/documentAnalysisClient.d.ts +220 -131
- package/dist/commonjs/documentAnalysisClient.d.ts.map +1 -1
- package/dist/commonjs/documentAnalysisClient.js +57 -35
- package/dist/commonjs/documentAnalysisClient.js.map +1 -1
- package/dist/commonjs/documentModelAdministrationClient.d.ts +291 -123
- package/dist/commonjs/documentModelAdministrationClient.d.ts.map +1 -1
- package/dist/commonjs/documentModelAdministrationClient.js +184 -82
- package/dist/commonjs/documentModelAdministrationClient.js.map +1 -1
- package/dist/commonjs/lro/util/delayMs.d.ts +1 -1
- package/dist/commonjs/lro/util/delayMs.js +1 -1
- package/dist/commonjs/lro/util/delayMs.js.map +1 -1
- package/dist/esm/documentAnalysisClient.d.ts +220 -131
- package/dist/esm/documentAnalysisClient.d.ts.map +1 -1
- package/dist/esm/documentAnalysisClient.js +57 -35
- package/dist/esm/documentAnalysisClient.js.map +1 -1
- package/dist/esm/documentModelAdministrationClient.d.ts +291 -123
- package/dist/esm/documentModelAdministrationClient.d.ts.map +1 -1
- package/dist/esm/documentModelAdministrationClient.js +184 -82
- package/dist/esm/documentModelAdministrationClient.js.map +1 -1
- package/dist/esm/lro/util/delayMs.d.ts +1 -1
- package/dist/esm/lro/util/delayMs.js +1 -1
- package/dist/esm/lro/util/delayMs.js.map +1 -1
- package/dist/react-native/documentAnalysisClient.d.ts +220 -131
- package/dist/react-native/documentAnalysisClient.d.ts.map +1 -1
- package/dist/react-native/documentAnalysisClient.js +57 -35
- package/dist/react-native/documentAnalysisClient.js.map +1 -1
- package/dist/react-native/documentModelAdministrationClient.d.ts +291 -123
- package/dist/react-native/documentModelAdministrationClient.d.ts.map +1 -1
- package/dist/react-native/documentModelAdministrationClient.js +184 -82
- package/dist/react-native/documentModelAdministrationClient.js.map +1 -1
- package/dist/react-native/lro/util/delayMs.d.ts +1 -1
- package/dist/react-native/lro/util/delayMs.js +1 -1
- package/dist/react-native/lro/util/delayMs.js.map +1 -1
- package/package.json +19 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentModelAdministrationClient.d.ts","sourceRoot":"","sources":["../../src/documentModelAdministrationClient.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAIrE,OAAO,KAAK,EACV,iBAAiB,EAEjB,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,yBAAyB,EAC1B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAGV,mBAAmB,EAGnB,wBAAwB,EAEzB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,KAAK,EACV,qBAAqB,EACrB,0BAA0B,EAC1B,wCAAwC,EACxC,2BAA2B,EAC3B,yBAAyB,EACzB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EAEtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,6CAA6C,CAAC;AACvG,OAAO,KAAK,EACV,8BAA8B,EAC9B,gCAAgC,EAChC,sBAAsB,EACvB,MAAM,gCAAgC,CAAC;AAExC,OAAO,KAAK,EAAyB,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,KAAK,EACV,mBAAmB,EACnB,qCAAqC,EAEtC,MAAM,mBAAmB,CAAC;AAE3B
|
|
1
|
+
{"version":3,"file":"documentModelAdministrationClient.d.ts","sourceRoot":"","sources":["../../src/documentModelAdministrationClient.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAIrE,OAAO,KAAK,EACV,iBAAiB,EAEjB,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,yBAAyB,EAC1B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAGV,mBAAmB,EAGnB,wBAAwB,EAEzB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,KAAK,EACV,qBAAqB,EACrB,0BAA0B,EAC1B,wCAAwC,EACxC,2BAA2B,EAC3B,yBAAyB,EACzB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EAEtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,6CAA6C,CAAC;AACvG,OAAO,KAAK,EACV,8BAA8B,EAC9B,gCAAgC,EAChC,sBAAsB,EACvB,MAAM,gCAAgC,CAAC;AAExC,OAAO,KAAK,EAAyB,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,KAAK,EACV,mBAAmB,EACnB,qCAAqC,EAEtC,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,iCAAiC;IAC5C,OAAO,CAAC,WAAW,CAAkB;IACrC,OAAO,CAAC,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;OA0CG;IACI,uBAAuB,CAE5B,OAAO,GAAE,iBAAsB,GAC9B,0BAA0B,CAAC,yBAAyB,CAAC;IAIxD;;;;;;;;;;;;;;;;;;;;OAoBG;IACI,wBAAwB,CAC7B,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,IAAI,CAAC;IAahB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACI,YAAY,CACjB,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,gBAAgB,CAAC;IAQ5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2CG;IACI,cAAc,CACnB,OAAO,GAAE,qBAA0B,GAClC,0BAA0B,CAAC,gBAAgB,CAAC;CAKhD"}
|
|
@@ -14,25 +14,27 @@ import { Mappers, SERIALIZER, makeServiceClient } from "./util.js";
|
|
|
14
14
|
*
|
|
15
15
|
* #### Azure Active Directory
|
|
16
16
|
*
|
|
17
|
-
* ```
|
|
18
|
-
* import { DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
|
|
17
|
+
* ```ts snippet:ReadmeSampleAdministrationClient_TokenCredential
|
|
19
18
|
* import { DefaultAzureCredential } from "@azure/identity";
|
|
19
|
+
* import { DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
|
|
20
20
|
*
|
|
21
|
-
* const endpoint = "https://<resource name>.cognitiveservices.azure.com";
|
|
22
21
|
* const credential = new DefaultAzureCredential();
|
|
23
|
-
*
|
|
24
|
-
*
|
|
22
|
+
* const client = new DocumentModelAdministrationClient(
|
|
23
|
+
* "https://<resource name>.cognitiveservices.azure.com",
|
|
24
|
+
* credential,
|
|
25
|
+
* );
|
|
25
26
|
* ```
|
|
26
27
|
*
|
|
27
28
|
* #### API Key (Subscription Key)
|
|
28
29
|
*
|
|
29
|
-
* ```
|
|
30
|
-
* import {
|
|
31
|
-
*
|
|
32
|
-
* const endpoint = "https://<resource name>.cognitiveservices.azure.com";
|
|
33
|
-
* const credential = new AzureKeyCredential("<api key>");
|
|
30
|
+
* ```ts snippet:ReadmeSampleAdministrationClient_KeyCredential
|
|
31
|
+
* import { AzureKeyCredential, DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
|
|
34
32
|
*
|
|
35
|
-
* const
|
|
33
|
+
* const credential = new AzureKeyCredential("<API key>");
|
|
34
|
+
* const client = new DocumentModelAdministrationClient(
|
|
35
|
+
* "https://<resource name>.cognitiveservices.azure.com",
|
|
36
|
+
* credential,
|
|
37
|
+
* );
|
|
36
38
|
* ```
|
|
37
39
|
*/
|
|
38
40
|
export class DocumentModelAdministrationClient {
|
|
@@ -65,20 +67,24 @@ export class DocumentModelAdministrationClient {
|
|
|
65
67
|
*
|
|
66
68
|
* ### Example
|
|
67
69
|
*
|
|
68
|
-
* ```
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
70
|
+
* ```ts snippet:ReadmeSampleComposeModel
|
|
71
|
+
* import { DefaultAzureCredential } from "@azure/identity";
|
|
72
|
+
* import { DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
|
|
73
|
+
*
|
|
74
|
+
* const credential = new DefaultAzureCredential();
|
|
75
|
+
* const client = new DocumentModelAdministrationClient(
|
|
76
|
+
* "https://<resource name>.cognitiveservices.azure.com",
|
|
77
|
+
* credential,
|
|
78
|
+
* );
|
|
79
|
+
*
|
|
80
|
+
* const composeModelId = "aNewComposedModel";
|
|
81
|
+
* const subModelIds = ["documentType1Model", "documentType2Model", "documentType3Model"];
|
|
75
82
|
*
|
|
76
83
|
* // The resulting composed model can classify and extract data from documents
|
|
77
84
|
* // conforming to any of the above document types
|
|
78
|
-
* const poller = await client.beginComposeDocumentModel(
|
|
79
|
-
* description: "This is a composed model that can handle several document types."
|
|
85
|
+
* const poller = await client.beginComposeDocumentModel(composeModelId, subModelIds, {
|
|
86
|
+
* description: "This is a composed model that can handle several document types.",
|
|
80
87
|
* });
|
|
81
|
-
*
|
|
82
88
|
* // Model composition, like all other model creation operations, returns a poller that eventually produces a
|
|
83
89
|
* // ModelDetails object
|
|
84
90
|
* const modelDetails = await poller.pollUntilDone();
|
|
@@ -87,7 +93,7 @@ export class DocumentModelAdministrationClient {
|
|
|
87
93
|
* modelId, // identical to the modelId given when creating the model
|
|
88
94
|
* description, // identical to the description given when creating the model
|
|
89
95
|
* createdOn, // the Date (timestamp) that the model was created
|
|
90
|
-
* docTypes // information about the document types of the composed submodels
|
|
96
|
+
* docTypes, // information about the document types of the composed submodels
|
|
91
97
|
* } = modelDetails;
|
|
92
98
|
* ```
|
|
93
99
|
*
|
|
@@ -117,7 +123,16 @@ export class DocumentModelAdministrationClient {
|
|
|
117
123
|
*
|
|
118
124
|
* ### Example
|
|
119
125
|
*
|
|
120
|
-
* ```
|
|
126
|
+
* ```ts snippet:ReadmeSampleGetCopyAuthorization
|
|
127
|
+
* import { DefaultAzureCredential } from "@azure/identity";
|
|
128
|
+
* import { DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
|
|
129
|
+
*
|
|
130
|
+
* const credential = new DefaultAzureCredential();
|
|
131
|
+
* const client = new DocumentModelAdministrationClient(
|
|
132
|
+
* "https://<resource name>.cognitiveservices.azure.com",
|
|
133
|
+
* credential,
|
|
134
|
+
* );
|
|
135
|
+
*
|
|
121
136
|
* // The copyAuthorization data structure stored below grants any cognitive services resource the right to copy a
|
|
122
137
|
* // model into the client's resource with the given destination model ID.
|
|
123
138
|
* const copyAuthorization = await client.getCopyAuthorization("<destination model ID>");
|
|
@@ -141,18 +156,26 @@ export class DocumentModelAdministrationClient {
|
|
|
141
156
|
*
|
|
142
157
|
* ### Example
|
|
143
158
|
*
|
|
144
|
-
* ```
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
* const
|
|
159
|
+
* ```ts snippet:ReadmeSampleCopyModel
|
|
160
|
+
* import { DefaultAzureCredential } from "@azure/identity";
|
|
161
|
+
* import { DocumentModelAdministrationClient, AzureKeyCredential } from "@azure/ai-form-recognizer";
|
|
162
|
+
*
|
|
163
|
+
* const credential = new DefaultAzureCredential();
|
|
164
|
+
* const client = new DocumentModelAdministrationClient(
|
|
165
|
+
* "https://<resource name>.cognitiveservices.azure.com",
|
|
166
|
+
* credential,
|
|
167
|
+
* );
|
|
149
168
|
*
|
|
150
169
|
* // We create the copy authorization using a client authenticated with the destination resource. Note that these two
|
|
151
170
|
* // resources can be the same (you can copy a model to a new ID in the same resource).
|
|
152
171
|
* const copyAuthorization = await client.getCopyAuthorization("<destination model ID>");
|
|
153
172
|
*
|
|
154
173
|
* // Finally, use the _source_ client to copy the model and await the copy operation
|
|
155
|
-
*
|
|
174
|
+
* // We need a client for the source model's resource
|
|
175
|
+
* const sourceEndpoint = "https://<source resource name>.cognitiveservices.azure.com";
|
|
176
|
+
* const sourceCredential = new AzureKeyCredential("<source api key>");
|
|
177
|
+
* const sourceClient = new DocumentModelAdministrationClient(sourceEndpoint, sourceCredential);
|
|
178
|
+
* const poller = await sourceClient.beginCopyModelTo("<source model ID>", copyAuthorization);
|
|
156
179
|
*
|
|
157
180
|
* // Model copying, like all other model creation operations, returns a poller that eventually produces a ModelDetails
|
|
158
181
|
* // object
|
|
@@ -162,7 +185,7 @@ export class DocumentModelAdministrationClient {
|
|
|
162
185
|
* modelId, // identical to the modelId given when creating the copy authorization
|
|
163
186
|
* description, // identical to the description given when creating the copy authorization
|
|
164
187
|
* createdOn, // the Date (timestamp) that the model was created
|
|
165
|
-
* docTypes // information about the document types of the model (identical to the original, source model)
|
|
188
|
+
* docTypes, // information about the document types of the model (identical to the original, source model)
|
|
166
189
|
* } = modelDetails;
|
|
167
190
|
* ```
|
|
168
191
|
*
|
|
@@ -201,32 +224,41 @@ export class DocumentModelAdministrationClient {
|
|
|
201
224
|
*
|
|
202
225
|
* ### Example
|
|
203
226
|
*
|
|
204
|
-
* ```
|
|
205
|
-
*
|
|
227
|
+
* ```ts snippet:ReadmeSampleBuildClassifier
|
|
228
|
+
* import { DefaultAzureCredential } from "@azure/identity";
|
|
229
|
+
* import { DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
|
|
230
|
+
*
|
|
231
|
+
* const credential = new DefaultAzureCredential();
|
|
232
|
+
* const client = new DocumentModelAdministrationClient(
|
|
233
|
+
* "https://<resource name>.cognitiveservices.azure.com",
|
|
234
|
+
* credential,
|
|
235
|
+
* );
|
|
236
|
+
*
|
|
237
|
+
* const newClassifiedId = "aNewClassifier";
|
|
206
238
|
* const containerUrl1 = "<training data container SAS URL 1>";
|
|
207
239
|
* const containerUrl2 = "<training data container SAS URL 2>";
|
|
208
240
|
*
|
|
209
241
|
* const poller = await client.beginBuildDocumentClassifier(
|
|
210
|
-
*
|
|
242
|
+
* newClassifiedId,
|
|
211
243
|
* {
|
|
212
244
|
* // The document types. Each entry in this object should map a document type name to a
|
|
213
245
|
* // `ClassifierDocumentTypeDetails` object
|
|
214
|
-
*
|
|
246
|
+
* formX: {
|
|
215
247
|
* azureBlobSource: {
|
|
216
248
|
* containerUrl: containerUrl1,
|
|
217
|
-
* }
|
|
249
|
+
* },
|
|
218
250
|
* },
|
|
219
|
-
*
|
|
251
|
+
* formY: {
|
|
220
252
|
* azureBlobFileListSource: {
|
|
221
253
|
* containerUrl: containerUrl2,
|
|
222
|
-
* fileList: "path/to/fileList.jsonl"
|
|
223
|
-
* }
|
|
254
|
+
* fileList: "path/to/fileList.jsonl",
|
|
255
|
+
* },
|
|
224
256
|
* },
|
|
225
257
|
* },
|
|
226
258
|
* {
|
|
227
259
|
* // Optionally, a text description may be attached to the classifier
|
|
228
|
-
* description: "This is an example classifier!"
|
|
229
|
-
* }
|
|
260
|
+
* description: "This is an example classifier!",
|
|
261
|
+
* },
|
|
230
262
|
* );
|
|
231
263
|
*
|
|
232
264
|
* // Classifier building, like model creation operations, returns a poller that eventually produces a
|
|
@@ -237,7 +269,7 @@ export class DocumentModelAdministrationClient {
|
|
|
237
269
|
* classifierId, // identical to the classifierId given when creating the classifier
|
|
238
270
|
* description, // identical to the description given when creating the classifier (if any)
|
|
239
271
|
* createdOn, // the Date (timestamp) that the classifier was created
|
|
240
|
-
* docTypes // information about the document types in the classifier and their details
|
|
272
|
+
* docTypes, // information about the document types in the classifier and their details
|
|
241
273
|
* } = classifierDetails;
|
|
242
274
|
* ```
|
|
243
275
|
*
|
|
@@ -351,15 +383,24 @@ export class DocumentModelAdministrationClient {
|
|
|
351
383
|
*
|
|
352
384
|
* ### Example
|
|
353
385
|
*
|
|
354
|
-
* ```
|
|
386
|
+
* ```ts snippet:ReadmeSampleGetResourceDetails
|
|
387
|
+
* import { DefaultAzureCredential } from "@azure/identity";
|
|
388
|
+
* import { DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
|
|
389
|
+
*
|
|
390
|
+
* const credential = new DefaultAzureCredential();
|
|
391
|
+
* const client = new DocumentModelAdministrationClient(
|
|
392
|
+
* "https://<resource name>.cognitiveservices.azure.com",
|
|
393
|
+
* credential,
|
|
394
|
+
* );
|
|
395
|
+
*
|
|
355
396
|
* const {
|
|
356
397
|
* // Information about the custom models in the current resource
|
|
357
|
-
*
|
|
398
|
+
* customDocumentModels: {
|
|
358
399
|
* // The number of custom models in the current resource
|
|
359
400
|
* count,
|
|
360
401
|
* // The maximum number of models that the current resource can support
|
|
361
|
-
* limit
|
|
362
|
-
* }
|
|
402
|
+
* limit,
|
|
403
|
+
* },
|
|
363
404
|
* } = await client.getResourceDetails();
|
|
364
405
|
* ```
|
|
365
406
|
*
|
|
@@ -383,9 +424,18 @@ export class DocumentModelAdministrationClient {
|
|
|
383
424
|
*
|
|
384
425
|
* ### Example
|
|
385
426
|
*
|
|
386
|
-
* ```
|
|
427
|
+
* ```ts snippet:ReadmeSampleGetModel
|
|
428
|
+
* import { DefaultAzureCredential } from "@azure/identity";
|
|
429
|
+
* import { DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
|
|
430
|
+
*
|
|
431
|
+
* const credential = new DefaultAzureCredential();
|
|
432
|
+
* const client = new DocumentModelAdministrationClient(
|
|
433
|
+
* "https://<resource name>.cognitiveservices.azure.com",
|
|
434
|
+
* credential,
|
|
435
|
+
* );
|
|
436
|
+
*
|
|
387
437
|
* // The ID of the prebuilt business card model
|
|
388
|
-
* const
|
|
438
|
+
* const prebuiltModelId = "prebuilt-businessCard";
|
|
389
439
|
*
|
|
390
440
|
* const {
|
|
391
441
|
* modelId, // identical to the modelId given when calling `getDocumentModel`
|
|
@@ -396,15 +446,15 @@ export class DocumentModelAdministrationClient {
|
|
|
396
446
|
* // the document type of the prebuilt business card model
|
|
397
447
|
* "prebuilt:businesscard": {
|
|
398
448
|
* // an optional, textual description of this document type
|
|
399
|
-
* description,
|
|
449
|
+
* description: businessCardDescription,
|
|
400
450
|
* // the schema of the fields in this document type, see the FieldSchema type
|
|
401
451
|
* fieldSchema,
|
|
402
452
|
* // the service's confidences in the fields (an object with field names as properties and numeric confidence
|
|
403
453
|
* // values)
|
|
404
|
-
* fieldConfidence
|
|
405
|
-
* }
|
|
406
|
-
* }
|
|
407
|
-
* } = await client.getDocumentModel(
|
|
454
|
+
* fieldConfidence,
|
|
455
|
+
* },
|
|
456
|
+
* },
|
|
457
|
+
* } = await client.getDocumentModel(prebuiltModelId);
|
|
408
458
|
* ```
|
|
409
459
|
*
|
|
410
460
|
* @param modelId - the unique ID of the model to query
|
|
@@ -436,7 +486,17 @@ export class DocumentModelAdministrationClient {
|
|
|
436
486
|
*
|
|
437
487
|
* #### Async Iteration
|
|
438
488
|
*
|
|
439
|
-
* ```
|
|
489
|
+
* ```ts snippet:ReadmeSampleListModels
|
|
490
|
+
* import { DefaultAzureCredential } from "@azure/identity";
|
|
491
|
+
* import { DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
|
|
492
|
+
*
|
|
493
|
+
* const credential = new DefaultAzureCredential();
|
|
494
|
+
* const client = new DocumentModelAdministrationClient(
|
|
495
|
+
* "https://<resource name>.cognitiveservices.azure.com",
|
|
496
|
+
* credential,
|
|
497
|
+
* );
|
|
498
|
+
*
|
|
499
|
+
* // Iterate over all models in the current resource
|
|
440
500
|
* for await (const summary of client.listDocumentModels()) {
|
|
441
501
|
* const {
|
|
442
502
|
* modelId, // The model's unique ID
|
|
@@ -446,17 +506,13 @@ export class DocumentModelAdministrationClient {
|
|
|
446
506
|
* // You can get the full model info using `getDocumentModel`
|
|
447
507
|
* const model = await client.getDocumentModel(modelId);
|
|
448
508
|
* }
|
|
449
|
-
* ```
|
|
450
|
-
*
|
|
451
|
-
* #### By Page
|
|
452
509
|
*
|
|
453
|
-
* ```javascript
|
|
454
510
|
* // The listDocumentModels method is paged, and you can iterate by page using the `byPage` method.
|
|
455
511
|
* const pages = client.listDocumentModels().byPage();
|
|
456
512
|
*
|
|
457
513
|
* for await (const page of pages) {
|
|
458
514
|
* // Each page is an array of models and can be iterated synchronously
|
|
459
|
-
* for (const
|
|
515
|
+
* for (const summary of page) {
|
|
460
516
|
* const {
|
|
461
517
|
* modelId, // The model's unique ID
|
|
462
518
|
* description, // a textual description of the model, if provided during model creation
|
|
@@ -481,8 +537,17 @@ export class DocumentModelAdministrationClient {
|
|
|
481
537
|
*
|
|
482
538
|
* ### Example
|
|
483
539
|
*
|
|
484
|
-
* ```
|
|
485
|
-
*
|
|
540
|
+
* ```ts snippet:ReadmeSampleDeleteModel
|
|
541
|
+
* import { DefaultAzureCredential } from "@azure/identity";
|
|
542
|
+
* import { DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
|
|
543
|
+
*
|
|
544
|
+
* const credential = new DefaultAzureCredential();
|
|
545
|
+
* const client = new DocumentModelAdministrationClient(
|
|
546
|
+
* "https://<resource name>.cognitiveservices.azure.com",
|
|
547
|
+
* credential,
|
|
548
|
+
* );
|
|
549
|
+
*
|
|
550
|
+
* await client.deleteDocumentModel("<model ID to delete>");
|
|
486
551
|
* ```
|
|
487
552
|
*
|
|
488
553
|
* @param modelId - the unique ID of the model to delete from the resource
|
|
@@ -498,21 +563,30 @@ export class DocumentModelAdministrationClient {
|
|
|
498
563
|
*
|
|
499
564
|
* ### Example
|
|
500
565
|
*
|
|
501
|
-
* ```
|
|
502
|
-
*
|
|
566
|
+
* ```ts snippet:ReadmeSampleGetClassifier
|
|
567
|
+
* import { DefaultAzureCredential } from "@azure/identity";
|
|
568
|
+
* import { DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
|
|
569
|
+
*
|
|
570
|
+
* const credential = new DefaultAzureCredential();
|
|
571
|
+
* const client = new DocumentModelAdministrationClient(
|
|
572
|
+
* "https://<resource name>.cognitiveservices.azure.com",
|
|
573
|
+
* credential,
|
|
574
|
+
* );
|
|
575
|
+
*
|
|
576
|
+
* const foundClassifier = "<classifier ID>";
|
|
503
577
|
*
|
|
504
578
|
* const {
|
|
505
579
|
* classifierId, // identical to the ID given when calling `getDocumentClassifier`
|
|
506
580
|
* description, // a textual description of the classifier, if provided during classifier creation
|
|
507
581
|
* createdOn, // the Date (timestamp) that the classifier was created
|
|
508
582
|
* // information about the document types in the classifier and their corresponding traning data
|
|
509
|
-
* docTypes
|
|
510
|
-
* } = await client.getDocumentClassifier(
|
|
583
|
+
* docTypes,
|
|
584
|
+
* } = await client.getDocumentClassifier(foundClassifier);
|
|
511
585
|
*
|
|
512
586
|
* // The `docTypes` property is a map of document type names to information about the training data
|
|
513
587
|
* // for that document type.
|
|
514
588
|
* for (const [docTypeName, classifierDocTypeDetails] of Object.entries(docTypes)) {
|
|
515
|
-
*
|
|
589
|
+
* console.log(`- '${docTypeName}': `, classifierDocTypeDetails);
|
|
516
590
|
* }
|
|
517
591
|
* ```
|
|
518
592
|
*
|
|
@@ -530,7 +604,16 @@ export class DocumentModelAdministrationClient {
|
|
|
530
604
|
*
|
|
531
605
|
* #### Async Iteration
|
|
532
606
|
*
|
|
533
|
-
* ```
|
|
607
|
+
* ```ts snippet:ReadmeSampleListClassifiers
|
|
608
|
+
* import { DefaultAzureCredential } from "@azure/identity";
|
|
609
|
+
* import { DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
|
|
610
|
+
*
|
|
611
|
+
* const credential = new DefaultAzureCredential();
|
|
612
|
+
* const client = new DocumentModelAdministrationClient(
|
|
613
|
+
* "https://<resource name>.cognitiveservices.azure.com",
|
|
614
|
+
* credential,
|
|
615
|
+
* );
|
|
616
|
+
*
|
|
534
617
|
* for await (const details of client.listDocumentClassifiers()) {
|
|
535
618
|
* const {
|
|
536
619
|
* classifierId, // The classifier's unique ID
|
|
@@ -538,11 +621,7 @@ export class DocumentModelAdministrationClient {
|
|
|
538
621
|
* docTypes, // information about the document types in the classifier and their corresponding traning data
|
|
539
622
|
* } = details;
|
|
540
623
|
* }
|
|
541
|
-
* ```
|
|
542
624
|
*
|
|
543
|
-
* #### By Page
|
|
544
|
-
*
|
|
545
|
-
* ```javascript
|
|
546
625
|
* // The listDocumentClassifiers method is paged, and you can iterate by page using the `byPage` method.
|
|
547
626
|
* const pages = client.listDocumentClassifiers().byPage();
|
|
548
627
|
*
|
|
@@ -571,8 +650,17 @@ export class DocumentModelAdministrationClient {
|
|
|
571
650
|
*
|
|
572
651
|
* ### Example
|
|
573
652
|
*
|
|
574
|
-
* ```
|
|
575
|
-
*
|
|
653
|
+
* ```ts snippet:ReadmeSampleDeleteClassifier
|
|
654
|
+
* import { DefaultAzureCredential } from "@azure/identity";
|
|
655
|
+
* import { DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
|
|
656
|
+
*
|
|
657
|
+
* const credential = new DefaultAzureCredential();
|
|
658
|
+
* const client = new DocumentModelAdministrationClient(
|
|
659
|
+
* "https://<resource name>.cognitiveservices.azure.com",
|
|
660
|
+
* credential,
|
|
661
|
+
* );
|
|
662
|
+
*
|
|
663
|
+
* await client.deleteDocumentClassifier("<classifier ID to delete>");
|
|
576
664
|
* ```
|
|
577
665
|
*
|
|
578
666
|
* @param classifierId - the unique ID of the classifier to delete from the resource
|
|
@@ -594,9 +682,18 @@ export class DocumentModelAdministrationClient {
|
|
|
594
682
|
*
|
|
595
683
|
* ### Example
|
|
596
684
|
*
|
|
597
|
-
* ```
|
|
685
|
+
* ```ts snippet:ReadmeSampleGetOperation
|
|
686
|
+
* import { DefaultAzureCredential } from "@azure/identity";
|
|
687
|
+
* import { DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
|
|
688
|
+
*
|
|
689
|
+
* const credential = new DefaultAzureCredential();
|
|
690
|
+
* const client = new DocumentModelAdministrationClient(
|
|
691
|
+
* "https://<resource name>.cognitiveservices.azure.com",
|
|
692
|
+
* credential,
|
|
693
|
+
* );
|
|
694
|
+
*
|
|
598
695
|
* // The ID of the operation, which should be a GUID
|
|
599
|
-
* const
|
|
696
|
+
* const findOperationId = "<operation GUID>";
|
|
600
697
|
*
|
|
601
698
|
* const {
|
|
602
699
|
* operationId, // identical to the operationId given when calling `getOperation`
|
|
@@ -605,7 +702,7 @@ export class DocumentModelAdministrationClient {
|
|
|
605
702
|
* percentCompleted, // a number between 0 and 100 representing the progress of the operation
|
|
606
703
|
* createdOn, // a Date object that reflects the time when the operation was started
|
|
607
704
|
* lastUpdatedOn, // a Date object that reflects the time when the operation state was last modified
|
|
608
|
-
* } = await client.getOperation(
|
|
705
|
+
* } = await client.getOperation(findOperationId);
|
|
609
706
|
* ```
|
|
610
707
|
*/
|
|
611
708
|
getOperation(operationId, options = {}) {
|
|
@@ -619,19 +716,24 @@ export class DocumentModelAdministrationClient {
|
|
|
619
716
|
*
|
|
620
717
|
* #### Async Iteration
|
|
621
718
|
*
|
|
622
|
-
* ```
|
|
719
|
+
* ```ts snippet:ReadmeSampleListOperations
|
|
720
|
+
* import { DefaultAzureCredential } from "@azure/identity";
|
|
721
|
+
* import { DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
|
|
722
|
+
*
|
|
723
|
+
* const credential = new DefaultAzureCredential();
|
|
724
|
+
* const client = new DocumentModelAdministrationClient(
|
|
725
|
+
* "https://<resource name>.cognitiveservices.azure.com",
|
|
726
|
+
* credential,
|
|
727
|
+
* );
|
|
728
|
+
*
|
|
623
729
|
* for await (const operation of client.listOperations()) {
|
|
624
730
|
* const {
|
|
625
731
|
* operationId, // the operation's GUID
|
|
626
732
|
* status, // the operation status, one of "notStarted", "running", "succeeded", "failed", or "canceled"
|
|
627
|
-
* percentCompleted // the progress of the operation, from 0 to 100
|
|
733
|
+
* percentCompleted, // the progress of the operation, from 0 to 100
|
|
628
734
|
* } = operation;
|
|
629
735
|
* }
|
|
630
|
-
* ```
|
|
631
|
-
*
|
|
632
|
-
* #### By Page
|
|
633
736
|
*
|
|
634
|
-
* ```javascript
|
|
635
737
|
* // The listOperations method is paged, and you can iterate by page using the `byPage` method.
|
|
636
738
|
* const pages = client.listOperations().byPage();
|
|
637
739
|
*
|
|
@@ -641,7 +743,7 @@ export class DocumentModelAdministrationClient {
|
|
|
641
743
|
* const {
|
|
642
744
|
* operationId, // the operation's GUID
|
|
643
745
|
* status, // the operation status, one of "notStarted", "running", "succeeded", "failed", or "canceled"
|
|
644
|
-
* percentCompleted // the progress of the operation, from 0 to 100
|
|
746
|
+
* percentCompleted, // the progress of the operation, from 0 to 100
|
|
645
747
|
* } = operation;
|
|
646
748
|
* }
|
|
647
749
|
* }
|