Creates an instance of FormTrainingClient.
Example usage:
import {FormTrainingClient, AzureKeyCredential } from "@azure/ai-form-recognizer";
const client = new FormTrainingClient(
"<service endpoint>",
new AzureKeyCredential("<api key>")
);
Url to an Azure Form Recognizer service endpoint
Used to authenticate requests to the service.
Used to configure the client.
Url to an Azure Form Recognizer service endpoint
Copies a custom model from this resource (the source) to the specified target Form Recognizer resource. This method returns a long running operation poller that allows you to wait indefinitely until the operation is completed. Note that the onProgress callback will not be invoked if the operation completes in the first request, and attempting to cancel a completed copy will result in an error being thrown.
Example usage:
const targetClient = new FormTrainingClient(targetEndpoint, new AzureKeyCredential(targetApiKey));
const authorization = await targetClient.getCopyAuthorization(targetResourceId, targetResourceRegion);
const sourceClient = new FormTrainingClient(endpoint, new AzureKeyCredential(apiKey));
const poller = await sourceClient.beginCopyModel(sourceModelId, authorization, {
onProgress: (state) => {
console.log(`Copy model status: ${state.status}`);
}
});
const result = await poller.pollUntilDone();
Copies custom model to target resource
Id of the custom model in this resource to be copied to the target Form Recognizer resource
Copy authorization produced by calling targetTrainingClient.getCopyAuthorization()
Options to copy model operation
Combines pre-existing models with labels into a single composed model.
The composed model will contain copies of all of its input submodels, and it will choose (using a machine learning algorithm) the most appropriate of its input models to use during form recognition.
This method returns a long-running operation poller that allows you to wait indefinitely until the operation is completed.
Notes:
Example usage:
const modelIds = ["<model ID 1>", "<model ID 2>", "<model ID 3>"];
const trainingClient = new FormTrainingClient(endpoint, new AzureKeyCredential(apiKey));
const poller = await trainingClient.beginCreateComposedModel(modelIds, {
modelName: "<optional name for the composed model>",
onProgress: (state) => { console.log("training status: "); console.log(state); }
});
const composedModel = await poller.pollUntilDone();
Combines pre-existing models with labels into a single composed model.
An array of model IDs within the Form Recognizer resouce to compose
Options to start the create composed model operation
Creates and trains a custom form model.
If the useTrainingLabels
parameter is set to true
, then the operation will search
for label files in addition to the training documents, and it will create a labeled
model with the field names specified by the labels. Otherwise, it will create an
unlabeled model automatically that returns generated field names for the items it
determines are fields within the document structure.
This method returns a long-running operation poller that allows you to wait indefinitely until the operation is completed.
Notes:
Example usage:
const trainingFilesUrl = "<url to the blob container storing training documents>";
const trainingClient = new FormTrainingClient(endpoint, new AzureKeyCredential(apiKey));
const poller = await trainingClient.beginTraining(trainingFilesUrl, false, {
onProgress: (state) => { console.log("training status: "); console.log(state); }
});
const model = await poller.pollUntilDone();
Creates and trains a custom form model.
Accessible url to an Azure Storage Blob container storing the training documents and optional label files
Specifies whether or not to search for and train using label files
Options to start the model training operation
Mark model for deletion. Model artifacts will be permanently removed within 48 hours.
Id of the model to mark for deletion
Options to the Delete Model operation
Retrieves summary information about the cognitive service account
Options to GetSummary operation
Generate an authorization for copying a custom model into this Azure Form Recognizer resource.
This method should be called on a client that is authenticated using the target resource (where the
model will be copied to) credentials, and the output can be passed as the target
parameter to the
beginCopyModel
method of a source client.
The required resourceId
and resourceRegion
are properties of an Azure Form Recognizer resource and their values can be found in the Azure Portal.
Id of the Azure Form Recognizer resource where a custom model will be copied to
Location of the Azure Form Recognizer resource, must be a valid region name supported by Azure Cognitive Services. See https://aka.ms/azsdk/cognitiveservices/regionalavailability for information about the regional availability of Azure Cognitive Services.
Options to get copy authorization operation
The authorization to copy a custom model
Get detailed information about a custom model from training.
Id of the model to get information
Options to the Get Model operation
Creates an instance of FormTrainingClient to perform training operations and to manage trained custom form models.
Returns an async iterable iterator to list information about all models in the cognitive service account.
.byPage() returns an async iterable iterator to list the blobs in pages.
Example using for await
syntax:
const client = new FormTrainingClient(endpoint, new AzureKeyCredential(apiKey));
const result = client.listCustomModels();
let i = 1;
for await (const model of result) {
console.log(`model ${i++}:`);
console.log(model);
}
Example using iter.next()
:
let i = 1;
let iter = client.listCustomModels();
let modelItem = await iter.next();
while (!modelItem.done) {
console.log(`model ${i++}: ${modelItem.value}`);
modelItem = await iter.next();
}
Example using byPage()
:
let i = 1;
for await (const response of client.listCustomModels().byPage()) {
for (const modelInfo of response.modelList!) {
console.log(`model ${i++}: ${modelInfo.modelId}`);
}
}
Options to the List Models operation
Generated using TypeDoc
Client class for training and managing custom form models.