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.
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();
Id of the custom model in this resource to be copied to the target Form Recognizer resource
Copy authorization produced by calling targetTrainingClient.getCopyAuthorization()
Creates and trains a custom form model. 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.
Note that when training operation fails, a model is still created in Azure Form Recognizer resource.
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();
Accessible url to an Azure Storage Blob container storing the training documents
specifies whether to training the model using label files
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.
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.