@azure/ai-form-recognizer 4.0.0-beta.4 → 4.0.0
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 +206 -184
- package/dist/index.js +588 -1992
- package/dist/index.js.map +1 -1
- package/dist-esm/src/constants.js +1 -1
- package/dist-esm/src/constants.js.map +1 -1
- package/dist-esm/src/documentAnalysisClient.js +30 -227
- package/dist-esm/src/documentAnalysisClient.js.map +1 -1
- package/dist-esm/src/documentModel.js +71 -0
- package/dist-esm/src/documentModel.js.map +1 -0
- package/dist-esm/src/documentModelAdministrationClient.js +59 -59
- package/dist-esm/src/documentModelAdministrationClient.js.map +1 -1
- package/dist-esm/src/generated/generatedClient.js +63 -101
- package/dist-esm/src/generated/generatedClient.js.map +1 -1
- package/dist-esm/src/generated/models/index.js +40 -9
- package/dist-esm/src/generated/models/index.js.map +1 -1
- package/dist-esm/src/generated/models/mappers.js +207 -205
- package/dist-esm/src/generated/models/mappers.js.map +1 -1
- package/dist-esm/src/generated/models/parameters.js +4 -38
- package/dist-esm/src/generated/models/parameters.js.map +1 -1
- package/dist-esm/src/index.js +1 -1
- package/dist-esm/src/index.js.map +1 -1
- package/dist-esm/src/lro/{training.js → administration.js} +4 -4
- package/dist-esm/src/lro/administration.js.map +1 -0
- package/dist-esm/src/lro/{analyze.js → analysis.js} +12 -11
- package/dist-esm/src/lro/analysis.js.map +1 -0
- package/dist-esm/src/models/documentElements.js.map +1 -1
- package/dist-esm/src/models/index.js.map +1 -1
- package/dist-esm/src/options/AnalyzeDocumentsOptions.js.map +1 -1
- package/dist-esm/src/options/{CopyModelOptions.js → BeginCopyModelOptions.js} +1 -1
- package/dist-esm/src/options/BeginCopyModelOptions.js.map +1 -0
- package/dist-esm/src/options/BuildModelOptions.js.map +1 -1
- package/dist-esm/src/options/DeleteModelOptions.js.map +1 -1
- package/dist-esm/src/options/FormRecognizerClientOptions.js +3 -2
- package/dist-esm/src/options/FormRecognizerClientOptions.js.map +1 -1
- package/dist-esm/src/options/{GetInfoOptions.js → GetResourceDetailsOptions.js} +1 -1
- package/dist-esm/src/options/GetResourceDetailsOptions.js.map +1 -0
- package/dist-esm/src/options/index.js.map +1 -1
- package/dist-esm/src/util.js.map +1 -1
- package/package.json +16 -10
- package/types/ai-form-recognizer.d.ts +388 -1753
- package/dist-esm/src/generated/generatedClientContext.js +0 -41
- package/dist-esm/src/generated/generatedClientContext.js.map +0 -1
- package/dist-esm/src/lro/analyze.js.map +0 -1
- package/dist-esm/src/lro/training.js.map +0 -1
- package/dist-esm/src/models/GeneralDocumentResult.js +0 -13
- package/dist-esm/src/models/GeneralDocumentResult.js.map +0 -1
- package/dist-esm/src/models/LayoutResult.js +0 -15
- package/dist-esm/src/models/LayoutResult.js.map +0 -1
- package/dist-esm/src/models/ReadResult.js +0 -18
- package/dist-esm/src/models/ReadResult.js.map +0 -1
- package/dist-esm/src/options/CopyModelOptions.js.map +0 -1
- package/dist-esm/src/options/GetInfoOptions.js.map +0 -1
- package/dist-esm/src/prebuilt/index.js +0 -9
- package/dist-esm/src/prebuilt/index.js.map +0 -1
- package/dist-esm/src/prebuilt/modelSchemas/businessCard.js +0 -5
- package/dist-esm/src/prebuilt/modelSchemas/businessCard.js.map +0 -1
- package/dist-esm/src/prebuilt/modelSchemas/data/prebuilt-businessCard.json.js +0 -93
- package/dist-esm/src/prebuilt/modelSchemas/data/prebuilt-businessCard.json.js.map +0 -1
- package/dist-esm/src/prebuilt/modelSchemas/data/prebuilt-document.json.js +0 -12
- package/dist-esm/src/prebuilt/modelSchemas/data/prebuilt-document.json.js.map +0 -1
- package/dist-esm/src/prebuilt/modelSchemas/data/prebuilt-healthInsuranceCard.us.json.js +0 -153
- package/dist-esm/src/prebuilt/modelSchemas/data/prebuilt-healthInsuranceCard.us.json.js.map +0 -1
- package/dist-esm/src/prebuilt/modelSchemas/data/prebuilt-idDocument.json.js +0 -89
- package/dist-esm/src/prebuilt/modelSchemas/data/prebuilt-idDocument.json.js.map +0 -1
- package/dist-esm/src/prebuilt/modelSchemas/data/prebuilt-invoice.json.js +0 -144
- package/dist-esm/src/prebuilt/modelSchemas/data/prebuilt-invoice.json.js.map +0 -1
- package/dist-esm/src/prebuilt/modelSchemas/data/prebuilt-layout.json.js +0 -12
- package/dist-esm/src/prebuilt/modelSchemas/data/prebuilt-layout.json.js.map +0 -1
- package/dist-esm/src/prebuilt/modelSchemas/data/prebuilt-read.json.js +0 -12
- package/dist-esm/src/prebuilt/modelSchemas/data/prebuilt-read.json.js.map +0 -1
- package/dist-esm/src/prebuilt/modelSchemas/data/prebuilt-receipt.json.js +0 -341
- package/dist-esm/src/prebuilt/modelSchemas/data/prebuilt-receipt.json.js.map +0 -1
- package/dist-esm/src/prebuilt/modelSchemas/data/prebuilt-tax.us.w2.json.js +0 -155
- package/dist-esm/src/prebuilt/modelSchemas/data/prebuilt-tax.us.w2.json.js.map +0 -1
- package/dist-esm/src/prebuilt/modelSchemas/data/prebuilt-vaccinationCard.json.js +0 -50
- package/dist-esm/src/prebuilt/modelSchemas/data/prebuilt-vaccinationCard.json.js.map +0 -1
- package/dist-esm/src/prebuilt/modelSchemas/healthInsuranceCard.js +0 -5
- package/dist-esm/src/prebuilt/modelSchemas/healthInsuranceCard.js.map +0 -1
- package/dist-esm/src/prebuilt/modelSchemas/idDocument.js +0 -5
- package/dist-esm/src/prebuilt/modelSchemas/idDocument.js.map +0 -1
- package/dist-esm/src/prebuilt/modelSchemas/invoice.js +0 -5
- package/dist-esm/src/prebuilt/modelSchemas/invoice.js.map +0 -1
- package/dist-esm/src/prebuilt/modelSchemas/receipt.js +0 -5
- package/dist-esm/src/prebuilt/modelSchemas/receipt.js.map +0 -1
- package/dist-esm/src/prebuilt/modelSchemas/vaccinationCard.js +0 -5
- package/dist-esm/src/prebuilt/modelSchemas/vaccinationCard.js.map +0 -1
- package/dist-esm/src/prebuilt/modelSchemas/w2.js +0 -5
- package/dist-esm/src/prebuilt/modelSchemas/w2.js.map +0 -1
- package/dist-esm/src/prebuilt/models.js +0 -150
- package/dist-esm/src/prebuilt/models.js.map +0 -1
- package/dist-esm/src/prebuilt/schema.js +0 -4
- package/dist-esm/src/prebuilt/schema.js.map +0 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { createTracingClient } from "@azure/core-tracing";
|
|
4
4
|
import { SDK_VERSION } from "./constants";
|
|
5
5
|
import { accept1 } from "./generated/models/parameters";
|
|
6
|
-
import { toTrainingPollOperationState, } from "./lro/
|
|
6
|
+
import { toTrainingPollOperationState, } from "./lro/administration";
|
|
7
7
|
import { lro } from "./lro/util/poller";
|
|
8
8
|
import { Mappers, SERIALIZER, makeServiceClient } from "./util";
|
|
9
9
|
/**
|
|
@@ -64,21 +64,21 @@ export class DocumentModelAdministrationClient {
|
|
|
64
64
|
* const modelId = "aNewModel";
|
|
65
65
|
* const containerUrl = "<training data container SAS URL>";
|
|
66
66
|
*
|
|
67
|
-
* const poller = await client.
|
|
67
|
+
* const poller = await client.beginBuildDocumentModel(modelId, containerUrl, {
|
|
68
68
|
* // Optionally, a text description may be attached to the model
|
|
69
69
|
* description: "This is an example model!"
|
|
70
70
|
* });
|
|
71
71
|
*
|
|
72
|
-
* // Model building, like all other model creation operations, returns a poller that eventually produces a
|
|
72
|
+
* // Model building, like all other model creation operations, returns a poller that eventually produces a ModelDetails
|
|
73
73
|
* // object
|
|
74
|
-
* const
|
|
74
|
+
* const modelDetails = await poller.pollUntilDone();
|
|
75
75
|
*
|
|
76
76
|
* const {
|
|
77
77
|
* modelId, // identical to the modelId given when creating the model
|
|
78
78
|
* description, // identical to the description given when creating the model
|
|
79
|
-
*
|
|
79
|
+
* createdOn, // the Date (timestamp) that the model was created
|
|
80
80
|
* docTypes // information about the document types in the model and their field schemas
|
|
81
|
-
* } =
|
|
81
|
+
* } = modelDetails;
|
|
82
82
|
* ```
|
|
83
83
|
*
|
|
84
84
|
* @param modelId - the unique ID of the model to create
|
|
@@ -87,8 +87,8 @@ export class DocumentModelAdministrationClient {
|
|
|
87
87
|
* @param options - optional settings for the model build operation
|
|
88
88
|
* @returns a long-running operation (poller) that will eventually produce the created model information or an error
|
|
89
89
|
*/
|
|
90
|
-
async
|
|
91
|
-
return this._tracing.withSpan("DocumentModelAdministrationClient.
|
|
90
|
+
async beginBuildDocumentModel(modelId, containerUrl, buildMode, options = {}) {
|
|
91
|
+
return this._tracing.withSpan("DocumentModelAdministrationClient.beginBuildDocumentModel", options, (finalOptions) => this.createDocumentModelPoller({
|
|
92
92
|
options: finalOptions,
|
|
93
93
|
start: () => this._restClient.buildDocumentModel({
|
|
94
94
|
modelId,
|
|
@@ -118,20 +118,20 @@ export class DocumentModelAdministrationClient {
|
|
|
118
118
|
*
|
|
119
119
|
* // The resulting composed model can classify and extract data from documents
|
|
120
120
|
* // conforming to any of the above document types
|
|
121
|
-
* const poller = await client.
|
|
121
|
+
* const poller = await client.beginComposeDocumentModel(modelId, subModelIds, {
|
|
122
122
|
* description: "This is a composed model that can handle several document types."
|
|
123
123
|
* });
|
|
124
124
|
*
|
|
125
125
|
* // Model composition, like all other model creation operations, returns a poller that eventually produces a
|
|
126
|
-
* //
|
|
127
|
-
* const
|
|
126
|
+
* // ModelDetails object
|
|
127
|
+
* const modelDetails = await poller.pollUntilDone();
|
|
128
128
|
*
|
|
129
129
|
* const {
|
|
130
130
|
* modelId, // identical to the modelId given when creating the model
|
|
131
131
|
* description, // identical to the description given when creating the model
|
|
132
|
-
*
|
|
132
|
+
* createdOn, // the Date (timestamp) that the model was created
|
|
133
133
|
* docTypes // information about the document types of the composed submodels
|
|
134
|
-
* } =
|
|
134
|
+
* } = modelDetails;
|
|
135
135
|
* ```
|
|
136
136
|
*
|
|
137
137
|
* @param modelId - the unique ID of the model to create
|
|
@@ -139,8 +139,8 @@ export class DocumentModelAdministrationClient {
|
|
|
139
139
|
* @param options - optional settings for model creation
|
|
140
140
|
* @returns a long-running operation (poller) that will eventually produce the created model information or an error
|
|
141
141
|
*/
|
|
142
|
-
async
|
|
143
|
-
return this._tracing.withSpan("DocumentModelAdministrationClient.
|
|
142
|
+
async beginComposeDocumentModel(modelId, componentModelIds, options = {}) {
|
|
143
|
+
return this._tracing.withSpan("DocumentModelAdministrationClient.beginComposeDocumentModel", options, (finalOptions) => this.createDocumentModelPoller({
|
|
144
144
|
options: finalOptions,
|
|
145
145
|
start: () => this._restClient.composeDocumentModel({
|
|
146
146
|
modelId,
|
|
@@ -197,16 +197,16 @@ export class DocumentModelAdministrationClient {
|
|
|
197
197
|
* // Finally, use the _source_ client to copy the model and await the copy operation
|
|
198
198
|
* const poller = await sourceClient.beginCopyModelTo("<source model ID>");
|
|
199
199
|
*
|
|
200
|
-
* // Model copying, like all other model creation operations, returns a poller that eventually produces a
|
|
200
|
+
* // Model copying, like all other model creation operations, returns a poller that eventually produces a ModelDetails
|
|
201
201
|
* // object
|
|
202
|
-
* const
|
|
202
|
+
* const modelDetails = await poller.pollUntilDone();
|
|
203
203
|
*
|
|
204
204
|
* const {
|
|
205
205
|
* modelId, // identical to the modelId given when creating the copy authorization
|
|
206
206
|
* description, // identical to the description given when creating the copy authorization
|
|
207
|
-
*
|
|
207
|
+
* createdOn, // the Date (timestamp) that the model was created
|
|
208
208
|
* docTypes // information about the document types of the model (identical to the original, source model)
|
|
209
|
-
* } =
|
|
209
|
+
* } = modelDetails;
|
|
210
210
|
* ```
|
|
211
211
|
*
|
|
212
212
|
* @param sourceModelId - the unique ID of the source model that will be copied
|
|
@@ -215,23 +215,23 @@ export class DocumentModelAdministrationClient {
|
|
|
215
215
|
* @returns a long-running operation (poller) that will eventually produce the copied model information or an error
|
|
216
216
|
*/
|
|
217
217
|
async beginCopyModelTo(sourceModelId, authorization, options = {}) {
|
|
218
|
-
return this._tracing.withSpan("DocumentModelAdministrationClient.beginCopyModel", options, (finalOptions) => this.
|
|
218
|
+
return this._tracing.withSpan("DocumentModelAdministrationClient.beginCopyModel", options, (finalOptions) => this.createDocumentModelPoller({
|
|
219
219
|
options: finalOptions,
|
|
220
220
|
start: () => this._restClient.copyDocumentModelTo(sourceModelId, authorization, finalOptions),
|
|
221
221
|
}));
|
|
222
222
|
}
|
|
223
223
|
/**
|
|
224
|
-
* Create an LRO poller that handles
|
|
224
|
+
* Create an LRO poller that handles model creation operations.
|
|
225
225
|
*
|
|
226
|
-
* This is the meat of
|
|
226
|
+
* This is the meat of the above model creation operations.
|
|
227
227
|
*
|
|
228
228
|
* @param definition - operation definition (start operation method, request options)
|
|
229
|
-
* @returns a
|
|
229
|
+
* @returns a model poller (produces a ModelDetails)
|
|
230
230
|
*/
|
|
231
|
-
async
|
|
231
|
+
async createDocumentModelPoller(definition) {
|
|
232
232
|
const { resumeFrom } = definition.options;
|
|
233
233
|
const toInit = resumeFrom === undefined
|
|
234
|
-
? () => this._tracing.withSpan("DocumentModelAdministrationClient.
|
|
234
|
+
? () => this._tracing.withSpan("DocumentModelAdministrationClient.createDocumentModelPoller-start", definition.options, async (options) => {
|
|
235
235
|
const { operationLocation } = await definition.start();
|
|
236
236
|
if (operationLocation === undefined) {
|
|
237
237
|
throw new Error("Unable to start model creation operation: no Operation-Location received.");
|
|
@@ -243,7 +243,7 @@ export class DocumentModelAdministrationClient {
|
|
|
243
243
|
httpMethod: "GET",
|
|
244
244
|
responses: {
|
|
245
245
|
200: {
|
|
246
|
-
bodyMapper: Mappers.
|
|
246
|
+
bodyMapper: Mappers.OperationDetails,
|
|
247
247
|
},
|
|
248
248
|
default: {
|
|
249
249
|
bodyMapper: Mappers.ErrorResponse,
|
|
@@ -253,13 +253,13 @@ export class DocumentModelAdministrationClient {
|
|
|
253
253
|
serializer: SERIALIZER,
|
|
254
254
|
});
|
|
255
255
|
})
|
|
256
|
-
: () => this._tracing.withSpan("DocumentModelAdministrationClient.
|
|
256
|
+
: () => this._tracing.withSpan("DocumentModelAdministrationClient.createDocumentModelPoller-resume", definition.options, (options) => {
|
|
257
257
|
const { operationId } = JSON.parse(resumeFrom);
|
|
258
258
|
return this._restClient.getOperation(operationId, options);
|
|
259
259
|
});
|
|
260
260
|
const poller = await lro({
|
|
261
261
|
init: async () => toTrainingPollOperationState(await toInit()),
|
|
262
|
-
poll: async ({ operationId }) => this._tracing.withSpan("DocumentModelAdminstrationClient.
|
|
262
|
+
poll: async ({ operationId }) => this._tracing.withSpan("DocumentModelAdminstrationClient.createDocumentModelPoller-poll", definition.options, async (options) => {
|
|
263
263
|
const res = await this._restClient.getOperation(operationId, options);
|
|
264
264
|
return toTrainingPollOperationState(res);
|
|
265
265
|
}),
|
|
@@ -281,32 +281,32 @@ export class DocumentModelAdministrationClient {
|
|
|
281
281
|
* ```javascript
|
|
282
282
|
* const {
|
|
283
283
|
* // Information about the custom models in the current resource
|
|
284
|
-
*
|
|
284
|
+
* customDocumentModelDetails: {
|
|
285
285
|
* // The number of custom models in the current resource
|
|
286
286
|
* count,
|
|
287
287
|
* // The maximum number of models that the current resource can support
|
|
288
288
|
* limit
|
|
289
289
|
* }
|
|
290
|
-
* } = await client.
|
|
290
|
+
* } = await client.getResourceDetails();
|
|
291
291
|
* ```
|
|
292
292
|
*
|
|
293
293
|
* @param options - optional settings for the request
|
|
294
294
|
* @returns basic information about this client's resource
|
|
295
295
|
*/
|
|
296
|
-
|
|
297
|
-
return this._tracing.withSpan("DocumentModelAdministrationClient.
|
|
296
|
+
getResourceDetails(options = {}) {
|
|
297
|
+
return this._tracing.withSpan("DocumentModelAdministrationClient.getResourceDetails", options, (finalOptions) => this._restClient.getResourceDetails(finalOptions));
|
|
298
298
|
}
|
|
299
299
|
/**
|
|
300
|
-
* Retrieves information about a model ({@link
|
|
300
|
+
* Retrieves information about a model ({@link ModelDetails}) by ID.
|
|
301
301
|
*
|
|
302
302
|
* This method can retrieve information about custom as well as prebuilt models.
|
|
303
303
|
*
|
|
304
304
|
* ### **Breaking Change**
|
|
305
305
|
*
|
|
306
306
|
* In previous versions of the Form Recognizer REST API and SDK, the `getModel` method could return any model, even
|
|
307
|
-
* one that failed to create due to errors. In the new service versions, `
|
|
308
|
-
* successfully created models_ (i.e. models that are "ready" for use). Failed models are now retrieved
|
|
309
|
-
* "operations" APIs, see {@link getOperation} and {@link listOperations}.
|
|
307
|
+
* one that failed to create due to errors. In the new service versions, `getDocumentModel` and `listDocumentModels`
|
|
308
|
+
* _only produce successfully created models_ (i.e. models that are "ready" for use). Failed models are now retrieved
|
|
309
|
+
* through the "operations" APIs, see {@link getOperation} and {@link listOperations}.
|
|
310
310
|
*
|
|
311
311
|
* ### Example
|
|
312
312
|
*
|
|
@@ -315,9 +315,9 @@ export class DocumentModelAdministrationClient {
|
|
|
315
315
|
* const modelId = "prebuilt-businessCard";
|
|
316
316
|
*
|
|
317
317
|
* const {
|
|
318
|
-
* modelId, // identical to the modelId given when calling `
|
|
318
|
+
* modelId, // identical to the modelId given when calling `getDocumentModel`
|
|
319
319
|
* description, // a textual description of the model, if provided during model creation
|
|
320
|
-
*
|
|
320
|
+
* createdOn, // the Date (timestamp) that the model was created
|
|
321
321
|
* // information about the document types in the model and their field schemas
|
|
322
322
|
* docTypes: {
|
|
323
323
|
* // the document type of the prebuilt business card model
|
|
@@ -331,15 +331,15 @@ export class DocumentModelAdministrationClient {
|
|
|
331
331
|
* fieldConfidence
|
|
332
332
|
* }
|
|
333
333
|
* }
|
|
334
|
-
* } = await client.
|
|
334
|
+
* } = await client.getDocumentModel(modelId);
|
|
335
335
|
* ```
|
|
336
336
|
*
|
|
337
337
|
* @param modelId - the unique ID of the model to query
|
|
338
338
|
* @param options - optional settings for the request
|
|
339
339
|
* @returns information about the model with the given ID
|
|
340
340
|
*/
|
|
341
|
-
|
|
342
|
-
return this._tracing.withSpan("DocumentModelAdministrationClient.
|
|
341
|
+
getDocumentModel(modelId, options = {}) {
|
|
342
|
+
return this._tracing.withSpan("DocumentModelAdministrationClient.getDocumentModel", options, (finalOptions) => this._restClient.getDocumentModel(modelId, finalOptions));
|
|
343
343
|
}
|
|
344
344
|
/**
|
|
345
345
|
* List summaries of models in the resource. Custom as well as prebuilt models will be included. This operation
|
|
@@ -348,36 +348,36 @@ export class DocumentModelAdministrationClient {
|
|
|
348
348
|
* The model summary ({@link ModelSummary}) includes only the basic information about the model, and does not include
|
|
349
349
|
* information about the document types in the model (such as the field schemas and confidence values).
|
|
350
350
|
*
|
|
351
|
-
* To access the full information about the model, use {@link
|
|
351
|
+
* To access the full information about the model, use {@link getDocumentModel}.
|
|
352
352
|
*
|
|
353
353
|
* ### **Breaking Change**
|
|
354
354
|
*
|
|
355
355
|
* In previous versions of the Form Recognizer REST API and SDK, the `listModels` method would return all models, even
|
|
356
|
-
* those that failed to create due to errors. In the new service versions, `
|
|
357
|
-
* successfully created models_ (i.e. models that are "ready" for use). Failed models are now retrieved
|
|
358
|
-
* "operations" APIs, see {@link getOperation} and {@link listOperations}.
|
|
356
|
+
* those that failed to create due to errors. In the new service versions, `listDocumentModels` and `getDocumentModel`
|
|
357
|
+
* _only produce successfully created models_ (i.e. models that are "ready" for use). Failed models are now retrieved
|
|
358
|
+
* through the "operations" APIs, see {@link getOperation} and {@link listOperations}.
|
|
359
359
|
*
|
|
360
360
|
* ### Examples
|
|
361
361
|
*
|
|
362
362
|
* #### Async Iteration
|
|
363
363
|
*
|
|
364
364
|
* ```javascript
|
|
365
|
-
* for await (const summary of client.
|
|
365
|
+
* for await (const summary of client.listDocumentModels()) {
|
|
366
366
|
* const {
|
|
367
367
|
* modelId, // The model's unique ID
|
|
368
368
|
* description, // a textual description of the model, if provided during model creation
|
|
369
369
|
* } = summary;
|
|
370
370
|
*
|
|
371
|
-
* // You can get the full model info using `
|
|
372
|
-
* const model = await client.
|
|
371
|
+
* // You can get the full model info using `getDocumentModel`
|
|
372
|
+
* const model = await client.getDocumentModel(modelId);
|
|
373
373
|
* }
|
|
374
374
|
* ```
|
|
375
375
|
*
|
|
376
376
|
* #### By Page
|
|
377
377
|
*
|
|
378
378
|
* ```javascript
|
|
379
|
-
* // The
|
|
380
|
-
* const pages = client.
|
|
379
|
+
* // The listDocumentModels method is paged, and you can iterate by page using the `byPage` method.
|
|
380
|
+
* const pages = client.listDocumentModels().byPage();
|
|
381
381
|
*
|
|
382
382
|
* for await (const page of pages) {
|
|
383
383
|
* // Each page is an array of models and can be iterated synchronously
|
|
@@ -387,8 +387,8 @@ export class DocumentModelAdministrationClient {
|
|
|
387
387
|
* description, // a textual description of the model, if provided during model creation
|
|
388
388
|
* } = summary;
|
|
389
389
|
*
|
|
390
|
-
* // You can get the full model info using `
|
|
391
|
-
* const model = await client.
|
|
390
|
+
* // You can get the full model info using `getDocumentModel`
|
|
391
|
+
* const model = await client.getDocumentModel(modelId);
|
|
392
392
|
* }
|
|
393
393
|
* }
|
|
394
394
|
* ```
|
|
@@ -396,11 +396,11 @@ export class DocumentModelAdministrationClient {
|
|
|
396
396
|
* @param options - optional settings for the model requests
|
|
397
397
|
* @returns an async iterable of model summaries that supports paging
|
|
398
398
|
*/
|
|
399
|
-
|
|
400
|
-
return this._restClient.
|
|
399
|
+
listDocumentModels(options = {}) {
|
|
400
|
+
return this._restClient.listDocumentModels(options);
|
|
401
401
|
}
|
|
402
402
|
/**
|
|
403
|
-
* Retrieves information about an operation (`
|
|
403
|
+
* Retrieves information about an operation (`OperationDetails`) by its ID.
|
|
404
404
|
*
|
|
405
405
|
* Operations represent non-analysis tasks, such as building, composing, or copying a model.
|
|
406
406
|
*
|
|
@@ -419,8 +419,8 @@ export class DocumentModelAdministrationClient {
|
|
|
419
419
|
* kind, // the operation kind, one of "documentModelBuild", "documentModelCompose", or "documentModelCopyTo"
|
|
420
420
|
* status, // the status of the operation, one of "notStarted", "running", "failed", "succeeded", or "canceled"
|
|
421
421
|
* percentCompleted, // a number between 0 and 100 representing the progress of the operation
|
|
422
|
-
*
|
|
423
|
-
*
|
|
422
|
+
* createdOn, // a Date object that reflects the time when the operation was started
|
|
423
|
+
* lastUpdatedOn, // a Date object that reflects the time when the operation state was last modified
|
|
424
424
|
* } = await client.getOperation(operationId);
|
|
425
425
|
* ```
|
|
426
426
|
*/
|
|
@@ -481,8 +481,8 @@ export class DocumentModelAdministrationClient {
|
|
|
481
481
|
* @param modelId - the unique ID of the model to delete from the resource
|
|
482
482
|
* @param options - optional settings for the request
|
|
483
483
|
*/
|
|
484
|
-
|
|
485
|
-
return this._tracing.withSpan("DocumentModelAdministrationClient.
|
|
484
|
+
deleteDocumentModel(modelId, options = {}) {
|
|
485
|
+
return this._tracing.withSpan("DocumentModelAdministrationClient.deleteDocumentModel", options, (finalOptions) => this._restClient.deleteDocumentModel(modelId, finalOptions));
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
488
|
//# sourceMappingURL=documentModelAdministrationClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentModelAdministrationClient.js","sourceRoot":"","sources":["../../src/documentModelAdministrationClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAiB,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAEzE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAU1C,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAIL,4BAA4B,GAC7B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAcxC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,OAAO,iCAAiC;IA+D5C,YACE,QAAgB,EAChB,UAA2C,EAC3C,UAAoD,EAAE;QAEtD,IAAI,CAAC,WAAW,GAAG,iBAAiB,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;QACpE,IAAI,CAAC,QAAQ,GAAG,mBAAmB,CAAC;YAClC,WAAW,EAAE,2BAA2B;YACxC,cAAc,EAAE,WAAW;YAC3B,SAAS,EAAE,6BAA6B;SACzC,CAAC,CAAC;IACL,CAAC;IAED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AAQ,CAC3B,gDAAgD,EAChD,OAAO,EACP,CAAC,YAAY,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,WAAW,EAAE,YAAY,CAAC,CAC3E,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACI,cAAc,CACnB,UAAiC,EAAE;QAEnC,OAAO,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAClD,CAAC;IAED;;;;;;;;;;;OAWG;IACI,WAAW,CAAC,OAAe,EAAE,UAA8B,EAAE;QAClE,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAC3B,+CAA+C,EAC/C,OAAO,EACP,CAAC,YAAY,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,EAAE,YAAY,CAAC,CACtE,CAAC;IACJ,CAAC;CAGF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { KeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { TracingClient, createTracingClient } from \"@azure/core-tracing\";\nimport { __decorate } from \"tslib\";\nimport { SDK_VERSION } from \"./constants\";\nimport {\n CopyAuthorization,\n GeneratedClient,\n GetInfoResponse,\n GetOperationResponse,\n ModelInfo,\n ModelSummary,\n OperationInfo,\n} from \"./generated\";\nimport { accept1 } from \"./generated/models/parameters\";\nimport {\n TrainingOperationDefinition,\n TrainingPollOperationState,\n TrainingPoller,\n toTrainingPollOperationState,\n} from \"./lro/training\";\nimport { lro } from \"./lro/util/poller\";\nimport {\n BuildModelOptions,\n CopyModelOptions,\n DeleteModelOptions,\n DocumentModelAdministrationClientOptions,\n GetCopyAuthorizationOptions,\n GetInfoOptions,\n GetModelOptions,\n GetOperationOptions,\n ListModelsOptions,\n ListOperationsOptions,\n} from \"./options\";\nimport { DocumentModelBuildMode } from \"./options/BuildModelOptions\";\nimport { Mappers, SERIALIZER, makeServiceClient } from \"./util\";\n\n/**\n * A client for interacting with the Form Recognizer service's model management features, such as creating, reading,\n * listing, deleting, and copying models.\n *\n * ### Examples:\n *\n * #### Azure Active Directory\n *\n * ```typescript\n * import { DocumentModelAdministrationClient } from \"@azure/ai-form-recognizer\";\n * import { DefaultAzureCredential } from \"@azure/identity\";\n *\n * const endpoint = \"https://<resource name>.cognitiveservices.azure.com\";\n * const credential = new DefaultAzureCredential();\n *\n * const client = new DocumentModelAdministrationClient(endpoint, credential);\n * ```\n *\n * #### API Key (Subscription Key)\n *\n * ```typescript\n * import { DocumentModelAdministrationClient, AzureKeyCredential } from \"@azure/ai-form-recognizer\";\n *\n * const endpoint = \"https://<resource name>.cognitiveservices.azure.com\";\n * const credential = new AzureKeyCredential(\"<api key>\");\n *\n * const client = new DocumentModelAdministrationClient(endpoint, credential);\n * ```\n */\nexport class DocumentModelAdministrationClient {\n private _restClient: GeneratedClient;\n private _tracing: TracingClient;\n\n /**\n * Create a DocumentModelAdministrationClient instance from a resource endpoint and a an Azure Identity `TokenCredential`.\n *\n * See the [`@azure/identity`](https://npmjs.com/package/\\@azure/identity) package for more information about\n * authenticating with Azure Active Directory.\n *\n * ### Example:\n *\n * ```javascript\n * import { DocumentModelAdministrationClient } from \"@azure/ai-form-recognizer\";\n * import { DefaultAzureCredential } from \"@azure/identity\";\n *\n * const endpoint = \"https://<resource name>.cognitiveservices.azure.com\";\n * const credential = new DefaultAzureCredential();\n *\n * const client = new DocumentModelAdministrationClient(endpoint, credential);\n * ```\n *\n * @param endpoint - the endpoint URL of an Azure Cognitive Services instance\n * @param credential - a TokenCredential instance from the `@azure/identity` package\n * @param options - optional settings for configuring all methods in the client\n */\n public constructor(\n endpoint: string,\n credential: TokenCredential,\n options?: DocumentModelAdministrationClientOptions\n );\n /**\n * Create a DocumentModelAdministrationClient instance from a resource endpoint and a static API key\n * (`KeyCredential`),\n *\n * ### Example:\n *\n * ```javascript\n * import { DocumentModelAdministrationClient, AzureKeyCredential } from \"@azure/ai-form-recognizer\";\n *\n * const endpoint = \"https://<resource name>.cognitiveservices.azure.com\";\n * const credential = new AzureKeyCredential(\"<api key>\");\n *\n * const client = new DocumentModelAdministrationClient(endpoint, credential);\n * ```\n *\n * @param endpoint - the endpoint URL of an Azure Cognitive Services instance\n * @param credential - a KeyCredential containing the Cognitive Services instance subscription key\n * @param options - optional settings for configuring all methods in the client\n */\n public constructor(\n endpoint: string,\n credential: KeyCredential,\n options?: DocumentModelAdministrationClientOptions\n );\n /**\n * @hidden\n */\n public constructor(\n endpoint: string,\n credential: KeyCredential | TokenCredential,\n options?: DocumentModelAdministrationClientOptions\n );\n public constructor(\n endpoint: string,\n credential: KeyCredential | TokenCredential,\n options: DocumentModelAdministrationClientOptions = {}\n ) {\n this._restClient = makeServiceClient(endpoint, credential, options);\n this._tracing = createTracingClient({\n packageName: \"@azure/ai-form-recognizer\",\n packageVersion: SDK_VERSION,\n namespace: \"Microsoft.CognitiveServices\",\n });\n }\n\n // #region Model Creation\n\n /**\n * Build a new model with a given ID from a set of input documents and labeled fields.\n *\n * The Model ID can consist of any text, so long as it does not begin with \"prebuilt-\" (as these models refer to\n * prebuilt Form Recognizer models that are common to all resources), and so long as it does not already exist within\n * the resource.\n *\n * The Form Recognizer service reads the training data set from an Azure Storage container, given as a URL to the\n * container with a SAS token that allows the service backend to communicate with the container. At a minimum, the\n * \"read\" and \"list\" permissions are required. In addition, the data in the given container must be organized\n * according to a particular convention, which is documented in [the service's documentation for building custom\n * models](https://aka.ms/form-recognizer/custom).\n *\n * ### Example\n *\n * ```javascript\n * const modelId = \"aNewModel\";\n * const containerUrl = \"<training data container SAS URL>\";\n *\n * const poller = await client.beginBuildModel(modelId, containerUrl, {\n * // Optionally, a text description may be attached to the model\n * description: \"This is an example model!\"\n * });\n *\n * // Model building, like all other model creation operations, returns a poller that eventually produces a ModelInfo\n * // object\n * const modelInfo = await poller.pollUntilDone();\n *\n * const {\n * modelId, // identical to the modelId given when creating the model\n * description, // identical to the description given when creating the model\n * createdDateTime, // the Date (timestamp) that the model was created\n * docTypes // information about the document types in the model and their field schemas\n * } = modelInfo;\n * ```\n *\n * @param modelId - the unique ID of the model to create\n * @param containerUrl - SAS-encoded URL to an Azure Storage container holding the training data set\n * @param buildMode - the mode to use when building the model (see `DocumentModelBuildMode`)\n * @param options - optional settings for the model build operation\n * @returns a long-running operation (poller) that will eventually produce the created model information or an error\n */\n public async beginBuildModel(\n modelId: string,\n containerUrl: string,\n buildMode: DocumentModelBuildMode,\n options: BuildModelOptions = {}\n ): Promise<TrainingPoller> {\n return this._tracing.withSpan(\n \"DocumentModelAdministrationClient.beginBuildModel\",\n options,\n (finalOptions) =>\n this.createTrainingPoller({\n options: finalOptions,\n start: () =>\n this._restClient.buildDocumentModel(\n {\n modelId,\n description: finalOptions.description,\n azureBlobSource: {\n containerUrl,\n },\n buildMode,\n },\n finalOptions\n ),\n })\n );\n }\n\n /**\n * Creates a single composed model from several pre-existing submodels.\n *\n * The resulting composed model combines the document types of its component models, and inserts a classification step\n * into the extraction pipeline to determine which of its component submodels is most appropriate for the given input.\n *\n * ### Example\n *\n * ```javascript\n * const modelId = \"aNewComposedModel\";\n * const subModelIds = [\n * \"documentType1Model\",\n * \"documentType2Model\",\n * \"documentType3Model\"\n * ];\n *\n * // The resulting composed model can classify and extract data from documents\n * // conforming to any of the above document types\n * const poller = await client.beginComposeModel(modelId, subModelIds, {\n * description: \"This is a composed model that can handle several document types.\"\n * });\n *\n * // Model composition, like all other model creation operations, returns a poller that eventually produces a\n * // ModelInfo object\n * const modelInfo = await poller.pollUntilDone();\n *\n * const {\n * modelId, // identical to the modelId given when creating the model\n * description, // identical to the description given when creating the model\n * createdDateTime, // the Date (timestamp) that the model was created\n * docTypes // information about the document types of the composed submodels\n * } = modelInfo;\n * ```\n *\n * @param modelId - the unique ID of the model to create\n * @param componentModelIds - an Iterable of strings representing the unique model IDs of the models to compose\n * @param options - optional settings for model creation\n * @returns a long-running operation (poller) that will eventually produce the created model information or an error\n */\n public async beginComposeModel(\n modelId: string,\n componentModelIds: Iterable<string>,\n options: BuildModelOptions = {}\n ): Promise<TrainingPoller> {\n return this._tracing.withSpan(\n \"DocumentModelAdministrationClient.beginComposeModel\",\n options,\n (finalOptions) =>\n this.createTrainingPoller({\n options: finalOptions,\n start: () =>\n this._restClient.composeDocumentModel(\n {\n modelId,\n componentModels: [...componentModelIds].map((submodelId) => ({\n modelId: submodelId,\n })),\n description: finalOptions.description,\n tags: finalOptions.tags,\n },\n finalOptions\n ),\n })\n );\n }\n\n /**\n * Creates an authorization to copy a model into the resource, used with the `beginCopyModelTo` method.\n *\n * The `CopyAuthorization` grants another cognitive service resource the right to create a model in this client's\n * resource with the model ID and optional description that are encoded into the authorization.\n *\n * ### Example\n *\n * ```javascript\n * // The copyAuthorization data structure stored below grants any cognitive services resource the right to copy a\n * // model into the client's resource with the given destination model ID.\n * const copyAuthorization = await client.getCopyAuthorization(\"<destination model ID>\");\n * ```\n *\n * @param destinationModelId - the unique ID of the destination model (the ID to copy the model into)\n * @param options - optional settings for creating the copy authorization\n * @returns a copy authorization that encodes the given modelId and optional description\n */\n public async getCopyAuthorization(\n destinationModelId: string,\n options: GetCopyAuthorizationOptions = {}\n ): Promise<CopyAuthorization> {\n return this._tracing.withSpan(\n \"DocumentModelAdministrationClient.getCopyAuthorization\",\n options,\n (finalOptions) =>\n this._restClient.authorizeCopyDocumentModel(\n {\n modelId: destinationModelId,\n description: finalOptions.description,\n tags: finalOptions.tags,\n },\n finalOptions\n )\n );\n }\n\n /**\n * Copies a model with the given ID into the resource and model ID encoded by a given copy authorization.\n *\n * See {@link CopyAuthorization} and {@link getCopyAuthorization}.\n *\n * ### Example\n *\n * ```javascript\n * // We need a client for the source model's resource\n * const sourceEndpoint = \"https://<source resource name>.cognitiveservices.azure.com\";\n * const sourceCredential = new AzureKeyCredential(\"<source api key>\");\n * const sourceClient = new DocumentModelAdministrationClient(sourceEndpoint, sourceCredential);\n *\n * // We create the copy authorization using a client authenticated with the destination resource. Note that these two\n * // resources can be the same (you can copy a model to a new ID in the same resource).\n * const copyAuthorization = await client.getCopyAuthorization(\"<destination model ID>\");\n *\n * // Finally, use the _source_ client to copy the model and await the copy operation\n * const poller = await sourceClient.beginCopyModelTo(\"<source model ID>\");\n *\n * // Model copying, like all other model creation operations, returns a poller that eventually produces a ModelInfo\n * // object\n * const modelInfo = await poller.pollUntilDone();\n *\n * const {\n * modelId, // identical to the modelId given when creating the copy authorization\n * description, // identical to the description given when creating the copy authorization\n * createdDateTime, // the Date (timestamp) that the model was created\n * docTypes // information about the document types of the model (identical to the original, source model)\n * } = modelInfo;\n * ```\n *\n * @param sourceModelId - the unique ID of the source model that will be copied\n * @param authorization - an authorization to copy the model, created using the {@link getCopyAuthorization}\n * @param options - optional settings for\n * @returns a long-running operation (poller) that will eventually produce the copied model information or an error\n */\n public async beginCopyModelTo(\n sourceModelId: string,\n authorization: CopyAuthorization,\n options: CopyModelOptions = {}\n ): Promise<TrainingPoller> {\n return this._tracing.withSpan(\n \"DocumentModelAdministrationClient.beginCopyModel\",\n options,\n (finalOptions) =>\n this.createTrainingPoller({\n options: finalOptions,\n start: () =>\n this._restClient.copyDocumentModelTo(sourceModelId, authorization, finalOptions),\n })\n );\n }\n\n /**\n * Create an LRO poller that handles training operations.\n *\n * This is the meat of all training polling operations.\n *\n * @param definition - operation definition (start operation method, request options)\n * @returns a training poller that produces a ModelInfo\n */\n private async createTrainingPoller(\n definition: TrainingOperationDefinition\n ): Promise<TrainingPoller> {\n const { resumeFrom } = definition.options;\n\n const toInit =\n resumeFrom === undefined\n ? () =>\n this._tracing.withSpan(\n \"DocumentModelAdministrationClient.createTrainingPoller-start\",\n definition.options,\n async (options) => {\n const { operationLocation } = await definition.start();\n\n if (operationLocation === undefined) {\n throw new Error(\n \"Unable to start model creation operation: no Operation-Location received.\"\n );\n }\n\n return this._restClient.sendOperationRequest(\n {\n options,\n },\n {\n path: operationLocation,\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.GetOperationResponse,\n },\n default: {\n bodyMapper: Mappers.ErrorResponse,\n },\n },\n headerParameters: [accept1],\n serializer: SERIALIZER,\n }\n ) as Promise<GetOperationResponse>;\n }\n )\n : () =>\n this._tracing.withSpan(\n \"DocumentModelAdministrationClient.createTrainingPoller-resume\",\n definition.options,\n (options) => {\n const { operationId } = JSON.parse(resumeFrom) as { operationId: string };\n\n return this._restClient.getOperation(operationId, options);\n }\n );\n\n const poller = await lro<ModelInfo, TrainingPollOperationState>(\n {\n init: async () => toTrainingPollOperationState(await toInit()),\n poll: async ({ operationId }) =>\n this._tracing.withSpan(\n \"DocumentModelAdminstrationClient.createTrainingPoller-poll\",\n definition.options,\n async (options) => {\n const res = await this._restClient.getOperation(operationId, options);\n\n return toTrainingPollOperationState(res);\n }\n ),\n serialize: ({ operationId }) => JSON.stringify({ operationId }),\n },\n definition.options.updateIntervalInMs\n );\n\n if (definition.options.onProgress !== undefined) {\n poller.onProgress(definition.options.onProgress);\n definition.options.onProgress(poller.getOperationState());\n }\n\n return poller;\n }\n\n // #endregion\n\n // #region Model Management\n\n /**\n * Retrieve basic information about this client's resource.\n *\n * ### Example\n *\n * ```javascript\n * const {\n * // Information about the custom models in the current resource\n * customDocumentModelInfo: {\n * // The number of custom models in the current resource\n * count,\n * // The maximum number of models that the current resource can support\n * limit\n * }\n * } = await client.getInfo();\n * ```\n *\n * @param options - optional settings for the request\n * @returns basic information about this client's resource\n */\n public getInfo(options: GetInfoOptions = {}): Promise<GetInfoResponse> {\n return this._tracing.withSpan(\n \"DocumentModelAdministrationClient.getInfo\",\n options,\n (finalOptions) => this._restClient.getInfo(finalOptions)\n );\n }\n\n /**\n * Retrieves information about a model ({@link ModelInfo}) by ID.\n *\n * This method can retrieve information about custom as well as prebuilt models.\n *\n * ### **Breaking Change**\n *\n * In previous versions of the Form Recognizer REST API and SDK, the `getModel` method could return any model, even\n * one that failed to create due to errors. In the new service versions, `getModel` and `listModels` _only produce\n * successfully created models_ (i.e. models that are \"ready\" for use). Failed models are now retrieved through the\n * \"operations\" APIs, see {@link getOperation} and {@link listOperations}.\n *\n * ### Example\n *\n * ```javascript\n * // The ID of the prebuilt business card model\n * const modelId = \"prebuilt-businessCard\";\n *\n * const {\n * modelId, // identical to the modelId given when calling `getModel`\n * description, // a textual description of the model, if provided during model creation\n * createdDateTime, // the Date (timestamp) that the model was created\n * // information about the document types in the model and their field schemas\n * docTypes: {\n * // the document type of the prebuilt business card model\n * \"prebuilt:businesscard\": {\n * // an optional, textual description of this document type\n * description,\n * // the schema of the fields in this document type, see the FieldSchema type\n * fieldSchema,\n * // the service's confidences in the fields (an object with field names as properties and numeric confidence\n * // values)\n * fieldConfidence\n * }\n * }\n * } = await client.getModel(modelId);\n * ```\n *\n * @param modelId - the unique ID of the model to query\n * @param options - optional settings for the request\n * @returns information about the model with the given ID\n */\n public getModel(modelId: string, options: GetModelOptions = {}): Promise<ModelInfo> {\n return this._tracing.withSpan(\n \"DocumentModelAdministrationClient.getModel\",\n options,\n (finalOptions) => this._restClient.getModel(modelId, finalOptions)\n );\n }\n\n /**\n * List summaries of models in the resource. Custom as well as prebuilt models will be included. This operation\n * supports paging.\n *\n * The model summary ({@link ModelSummary}) includes only the basic information about the model, and does not include\n * information about the document types in the model (such as the field schemas and confidence values).\n *\n * To access the full information about the model, use {@link getModel}.\n *\n * ### **Breaking Change**\n *\n * In previous versions of the Form Recognizer REST API and SDK, the `listModels` method would return all models, even\n * those that failed to create due to errors. In the new service versions, `listModels` and `getModels` _only produce\n * successfully created models_ (i.e. models that are \"ready\" for use). Failed models are now retrieved through the\n * \"operations\" APIs, see {@link getOperation} and {@link listOperations}.\n *\n * ### Examples\n *\n * #### Async Iteration\n *\n * ```javascript\n * for await (const summary of client.listModels()) {\n * const {\n * modelId, // The model's unique ID\n * description, // a textual description of the model, if provided during model creation\n * } = summary;\n *\n * // You can get the full model info using `getModel`\n * const model = await client.getModel(modelId);\n * }\n * ```\n *\n * #### By Page\n *\n * ```javascript\n * // The listModels method is paged, and you can iterate by page using the `byPage` method.\n * const pages = client.listModels().byPage();\n *\n * for await (const page of pages) {\n * // Each page is an array of models and can be iterated synchronously\n * for (const model of page) {\n * const {\n * modelId, // The model's unique ID\n * description, // a textual description of the model, if provided during model creation\n * } = summary;\n *\n * // You can get the full model info using `getModel`\n * const model = await client.getModel(modelId);\n * }\n * }\n * ```\n *\n * @param options - optional settings for the model requests\n * @returns an async iterable of model summaries that supports paging\n */\n public listModels(options: ListModelsOptions = {}): PagedAsyncIterableIterator<ModelSummary> {\n return this._restClient.listModels(options);\n }\n\n /**\n * Retrieves information about an operation (`OperationInfo`) by its ID.\n *\n * Operations represent non-analysis tasks, such as building, composing, or copying a model.\n *\n * @param operationId - the ID of the operation to query\n * @param options - optional settings for the request\n * @returns information about the operation with the given ID\n *\n * ### Example\n *\n * ```javascript\n * // The ID of the operation, which should be a GUID\n * const operationId = \"<operation GUID>\";\n *\n * const {\n * operationId, // identical to the operationId given when calling `getOperation`\n * kind, // the operation kind, one of \"documentModelBuild\", \"documentModelCompose\", or \"documentModelCopyTo\"\n * status, // the status of the operation, one of \"notStarted\", \"running\", \"failed\", \"succeeded\", or \"canceled\"\n * percentCompleted, // a number between 0 and 100 representing the progress of the operation\n * createdDateTime, // a Date object that reflects the time when the operation was started\n * lastUpdatedDateTime, // a Date object that reflects the time when the operation state was last modified\n * } = await client.getOperation(operationId);\n * ```\n */\n public getOperation(\n operationId: string,\n options: GetOperationOptions = {}\n ): Promise<OperationInfo> {\n return this._tracing.withSpan(\n \"DocumentModelAdministrationClient.getOperation\",\n options,\n (finalOptions) => this._restClient.getOperation(operationId, finalOptions)\n );\n }\n\n /**\n * List model creation operations in the resource. This will produce all operations, including operations that failed\n * to create models successfully. This operation supports paging.\n *\n * ### Examples\n *\n * #### Async Iteration\n *\n * ```javascript\n * for await (const operation of client.listOperations()) {\n * const {\n * operationId, // the operation's GUID\n * status, // the operation status, one of \"notStarted\", \"running\", \"succeeded\", \"failed\", or \"canceled\"\n * percentCompleted // the progress of the operation, from 0 to 100\n * } = operation;\n * }\n * ```\n *\n * #### By Page\n *\n * ```javascript\n * // The listOperations method is paged, and you can iterate by page using the `byPage` method.\n * const pages = client.listOperations().byPage();\n *\n * for await (const page of pages) {\n * // Each page is an array of operation info objects and can be iterated synchronously\n * for (const operation of page) {\n * const {\n * operationId, // the operation's GUID\n * status, // the operation status, one of \"notStarted\", \"running\", \"succeeded\", \"failed\", or \"canceled\"\n * percentCompleted // the progress of the operation, from 0 to 100\n * } = operation;\n * }\n * }\n * ```\n *\n * @param options - optional settings for the operation requests\n * @returns an async iterable of operation information objects that supports paging\n */\n public listOperations(\n options: ListOperationsOptions = {}\n ): PagedAsyncIterableIterator<OperationInfo> {\n return this._restClient.listOperations(options);\n }\n\n /**\n * Deletes a model with the given ID from the client's resource, if it exists. This operation CANNOT be reverted.\n *\n * ### Example\n *\n * ```javascript\n * await client.deleteModel(\"<model ID to delete>\"));\n * ```\n *\n * @param modelId - the unique ID of the model to delete from the resource\n * @param options - optional settings for the request\n */\n public deleteModel(modelId: string, options: DeleteModelOptions = {}): Promise<void> {\n return this._tracing.withSpan(\n \"DocumentModelAdministrationClient.deleteModel\",\n options,\n (finalOptions) => this._restClient.deleteModel(modelId, finalOptions)\n );\n }\n\n // #endregion\n}\n"]}
|
|
1
|
+
{"version":3,"file":"documentModelAdministrationClient.js","sourceRoot":"","sources":["../../src/documentModelAdministrationClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAiB,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAEzE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAW1C,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAIL,4BAA4B,GAC7B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,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AQ,CAC3B,oDAAoD,EACpD,OAAO,EACP,CAAC,YAAY,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,OAAO,EAAE,YAAY,CAAC,CAC3E,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsDG;IACI,kBAAkB,CACvB,UAA6B,EAAE;QAE/B,OAAO,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACtD,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACI,YAAY,CACjB,WAAmB,EACnB,UAA+B,EAAE;QAEjC,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAC3B,gDAAgD,EAChD,OAAO,EACP,CAAC,YAAY,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,WAAW,EAAE,YAAY,CAAC,CAC3E,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACI,cAAc,CACnB,UAAiC,EAAE;QAEnC,OAAO,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAClD,CAAC;IAED;;;;;;;;;;;OAWG;IACI,mBAAmB,CACxB,OAAe,EACf,UAAsC,EAAE;QAExC,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAC3B,uDAAuD,EACvD,OAAO,EACP,CAAC,YAAY,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,OAAO,EAAE,YAAY,CAAC,CAC9E,CAAC;IACJ,CAAC;CAGF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { KeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { TracingClient, createTracingClient } from \"@azure/core-tracing\";\nimport { __decorate } from \"tslib\";\nimport { SDK_VERSION } from \"./constants\";\nimport {\n CopyAuthorization,\n GeneratedClient,\n ResourceDetails,\n GetOperationResponse,\n DocumentModelDetails,\n DocumentModelSummary,\n OperationSummary,\n OperationDetails,\n} from \"./generated\";\nimport { accept1 } from \"./generated/models/parameters\";\nimport {\n TrainingOperationDefinition,\n DocumentModelOperationState,\n DocumentModelPoller,\n toTrainingPollOperationState,\n} from \"./lro/administration\";\nimport { lro } from \"./lro/util/poller\";\nimport {\n BeginCopyModelOptions,\n DeleteDocumentModelOptions,\n DocumentModelAdministrationClientOptions,\n GetCopyAuthorizationOptions,\n GetResourceDetailsOptions,\n GetModelOptions,\n GetOperationOptions,\n ListModelsOptions,\n ListOperationsOptions,\n} from \"./options\";\nimport {\n BeginBuildDocumentModelOptions,\n BeginComposeDocumentModelOptions,\n DocumentModelBuildMode,\n} from \"./options/BuildModelOptions\";\nimport { Mappers, SERIALIZER, makeServiceClient } from \"./util\";\n\n/**\n * A client for interacting with the Form Recognizer service's model management features, such as creating, reading,\n * listing, deleting, and copying models.\n *\n * ### Examples:\n *\n * #### Azure Active Directory\n *\n * ```typescript\n * import { DocumentModelAdministrationClient } from \"@azure/ai-form-recognizer\";\n * import { DefaultAzureCredential } from \"@azure/identity\";\n *\n * const endpoint = \"https://<resource name>.cognitiveservices.azure.com\";\n * const credential = new DefaultAzureCredential();\n *\n * const client = new DocumentModelAdministrationClient(endpoint, credential);\n * ```\n *\n * #### API Key (Subscription Key)\n *\n * ```typescript\n * import { DocumentModelAdministrationClient, AzureKeyCredential } from \"@azure/ai-form-recognizer\";\n *\n * const endpoint = \"https://<resource name>.cognitiveservices.azure.com\";\n * const credential = new AzureKeyCredential(\"<api key>\");\n *\n * const client = new DocumentModelAdministrationClient(endpoint, credential);\n * ```\n */\nexport class DocumentModelAdministrationClient {\n private _restClient: GeneratedClient;\n private _tracing: TracingClient;\n\n /**\n * Create a DocumentModelAdministrationClient instance from a resource endpoint and a an Azure Identity `TokenCredential`.\n *\n * See the [`@azure/identity`](https://npmjs.com/package/\\@azure/identity) package for more information about\n * authenticating with Azure Active Directory.\n *\n * ### Example:\n *\n * ```javascript\n * import { DocumentModelAdministrationClient } from \"@azure/ai-form-recognizer\";\n * import { DefaultAzureCredential } from \"@azure/identity\";\n *\n * const endpoint = \"https://<resource name>.cognitiveservices.azure.com\";\n * const credential = new DefaultAzureCredential();\n *\n * const client = new DocumentModelAdministrationClient(endpoint, credential);\n * ```\n *\n * @param endpoint - the endpoint URL of an Azure Cognitive Services instance\n * @param credential - a TokenCredential instance from the `@azure/identity` package\n * @param options - optional settings for configuring all methods in the client\n */\n public constructor(\n endpoint: string,\n credential: TokenCredential,\n options?: DocumentModelAdministrationClientOptions\n );\n /**\n * Create a DocumentModelAdministrationClient instance from a resource endpoint and a static API key\n * (`KeyCredential`),\n *\n * ### Example:\n *\n * ```javascript\n * import { DocumentModelAdministrationClient, AzureKeyCredential } from \"@azure/ai-form-recognizer\";\n *\n * const endpoint = \"https://<resource name>.cognitiveservices.azure.com\";\n * const credential = new AzureKeyCredential(\"<api key>\");\n *\n * const client = new DocumentModelAdministrationClient(endpoint, credential);\n * ```\n *\n * @param endpoint - the endpoint URL of an Azure Cognitive Services instance\n * @param credential - a KeyCredential containing the Cognitive Services instance subscription key\n * @param options - optional settings for configuring all methods in the client\n */\n public constructor(\n endpoint: string,\n credential: KeyCredential,\n options?: DocumentModelAdministrationClientOptions\n );\n /**\n * @hidden\n */\n public constructor(\n endpoint: string,\n credential: KeyCredential | TokenCredential,\n options?: DocumentModelAdministrationClientOptions\n );\n public constructor(\n endpoint: string,\n credential: KeyCredential | TokenCredential,\n options: DocumentModelAdministrationClientOptions = {}\n ) {\n this._restClient = makeServiceClient(endpoint, credential, options);\n this._tracing = createTracingClient({\n packageName: \"@azure/ai-form-recognizer\",\n packageVersion: SDK_VERSION,\n namespace: \"Microsoft.CognitiveServices\",\n });\n }\n\n // #region Model Creation\n\n /**\n * Build a new model with a given ID from a set of input documents and labeled fields.\n *\n * The Model ID can consist of any text, so long as it does not begin with \"prebuilt-\" (as these models refer to\n * prebuilt Form Recognizer models that are common to all resources), and so long as it does not already exist within\n * the resource.\n *\n * The Form Recognizer service reads the training data set from an Azure Storage container, given as a URL to the\n * container with a SAS token that allows the service backend to communicate with the container. At a minimum, the\n * \"read\" and \"list\" permissions are required. In addition, the data in the given container must be organized\n * according to a particular convention, which is documented in [the service's documentation for building custom\n * models](https://aka.ms/form-recognizer/custom).\n *\n * ### Example\n *\n * ```javascript\n * const modelId = \"aNewModel\";\n * const containerUrl = \"<training data container SAS URL>\";\n *\n * const poller = await client.beginBuildDocumentModel(modelId, containerUrl, {\n * // Optionally, a text description may be attached to the model\n * description: \"This is an example model!\"\n * });\n *\n * // Model building, like all other model creation operations, returns a poller that eventually produces a ModelDetails\n * // object\n * const modelDetails = await poller.pollUntilDone();\n *\n * const {\n * modelId, // identical to the modelId given when creating the model\n * description, // identical to the description given when creating the model\n * createdOn, // the Date (timestamp) that the model was created\n * docTypes // information about the document types in the model and their field schemas\n * } = modelDetails;\n * ```\n *\n * @param modelId - the unique ID of the model to create\n * @param containerUrl - SAS-encoded URL to an Azure Storage container holding the training data set\n * @param buildMode - the mode to use when building the model (see `DocumentModelBuildMode`)\n * @param options - optional settings for the model build operation\n * @returns a long-running operation (poller) that will eventually produce the created model information or an error\n */\n public async beginBuildDocumentModel(\n modelId: string,\n containerUrl: string,\n buildMode: DocumentModelBuildMode,\n options: BeginBuildDocumentModelOptions = {}\n ): Promise<DocumentModelPoller> {\n return this._tracing.withSpan(\n \"DocumentModelAdministrationClient.beginBuildDocumentModel\",\n options,\n (finalOptions) =>\n this.createDocumentModelPoller({\n options: finalOptions,\n start: () =>\n this._restClient.buildDocumentModel(\n {\n modelId,\n description: finalOptions.description,\n azureBlobSource: {\n containerUrl,\n },\n buildMode,\n },\n finalOptions\n ),\n })\n );\n }\n\n /**\n * Creates a single composed model from several pre-existing submodels.\n *\n * The resulting composed model combines the document types of its component models, and inserts a classification step\n * into the extraction pipeline to determine which of its component submodels is most appropriate for the given input.\n *\n * ### Example\n *\n * ```javascript\n * const modelId = \"aNewComposedModel\";\n * const subModelIds = [\n * \"documentType1Model\",\n * \"documentType2Model\",\n * \"documentType3Model\"\n * ];\n *\n * // The resulting composed model can classify and extract data from documents\n * // conforming to any of the above document types\n * const poller = await client.beginComposeDocumentModel(modelId, subModelIds, {\n * description: \"This is a composed model that can handle several document types.\"\n * });\n *\n * // Model composition, like all other model creation operations, returns a poller that eventually produces a\n * // ModelDetails object\n * const modelDetails = await poller.pollUntilDone();\n *\n * const {\n * modelId, // identical to the modelId given when creating the model\n * description, // identical to the description given when creating the model\n * createdOn, // the Date (timestamp) that the model was created\n * docTypes // information about the document types of the composed submodels\n * } = modelDetails;\n * ```\n *\n * @param modelId - the unique ID of the model to create\n * @param componentModelIds - an Iterable of strings representing the unique model IDs of the models to compose\n * @param options - optional settings for model creation\n * @returns a long-running operation (poller) that will eventually produce the created model information or an error\n */\n public async beginComposeDocumentModel(\n modelId: string,\n componentModelIds: Iterable<string>,\n options: BeginComposeDocumentModelOptions = {}\n ): Promise<DocumentModelPoller> {\n return this._tracing.withSpan(\n \"DocumentModelAdministrationClient.beginComposeDocumentModel\",\n options,\n (finalOptions) =>\n this.createDocumentModelPoller({\n options: finalOptions,\n start: () =>\n this._restClient.composeDocumentModel(\n {\n modelId,\n componentModels: [...componentModelIds].map((submodelId) => ({\n modelId: submodelId,\n })),\n description: finalOptions.description,\n tags: finalOptions.tags,\n },\n finalOptions\n ),\n })\n );\n }\n\n /**\n * Creates an authorization to copy a model into the resource, used with the `beginCopyModelTo` method.\n *\n * The `CopyAuthorization` grants another cognitive service resource the right to create a model in this client's\n * resource with the model ID and optional description that are encoded into the authorization.\n *\n * ### Example\n *\n * ```javascript\n * // The copyAuthorization data structure stored below grants any cognitive services resource the right to copy a\n * // model into the client's resource with the given destination model ID.\n * const copyAuthorization = await client.getCopyAuthorization(\"<destination model ID>\");\n * ```\n *\n * @param destinationModelId - the unique ID of the destination model (the ID to copy the model into)\n * @param options - optional settings for creating the copy authorization\n * @returns a copy authorization that encodes the given modelId and optional description\n */\n public async getCopyAuthorization(\n destinationModelId: string,\n options: GetCopyAuthorizationOptions = {}\n ): Promise<CopyAuthorization> {\n return this._tracing.withSpan(\n \"DocumentModelAdministrationClient.getCopyAuthorization\",\n options,\n (finalOptions) =>\n this._restClient.authorizeCopyDocumentModel(\n {\n modelId: destinationModelId,\n description: finalOptions.description,\n tags: finalOptions.tags,\n },\n finalOptions\n )\n );\n }\n\n /**\n * Copies a model with the given ID into the resource and model ID encoded by a given copy authorization.\n *\n * See {@link CopyAuthorization} and {@link getCopyAuthorization}.\n *\n * ### Example\n *\n * ```javascript\n * // We need a client for the source model's resource\n * const sourceEndpoint = \"https://<source resource name>.cognitiveservices.azure.com\";\n * const sourceCredential = new AzureKeyCredential(\"<source api key>\");\n * const sourceClient = new DocumentModelAdministrationClient(sourceEndpoint, sourceCredential);\n *\n * // We create the copy authorization using a client authenticated with the destination resource. Note that these two\n * // resources can be the same (you can copy a model to a new ID in the same resource).\n * const copyAuthorization = await client.getCopyAuthorization(\"<destination model ID>\");\n *\n * // Finally, use the _source_ client to copy the model and await the copy operation\n * const poller = await sourceClient.beginCopyModelTo(\"<source model ID>\");\n *\n * // Model copying, like all other model creation operations, returns a poller that eventually produces a ModelDetails\n * // object\n * const modelDetails = await poller.pollUntilDone();\n *\n * const {\n * modelId, // identical to the modelId given when creating the copy authorization\n * description, // identical to the description given when creating the copy authorization\n * createdOn, // the Date (timestamp) that the model was created\n * docTypes // information about the document types of the model (identical to the original, source model)\n * } = modelDetails;\n * ```\n *\n * @param sourceModelId - the unique ID of the source model that will be copied\n * @param authorization - an authorization to copy the model, created using the {@link getCopyAuthorization}\n * @param options - optional settings for\n * @returns a long-running operation (poller) that will eventually produce the copied model information or an error\n */\n public async beginCopyModelTo(\n sourceModelId: string,\n authorization: CopyAuthorization,\n options: BeginCopyModelOptions = {}\n ): Promise<DocumentModelPoller> {\n return this._tracing.withSpan(\n \"DocumentModelAdministrationClient.beginCopyModel\",\n options,\n (finalOptions) =>\n this.createDocumentModelPoller({\n options: finalOptions,\n start: () =>\n this._restClient.copyDocumentModelTo(sourceModelId, authorization, finalOptions),\n })\n );\n }\n\n /**\n * Create an LRO poller that handles model creation operations.\n *\n * This is the meat of the above model creation operations.\n *\n * @param definition - operation definition (start operation method, request options)\n * @returns a model poller (produces a ModelDetails)\n */\n private async createDocumentModelPoller(\n definition: TrainingOperationDefinition\n ): Promise<DocumentModelPoller> {\n const { resumeFrom } = definition.options;\n\n const toInit =\n resumeFrom === undefined\n ? () =>\n this._tracing.withSpan(\n \"DocumentModelAdministrationClient.createDocumentModelPoller-start\",\n definition.options,\n async (options) => {\n const { operationLocation } = await definition.start();\n\n if (operationLocation === undefined) {\n throw new Error(\n \"Unable to start model creation operation: no Operation-Location received.\"\n );\n }\n\n return this._restClient.sendOperationRequest(\n {\n options,\n },\n {\n path: operationLocation,\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.OperationDetails,\n },\n default: {\n bodyMapper: Mappers.ErrorResponse,\n },\n },\n headerParameters: [accept1],\n serializer: SERIALIZER,\n }\n ) as Promise<GetOperationResponse>;\n }\n )\n : () =>\n this._tracing.withSpan(\n \"DocumentModelAdministrationClient.createDocumentModelPoller-resume\",\n definition.options,\n (options) => {\n const { operationId } = JSON.parse(resumeFrom) as { operationId: string };\n\n return this._restClient.getOperation(operationId, options);\n }\n );\n\n const poller = await lro<DocumentModelDetails, DocumentModelOperationState>(\n {\n init: async () => toTrainingPollOperationState(await toInit()),\n poll: async ({ operationId }) =>\n this._tracing.withSpan(\n \"DocumentModelAdminstrationClient.createDocumentModelPoller-poll\",\n definition.options,\n async (options) => {\n const res = await this._restClient.getOperation(operationId, options);\n\n return toTrainingPollOperationState(res);\n }\n ),\n serialize: ({ operationId }) => JSON.stringify({ operationId }),\n },\n definition.options.updateIntervalInMs\n );\n\n if (definition.options.onProgress !== undefined) {\n poller.onProgress(definition.options.onProgress);\n definition.options.onProgress(poller.getOperationState());\n }\n\n return poller;\n }\n\n // #endregion\n\n // #region Model Management\n\n /**\n * Retrieve basic information about this client's resource.\n *\n * ### Example\n *\n * ```javascript\n * const {\n * // Information about the custom models in the current resource\n * customDocumentModelDetails: {\n * // The number of custom models in the current resource\n * count,\n * // The maximum number of models that the current resource can support\n * limit\n * }\n * } = await client.getResourceDetails();\n * ```\n *\n * @param options - optional settings for the request\n * @returns basic information about this client's resource\n */\n public getResourceDetails(options: GetResourceDetailsOptions = {}): Promise<ResourceDetails> {\n return this._tracing.withSpan(\n \"DocumentModelAdministrationClient.getResourceDetails\",\n options,\n (finalOptions) => this._restClient.getResourceDetails(finalOptions)\n );\n }\n\n /**\n * Retrieves information about a model ({@link ModelDetails}) by ID.\n *\n * This method can retrieve information about custom as well as prebuilt models.\n *\n * ### **Breaking Change**\n *\n * In previous versions of the Form Recognizer REST API and SDK, the `getModel` method could return any model, even\n * one that failed to create due to errors. In the new service versions, `getDocumentModel` and `listDocumentModels`\n * _only produce successfully created models_ (i.e. models that are \"ready\" for use). Failed models are now retrieved\n * through the \"operations\" APIs, see {@link getOperation} and {@link listOperations}.\n *\n * ### Example\n *\n * ```javascript\n * // The ID of the prebuilt business card model\n * const modelId = \"prebuilt-businessCard\";\n *\n * const {\n * modelId, // identical to the modelId given when calling `getDocumentModel`\n * description, // a textual description of the model, if provided during model creation\n * createdOn, // the Date (timestamp) that the model was created\n * // information about the document types in the model and their field schemas\n * docTypes: {\n * // the document type of the prebuilt business card model\n * \"prebuilt:businesscard\": {\n * // an optional, textual description of this document type\n * description,\n * // the schema of the fields in this document type, see the FieldSchema type\n * fieldSchema,\n * // the service's confidences in the fields (an object with field names as properties and numeric confidence\n * // values)\n * fieldConfidence\n * }\n * }\n * } = await client.getDocumentModel(modelId);\n * ```\n *\n * @param modelId - the unique ID of the model to query\n * @param options - optional settings for the request\n * @returns information about the model with the given ID\n */\n public getDocumentModel(\n modelId: string,\n options: GetModelOptions = {}\n ): Promise<DocumentModelDetails> {\n return this._tracing.withSpan(\n \"DocumentModelAdministrationClient.getDocumentModel\",\n options,\n (finalOptions) => this._restClient.getDocumentModel(modelId, finalOptions)\n );\n }\n\n /**\n * List summaries of models in the resource. Custom as well as prebuilt models will be included. This operation\n * supports paging.\n *\n * The model summary ({@link ModelSummary}) includes only the basic information about the model, and does not include\n * information about the document types in the model (such as the field schemas and confidence values).\n *\n * To access the full information about the model, use {@link getDocumentModel}.\n *\n * ### **Breaking Change**\n *\n * In previous versions of the Form Recognizer REST API and SDK, the `listModels` method would return all models, even\n * those that failed to create due to errors. In the new service versions, `listDocumentModels` and `getDocumentModel`\n * _only produce successfully created models_ (i.e. models that are \"ready\" for use). Failed models are now retrieved\n * through the \"operations\" APIs, see {@link getOperation} and {@link listOperations}.\n *\n * ### Examples\n *\n * #### Async Iteration\n *\n * ```javascript\n * for await (const summary of client.listDocumentModels()) {\n * const {\n * modelId, // The model's unique ID\n * description, // a textual description of the model, if provided during model creation\n * } = summary;\n *\n * // You can get the full model info using `getDocumentModel`\n * const model = await client.getDocumentModel(modelId);\n * }\n * ```\n *\n * #### By Page\n *\n * ```javascript\n * // The listDocumentModels method is paged, and you can iterate by page using the `byPage` method.\n * const pages = client.listDocumentModels().byPage();\n *\n * for await (const page of pages) {\n * // Each page is an array of models and can be iterated synchronously\n * for (const model of page) {\n * const {\n * modelId, // The model's unique ID\n * description, // a textual description of the model, if provided during model creation\n * } = summary;\n *\n * // You can get the full model info using `getDocumentModel`\n * const model = await client.getDocumentModel(modelId);\n * }\n * }\n * ```\n *\n * @param options - optional settings for the model requests\n * @returns an async iterable of model summaries that supports paging\n */\n public listDocumentModels(\n options: ListModelsOptions = {}\n ): PagedAsyncIterableIterator<DocumentModelSummary> {\n return this._restClient.listDocumentModels(options);\n }\n\n /**\n * Retrieves information about an operation (`OperationDetails`) by its ID.\n *\n * Operations represent non-analysis tasks, such as building, composing, or copying a model.\n *\n * @param operationId - the ID of the operation to query\n * @param options - optional settings for the request\n * @returns information about the operation with the given ID\n *\n * ### Example\n *\n * ```javascript\n * // The ID of the operation, which should be a GUID\n * const operationId = \"<operation GUID>\";\n *\n * const {\n * operationId, // identical to the operationId given when calling `getOperation`\n * kind, // the operation kind, one of \"documentModelBuild\", \"documentModelCompose\", or \"documentModelCopyTo\"\n * status, // the status of the operation, one of \"notStarted\", \"running\", \"failed\", \"succeeded\", or \"canceled\"\n * percentCompleted, // a number between 0 and 100 representing the progress of the operation\n * createdOn, // a Date object that reflects the time when the operation was started\n * lastUpdatedOn, // a Date object that reflects the time when the operation state was last modified\n * } = await client.getOperation(operationId);\n * ```\n */\n public getOperation(\n operationId: string,\n options: GetOperationOptions = {}\n ): Promise<OperationDetails> {\n return this._tracing.withSpan(\n \"DocumentModelAdministrationClient.getOperation\",\n options,\n (finalOptions) => this._restClient.getOperation(operationId, finalOptions)\n );\n }\n\n /**\n * List model creation operations in the resource. This will produce all operations, including operations that failed\n * to create models successfully. This operation supports paging.\n *\n * ### Examples\n *\n * #### Async Iteration\n *\n * ```javascript\n * for await (const operation of client.listOperations()) {\n * const {\n * operationId, // the operation's GUID\n * status, // the operation status, one of \"notStarted\", \"running\", \"succeeded\", \"failed\", or \"canceled\"\n * percentCompleted // the progress of the operation, from 0 to 100\n * } = operation;\n * }\n * ```\n *\n * #### By Page\n *\n * ```javascript\n * // The listOperations method is paged, and you can iterate by page using the `byPage` method.\n * const pages = client.listOperations().byPage();\n *\n * for await (const page of pages) {\n * // Each page is an array of operation info objects and can be iterated synchronously\n * for (const operation of page) {\n * const {\n * operationId, // the operation's GUID\n * status, // the operation status, one of \"notStarted\", \"running\", \"succeeded\", \"failed\", or \"canceled\"\n * percentCompleted // the progress of the operation, from 0 to 100\n * } = operation;\n * }\n * }\n * ```\n *\n * @param options - optional settings for the operation requests\n * @returns an async iterable of operation information objects that supports paging\n */\n public listOperations(\n options: ListOperationsOptions = {}\n ): PagedAsyncIterableIterator<OperationSummary> {\n return this._restClient.listOperations(options);\n }\n\n /**\n * Deletes a model with the given ID from the client's resource, if it exists. This operation CANNOT be reverted.\n *\n * ### Example\n *\n * ```javascript\n * await client.deleteModel(\"<model ID to delete>\"));\n * ```\n *\n * @param modelId - the unique ID of the model to delete from the resource\n * @param options - optional settings for the request\n */\n public deleteDocumentModel(\n modelId: string,\n options: DeleteDocumentModelOptions = {}\n ): Promise<void> {\n return this._tracing.withSpan(\n \"DocumentModelAdministrationClient.deleteDocumentModel\",\n options,\n (finalOptions) => this._restClient.deleteDocumentModel(modelId, finalOptions)\n );\n }\n\n // #endregion\n}\n"]}
|