@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.
Files changed (46) hide show
  1. package/README.md +292 -330
  2. package/dist/browser/documentAnalysisClient.d.ts +220 -131
  3. package/dist/browser/documentAnalysisClient.d.ts.map +1 -1
  4. package/dist/browser/documentAnalysisClient.js +57 -35
  5. package/dist/browser/documentAnalysisClient.js.map +1 -1
  6. package/dist/browser/documentModelAdministrationClient.d.ts +291 -123
  7. package/dist/browser/documentModelAdministrationClient.d.ts.map +1 -1
  8. package/dist/browser/documentModelAdministrationClient.js +184 -82
  9. package/dist/browser/documentModelAdministrationClient.js.map +1 -1
  10. package/dist/browser/lro/util/delayMs.d.ts +1 -1
  11. package/dist/browser/lro/util/delayMs.js +1 -1
  12. package/dist/browser/lro/util/delayMs.js.map +1 -1
  13. package/dist/commonjs/documentAnalysisClient.d.ts +220 -131
  14. package/dist/commonjs/documentAnalysisClient.d.ts.map +1 -1
  15. package/dist/commonjs/documentAnalysisClient.js +57 -35
  16. package/dist/commonjs/documentAnalysisClient.js.map +1 -1
  17. package/dist/commonjs/documentModelAdministrationClient.d.ts +291 -123
  18. package/dist/commonjs/documentModelAdministrationClient.d.ts.map +1 -1
  19. package/dist/commonjs/documentModelAdministrationClient.js +184 -82
  20. package/dist/commonjs/documentModelAdministrationClient.js.map +1 -1
  21. package/dist/commonjs/lro/util/delayMs.d.ts +1 -1
  22. package/dist/commonjs/lro/util/delayMs.js +1 -1
  23. package/dist/commonjs/lro/util/delayMs.js.map +1 -1
  24. package/dist/esm/documentAnalysisClient.d.ts +220 -131
  25. package/dist/esm/documentAnalysisClient.d.ts.map +1 -1
  26. package/dist/esm/documentAnalysisClient.js +57 -35
  27. package/dist/esm/documentAnalysisClient.js.map +1 -1
  28. package/dist/esm/documentModelAdministrationClient.d.ts +291 -123
  29. package/dist/esm/documentModelAdministrationClient.d.ts.map +1 -1
  30. package/dist/esm/documentModelAdministrationClient.js +184 -82
  31. package/dist/esm/documentModelAdministrationClient.js.map +1 -1
  32. package/dist/esm/lro/util/delayMs.d.ts +1 -1
  33. package/dist/esm/lro/util/delayMs.js +1 -1
  34. package/dist/esm/lro/util/delayMs.js.map +1 -1
  35. package/dist/react-native/documentAnalysisClient.d.ts +220 -131
  36. package/dist/react-native/documentAnalysisClient.d.ts.map +1 -1
  37. package/dist/react-native/documentAnalysisClient.js +57 -35
  38. package/dist/react-native/documentAnalysisClient.js.map +1 -1
  39. package/dist/react-native/documentModelAdministrationClient.d.ts +291 -123
  40. package/dist/react-native/documentModelAdministrationClient.d.ts.map +1 -1
  41. package/dist/react-native/documentModelAdministrationClient.js +184 -82
  42. package/dist/react-native/documentModelAdministrationClient.js.map +1 -1
  43. package/dist/react-native/lro/util/delayMs.d.ts +1 -1
  44. package/dist/react-native/lro/util/delayMs.js +1 -1
  45. package/dist/react-native/lro/util/delayMs.js.map +1 -1
  46. 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,qBAA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AAE,MAAM,EACf,OAAO,GAAE,0BAA+B,GACvC,OAAO,CAAC,IAAI,CAAC;IAYhB;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACI,qBAAqB,CAC1B,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,yBAAyB,CAAC;IASrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IACI,uBAAuB,CAE5B,OAAO,GAAE,iBAAsB,GAC9B,0BAA0B,CAAC,yBAAyB,CAAC;IAIxD;;;;;;;;;;;OAWG;IACI,wBAAwB,CAC7B,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,IAAI,CAAC;IAahB;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACI,YAAY,CACjB,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,gBAAgB,CAAC;IAQ5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACI,cAAc,CACnB,OAAO,GAAE,qBAA0B,GAClC,0BAA0B,CAAC,gBAAgB,CAAC;CAKhD"}
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,EAC1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AAO,CAAC,oBAAoB,CAAC;IAQhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4DG;IACI,kBAAkB,CAEvB,OAAO,GAAE,iBAAsB,GAC9B,0BAA0B,CAAC,oBAAoB,CAAC;IAInD;;;;;;;;;;;;;;;;;;;;OAoBG;IACI,mBAAmB,CACxB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,0BAA+B,GACvC,OAAO,CAAC,IAAI,CAAC;IAYhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACI,qBAAqB,CAC1B,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,yBAAyB,CAAC;IASrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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"}
@@ -17,25 +17,27 @@ const util_js_1 = require("./util.js");
17
17
  *
18
18
  * #### Azure Active Directory
19
19
  *
20
- * ```typescript
21
- * import { DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
20
+ * ```ts snippet:ReadmeSampleAdministrationClient_TokenCredential
22
21
  * import { DefaultAzureCredential } from "@azure/identity";
22
+ * import { DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
23
23
  *
24
- * const endpoint = "https://<resource name>.cognitiveservices.azure.com";
25
24
  * const credential = new DefaultAzureCredential();
26
- *
27
- * const client = new DocumentModelAdministrationClient(endpoint, credential);
25
+ * const client = new DocumentModelAdministrationClient(
26
+ * "https://<resource name>.cognitiveservices.azure.com",
27
+ * credential,
28
+ * );
28
29
  * ```
29
30
  *
30
31
  * #### API Key (Subscription Key)
31
32
  *
32
- * ```typescript
33
- * import { DocumentModelAdministrationClient, AzureKeyCredential } from "@azure/ai-form-recognizer";
34
- *
35
- * const endpoint = "https://<resource name>.cognitiveservices.azure.com";
36
- * const credential = new AzureKeyCredential("<api key>");
33
+ * ```ts snippet:ReadmeSampleAdministrationClient_KeyCredential
34
+ * import { AzureKeyCredential, DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
37
35
  *
38
- * const client = new DocumentModelAdministrationClient(endpoint, credential);
36
+ * const credential = new AzureKeyCredential("<API key>");
37
+ * const client = new DocumentModelAdministrationClient(
38
+ * "https://<resource name>.cognitiveservices.azure.com",
39
+ * credential,
40
+ * );
39
41
  * ```
40
42
  */
41
43
  class DocumentModelAdministrationClient {
@@ -68,20 +70,24 @@ class DocumentModelAdministrationClient {
68
70
  *
69
71
  * ### Example
70
72
  *
71
- * ```javascript
72
- * const modelId = "aNewComposedModel";
73
- * const subModelIds = [
74
- * "documentType1Model",
75
- * "documentType2Model",
76
- * "documentType3Model"
77
- * ];
73
+ * ```ts snippet:ReadmeSampleComposeModel
74
+ * import { DefaultAzureCredential } from "@azure/identity";
75
+ * import { DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
76
+ *
77
+ * const credential = new DefaultAzureCredential();
78
+ * const client = new DocumentModelAdministrationClient(
79
+ * "https://<resource name>.cognitiveservices.azure.com",
80
+ * credential,
81
+ * );
82
+ *
83
+ * const composeModelId = "aNewComposedModel";
84
+ * const subModelIds = ["documentType1Model", "documentType2Model", "documentType3Model"];
78
85
  *
79
86
  * // The resulting composed model can classify and extract data from documents
80
87
  * // conforming to any of the above document types
81
- * const poller = await client.beginComposeDocumentModel(modelId, subModelIds, {
82
- * description: "This is a composed model that can handle several document types."
88
+ * const poller = await client.beginComposeDocumentModel(composeModelId, subModelIds, {
89
+ * description: "This is a composed model that can handle several document types.",
83
90
  * });
84
- *
85
91
  * // Model composition, like all other model creation operations, returns a poller that eventually produces a
86
92
  * // ModelDetails object
87
93
  * const modelDetails = await poller.pollUntilDone();
@@ -90,7 +96,7 @@ class DocumentModelAdministrationClient {
90
96
  * modelId, // identical to the modelId given when creating the model
91
97
  * description, // identical to the description given when creating the model
92
98
  * createdOn, // the Date (timestamp) that the model was created
93
- * docTypes // information about the document types of the composed submodels
99
+ * docTypes, // information about the document types of the composed submodels
94
100
  * } = modelDetails;
95
101
  * ```
96
102
  *
@@ -120,7 +126,16 @@ class DocumentModelAdministrationClient {
120
126
  *
121
127
  * ### Example
122
128
  *
123
- * ```javascript
129
+ * ```ts snippet:ReadmeSampleGetCopyAuthorization
130
+ * import { DefaultAzureCredential } from "@azure/identity";
131
+ * import { DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
132
+ *
133
+ * const credential = new DefaultAzureCredential();
134
+ * const client = new DocumentModelAdministrationClient(
135
+ * "https://<resource name>.cognitiveservices.azure.com",
136
+ * credential,
137
+ * );
138
+ *
124
139
  * // The copyAuthorization data structure stored below grants any cognitive services resource the right to copy a
125
140
  * // model into the client's resource with the given destination model ID.
126
141
  * const copyAuthorization = await client.getCopyAuthorization("<destination model ID>");
@@ -144,18 +159,26 @@ class DocumentModelAdministrationClient {
144
159
  *
145
160
  * ### Example
146
161
  *
147
- * ```javascript
148
- * // We need a client for the source model's resource
149
- * const sourceEndpoint = "https://<source resource name>.cognitiveservices.azure.com";
150
- * const sourceCredential = new AzureKeyCredential("<source api key>");
151
- * const sourceClient = new DocumentModelAdministrationClient(sourceEndpoint, sourceCredential);
162
+ * ```ts snippet:ReadmeSampleCopyModel
163
+ * import { DefaultAzureCredential } from "@azure/identity";
164
+ * import { DocumentModelAdministrationClient, AzureKeyCredential } from "@azure/ai-form-recognizer";
165
+ *
166
+ * const credential = new DefaultAzureCredential();
167
+ * const client = new DocumentModelAdministrationClient(
168
+ * "https://<resource name>.cognitiveservices.azure.com",
169
+ * credential,
170
+ * );
152
171
  *
153
172
  * // We create the copy authorization using a client authenticated with the destination resource. Note that these two
154
173
  * // resources can be the same (you can copy a model to a new ID in the same resource).
155
174
  * const copyAuthorization = await client.getCopyAuthorization("<destination model ID>");
156
175
  *
157
176
  * // Finally, use the _source_ client to copy the model and await the copy operation
158
- * const poller = await sourceClient.beginCopyModelTo("<source model ID>");
177
+ * // We need a client for the source model's resource
178
+ * const sourceEndpoint = "https://<source resource name>.cognitiveservices.azure.com";
179
+ * const sourceCredential = new AzureKeyCredential("<source api key>");
180
+ * const sourceClient = new DocumentModelAdministrationClient(sourceEndpoint, sourceCredential);
181
+ * const poller = await sourceClient.beginCopyModelTo("<source model ID>", copyAuthorization);
159
182
  *
160
183
  * // Model copying, like all other model creation operations, returns a poller that eventually produces a ModelDetails
161
184
  * // object
@@ -165,7 +188,7 @@ class DocumentModelAdministrationClient {
165
188
  * modelId, // identical to the modelId given when creating the copy authorization
166
189
  * description, // identical to the description given when creating the copy authorization
167
190
  * createdOn, // the Date (timestamp) that the model was created
168
- * docTypes // information about the document types of the model (identical to the original, source model)
191
+ * docTypes, // information about the document types of the model (identical to the original, source model)
169
192
  * } = modelDetails;
170
193
  * ```
171
194
  *
@@ -204,32 +227,41 @@ class DocumentModelAdministrationClient {
204
227
  *
205
228
  * ### Example
206
229
  *
207
- * ```javascript
208
- * const classifierId = "aNewClassifier";
230
+ * ```ts snippet:ReadmeSampleBuildClassifier
231
+ * import { DefaultAzureCredential } from "@azure/identity";
232
+ * import { DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
233
+ *
234
+ * const credential = new DefaultAzureCredential();
235
+ * const client = new DocumentModelAdministrationClient(
236
+ * "https://<resource name>.cognitiveservices.azure.com",
237
+ * credential,
238
+ * );
239
+ *
240
+ * const newClassifiedId = "aNewClassifier";
209
241
  * const containerUrl1 = "<training data container SAS URL 1>";
210
242
  * const containerUrl2 = "<training data container SAS URL 2>";
211
243
  *
212
244
  * const poller = await client.beginBuildDocumentClassifier(
213
- * classifierId,
245
+ * newClassifiedId,
214
246
  * {
215
247
  * // The document types. Each entry in this object should map a document type name to a
216
248
  * // `ClassifierDocumentTypeDetails` object
217
- * "formX": {
249
+ * formX: {
218
250
  * azureBlobSource: {
219
251
  * containerUrl: containerUrl1,
220
- * }
252
+ * },
221
253
  * },
222
- * "formY": {
254
+ * formY: {
223
255
  * azureBlobFileListSource: {
224
256
  * containerUrl: containerUrl2,
225
- * fileList: "path/to/fileList.jsonl"
226
- * }
257
+ * fileList: "path/to/fileList.jsonl",
258
+ * },
227
259
  * },
228
260
  * },
229
261
  * {
230
262
  * // Optionally, a text description may be attached to the classifier
231
- * description: "This is an example classifier!"
232
- * }
263
+ * description: "This is an example classifier!",
264
+ * },
233
265
  * );
234
266
  *
235
267
  * // Classifier building, like model creation operations, returns a poller that eventually produces a
@@ -240,7 +272,7 @@ class DocumentModelAdministrationClient {
240
272
  * classifierId, // identical to the classifierId given when creating the classifier
241
273
  * description, // identical to the description given when creating the classifier (if any)
242
274
  * createdOn, // the Date (timestamp) that the classifier was created
243
- * docTypes // information about the document types in the classifier and their details
275
+ * docTypes, // information about the document types in the classifier and their details
244
276
  * } = classifierDetails;
245
277
  * ```
246
278
  *
@@ -354,15 +386,24 @@ class DocumentModelAdministrationClient {
354
386
  *
355
387
  * ### Example
356
388
  *
357
- * ```javascript
389
+ * ```ts snippet:ReadmeSampleGetResourceDetails
390
+ * import { DefaultAzureCredential } from "@azure/identity";
391
+ * import { DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
392
+ *
393
+ * const credential = new DefaultAzureCredential();
394
+ * const client = new DocumentModelAdministrationClient(
395
+ * "https://<resource name>.cognitiveservices.azure.com",
396
+ * credential,
397
+ * );
398
+ *
358
399
  * const {
359
400
  * // Information about the custom models in the current resource
360
- * customDocumentModelDetails: {
401
+ * customDocumentModels: {
361
402
  * // The number of custom models in the current resource
362
403
  * count,
363
404
  * // The maximum number of models that the current resource can support
364
- * limit
365
- * }
405
+ * limit,
406
+ * },
366
407
  * } = await client.getResourceDetails();
367
408
  * ```
368
409
  *
@@ -386,9 +427,18 @@ class DocumentModelAdministrationClient {
386
427
  *
387
428
  * ### Example
388
429
  *
389
- * ```javascript
430
+ * ```ts snippet:ReadmeSampleGetModel
431
+ * import { DefaultAzureCredential } from "@azure/identity";
432
+ * import { DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
433
+ *
434
+ * const credential = new DefaultAzureCredential();
435
+ * const client = new DocumentModelAdministrationClient(
436
+ * "https://<resource name>.cognitiveservices.azure.com",
437
+ * credential,
438
+ * );
439
+ *
390
440
  * // The ID of the prebuilt business card model
391
- * const modelId = "prebuilt-businessCard";
441
+ * const prebuiltModelId = "prebuilt-businessCard";
392
442
  *
393
443
  * const {
394
444
  * modelId, // identical to the modelId given when calling `getDocumentModel`
@@ -399,15 +449,15 @@ class DocumentModelAdministrationClient {
399
449
  * // the document type of the prebuilt business card model
400
450
  * "prebuilt:businesscard": {
401
451
  * // an optional, textual description of this document type
402
- * description,
452
+ * description: businessCardDescription,
403
453
  * // the schema of the fields in this document type, see the FieldSchema type
404
454
  * fieldSchema,
405
455
  * // the service's confidences in the fields (an object with field names as properties and numeric confidence
406
456
  * // values)
407
- * fieldConfidence
408
- * }
409
- * }
410
- * } = await client.getDocumentModel(modelId);
457
+ * fieldConfidence,
458
+ * },
459
+ * },
460
+ * } = await client.getDocumentModel(prebuiltModelId);
411
461
  * ```
412
462
  *
413
463
  * @param modelId - the unique ID of the model to query
@@ -439,7 +489,17 @@ class DocumentModelAdministrationClient {
439
489
  *
440
490
  * #### Async Iteration
441
491
  *
442
- * ```javascript
492
+ * ```ts snippet:ReadmeSampleListModels
493
+ * import { DefaultAzureCredential } from "@azure/identity";
494
+ * import { DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
495
+ *
496
+ * const credential = new DefaultAzureCredential();
497
+ * const client = new DocumentModelAdministrationClient(
498
+ * "https://<resource name>.cognitiveservices.azure.com",
499
+ * credential,
500
+ * );
501
+ *
502
+ * // Iterate over all models in the current resource
443
503
  * for await (const summary of client.listDocumentModels()) {
444
504
  * const {
445
505
  * modelId, // The model's unique ID
@@ -449,17 +509,13 @@ class DocumentModelAdministrationClient {
449
509
  * // You can get the full model info using `getDocumentModel`
450
510
  * const model = await client.getDocumentModel(modelId);
451
511
  * }
452
- * ```
453
- *
454
- * #### By Page
455
512
  *
456
- * ```javascript
457
513
  * // The listDocumentModels method is paged, and you can iterate by page using the `byPage` method.
458
514
  * const pages = client.listDocumentModels().byPage();
459
515
  *
460
516
  * for await (const page of pages) {
461
517
  * // Each page is an array of models and can be iterated synchronously
462
- * for (const model of page) {
518
+ * for (const summary of page) {
463
519
  * const {
464
520
  * modelId, // The model's unique ID
465
521
  * description, // a textual description of the model, if provided during model creation
@@ -484,8 +540,17 @@ class DocumentModelAdministrationClient {
484
540
  *
485
541
  * ### Example
486
542
  *
487
- * ```javascript
488
- * await client.deleteDocumentModel("<model ID to delete>"));
543
+ * ```ts snippet:ReadmeSampleDeleteModel
544
+ * import { DefaultAzureCredential } from "@azure/identity";
545
+ * import { DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
546
+ *
547
+ * const credential = new DefaultAzureCredential();
548
+ * const client = new DocumentModelAdministrationClient(
549
+ * "https://<resource name>.cognitiveservices.azure.com",
550
+ * credential,
551
+ * );
552
+ *
553
+ * await client.deleteDocumentModel("<model ID to delete>");
489
554
  * ```
490
555
  *
491
556
  * @param modelId - the unique ID of the model to delete from the resource
@@ -501,21 +566,30 @@ class DocumentModelAdministrationClient {
501
566
  *
502
567
  * ### Example
503
568
  *
504
- * ```javascript
505
- * const classifierId = "<classifier ID";
569
+ * ```ts snippet:ReadmeSampleGetClassifier
570
+ * import { DefaultAzureCredential } from "@azure/identity";
571
+ * import { DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
572
+ *
573
+ * const credential = new DefaultAzureCredential();
574
+ * const client = new DocumentModelAdministrationClient(
575
+ * "https://<resource name>.cognitiveservices.azure.com",
576
+ * credential,
577
+ * );
578
+ *
579
+ * const foundClassifier = "<classifier ID>";
506
580
  *
507
581
  * const {
508
582
  * classifierId, // identical to the ID given when calling `getDocumentClassifier`
509
583
  * description, // a textual description of the classifier, if provided during classifier creation
510
584
  * createdOn, // the Date (timestamp) that the classifier was created
511
585
  * // information about the document types in the classifier and their corresponding traning data
512
- * docTypes
513
- * } = await client.getDocumentClassifier(classifierId);
586
+ * docTypes,
587
+ * } = await client.getDocumentClassifier(foundClassifier);
514
588
  *
515
589
  * // The `docTypes` property is a map of document type names to information about the training data
516
590
  * // for that document type.
517
591
  * for (const [docTypeName, classifierDocTypeDetails] of Object.entries(docTypes)) {
518
- * console.log(`- '${docTypeName}': `, classifierDocTypeDetails);
592
+ * console.log(`- '${docTypeName}': `, classifierDocTypeDetails);
519
593
  * }
520
594
  * ```
521
595
  *
@@ -533,7 +607,16 @@ class DocumentModelAdministrationClient {
533
607
  *
534
608
  * #### Async Iteration
535
609
  *
536
- * ```javascript
610
+ * ```ts snippet:ReadmeSampleListClassifiers
611
+ * import { DefaultAzureCredential } from "@azure/identity";
612
+ * import { DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
613
+ *
614
+ * const credential = new DefaultAzureCredential();
615
+ * const client = new DocumentModelAdministrationClient(
616
+ * "https://<resource name>.cognitiveservices.azure.com",
617
+ * credential,
618
+ * );
619
+ *
537
620
  * for await (const details of client.listDocumentClassifiers()) {
538
621
  * const {
539
622
  * classifierId, // The classifier's unique ID
@@ -541,11 +624,7 @@ class DocumentModelAdministrationClient {
541
624
  * docTypes, // information about the document types in the classifier and their corresponding traning data
542
625
  * } = details;
543
626
  * }
544
- * ```
545
627
  *
546
- * #### By Page
547
- *
548
- * ```javascript
549
628
  * // The listDocumentClassifiers method is paged, and you can iterate by page using the `byPage` method.
550
629
  * const pages = client.listDocumentClassifiers().byPage();
551
630
  *
@@ -574,8 +653,17 @@ class DocumentModelAdministrationClient {
574
653
  *
575
654
  * ### Example
576
655
  *
577
- * ```javascript
578
- * await client.deleteDocumentClassifier("<classifier ID to delete>"));
656
+ * ```ts snippet:ReadmeSampleDeleteClassifier
657
+ * import { DefaultAzureCredential } from "@azure/identity";
658
+ * import { DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
659
+ *
660
+ * const credential = new DefaultAzureCredential();
661
+ * const client = new DocumentModelAdministrationClient(
662
+ * "https://<resource name>.cognitiveservices.azure.com",
663
+ * credential,
664
+ * );
665
+ *
666
+ * await client.deleteDocumentClassifier("<classifier ID to delete>");
579
667
  * ```
580
668
  *
581
669
  * @param classifierId - the unique ID of the classifier to delete from the resource
@@ -597,9 +685,18 @@ class DocumentModelAdministrationClient {
597
685
  *
598
686
  * ### Example
599
687
  *
600
- * ```javascript
688
+ * ```ts snippet:ReadmeSampleGetOperation
689
+ * import { DefaultAzureCredential } from "@azure/identity";
690
+ * import { DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
691
+ *
692
+ * const credential = new DefaultAzureCredential();
693
+ * const client = new DocumentModelAdministrationClient(
694
+ * "https://<resource name>.cognitiveservices.azure.com",
695
+ * credential,
696
+ * );
697
+ *
601
698
  * // The ID of the operation, which should be a GUID
602
- * const operationId = "<operation GUID>";
699
+ * const findOperationId = "<operation GUID>";
603
700
  *
604
701
  * const {
605
702
  * operationId, // identical to the operationId given when calling `getOperation`
@@ -608,7 +705,7 @@ class DocumentModelAdministrationClient {
608
705
  * percentCompleted, // a number between 0 and 100 representing the progress of the operation
609
706
  * createdOn, // a Date object that reflects the time when the operation was started
610
707
  * lastUpdatedOn, // a Date object that reflects the time when the operation state was last modified
611
- * } = await client.getOperation(operationId);
708
+ * } = await client.getOperation(findOperationId);
612
709
  * ```
613
710
  */
614
711
  getOperation(operationId, options = {}) {
@@ -622,19 +719,24 @@ class DocumentModelAdministrationClient {
622
719
  *
623
720
  * #### Async Iteration
624
721
  *
625
- * ```javascript
722
+ * ```ts snippet:ReadmeSampleListOperations
723
+ * import { DefaultAzureCredential } from "@azure/identity";
724
+ * import { DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
725
+ *
726
+ * const credential = new DefaultAzureCredential();
727
+ * const client = new DocumentModelAdministrationClient(
728
+ * "https://<resource name>.cognitiveservices.azure.com",
729
+ * credential,
730
+ * );
731
+ *
626
732
  * for await (const operation of client.listOperations()) {
627
733
  * const {
628
734
  * operationId, // the operation's GUID
629
735
  * status, // the operation status, one of "notStarted", "running", "succeeded", "failed", or "canceled"
630
- * percentCompleted // the progress of the operation, from 0 to 100
736
+ * percentCompleted, // the progress of the operation, from 0 to 100
631
737
  * } = operation;
632
738
  * }
633
- * ```
634
- *
635
- * #### By Page
636
739
  *
637
- * ```javascript
638
740
  * // The listOperations method is paged, and you can iterate by page using the `byPage` method.
639
741
  * const pages = client.listOperations().byPage();
640
742
  *
@@ -644,7 +746,7 @@ class DocumentModelAdministrationClient {
644
746
  * const {
645
747
  * operationId, // the operation's GUID
646
748
  * status, // the operation status, one of "notStarted", "running", "succeeded", "failed", or "canceled"
647
- * percentCompleted // the progress of the operation, from 0 to 100
749
+ * percentCompleted, // the progress of the operation, from 0 to 100
648
750
  * } = operation;
649
751
  * }
650
752
  * }