DocumentModelAdministrationAsyncClient Class
- java.
lang. Object - com.
azure. ai. formrecognizer. documentanalysis. administration. DocumentModelAdministrationAsyncClient
- com.
public final class DocumentModelAdministrationAsyncClient
This class provides an asynchronous client to connect to the Form Recognizer Azure Cognitive Service.
This client provides asynchronous methods to perform:
- Build a custom model: Extract data from your specific documents by building custom models using the beginBuildDocumentModel(String blobContainerUrl, DocumentModelBuildMode buildMode) method to provide a container SAS URL to your Azure Storage Blob container.
- Composed custom models: Creates a new model from document types of collection of existing models using the beginComposeDocumentModel(List<String> componentModelIds) method.
- Copy custom model: Copy a custom Form Recognizer model to a target Form Recognizer resource using the beginCopyDocumentModelTo(String sourceModelId, DocumentModelCopyAuthorization target) method.
- Custom model management: Get detailed information, delete and list custom models using methods getDocumentModel(String modelId), listDocumentModels() and deleteDocumentModel(String modelId) respectively.
- Operations management: Get detailed information and list operations on the Form Recognizer account using methods getOperation(String operationId) and listOperations() respectively.
- Polling and Callbacks: It includes mechanisms for polling the service to check the status of an analysis operation or registering callbacks to receive notifications when the analysis is complete.
Note: This client only supports V2022_08_31 and newer. To use an older service version, FormRecognizerClient and FormTrainingClient.
Service clients are the point of interaction for developers to use Azure Form Recognizer. DocumentModelAdministrationClient is the synchronous service client and DocumentModelAdministrationAsyncClient is the asynchronous service client. The examples shown in this document use a credential object named DefaultAzureCredential for authentication, which is appropriate for most scenarios, including local development and production environments. Additionally, we recommend using managed identity for authentication in production environments. You can find more information on different ways of authenticating and their corresponding credential types in the Azure Identity documentation".
Sample: Construct a DocumentModelAdministrationAsyncClient with DefaultAzureCredential
The following code sample demonstrates the creation of a DocumentModelAdministrationAsyncClient, using the `DefaultAzureCredentialBuilder` to configure it.
DocumentModelAdministrationAsyncClient client = new DocumentModelAdministrationClientBuilder()
.endpoint("{endpoint}")
.credential(new DefaultAzureCredentialBuilder().build())
.buildAsyncClient();
Further, see the code sample below to use AzureKeyCredential for client creation.
DocumentModelAdministrationAsyncClient documentModelAdministrationAsyncClient =
new DocumentModelAdministrationClientBuilder()
.credential(new AzureKeyCredential("{key}"))
.endpoint("{endpoint}")
.buildAsyncClient();
Method Summary
Methods inherited from java.lang.Object
Method Details
beginBuildDocumentClassifier
public PollerFlux
Builds a custom classifier document model.
Classifier models can identify multiple documents or multiple instances of a single document. For that, you need at least five documents for each class and two classes of documents.
The service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support.
Code sample
String blobContainerUrl1040D = "{SAS_URL_of_your_container_in_blob_storage}";
String blobContainerUrl1040A = "{SAS_URL_of_your_container_in_blob_storage}";
HashMap<String, ClassifierDocumentTypeDetails> documentTypesDetailsMap = new HashMap<>();
documentTypesDetailsMap.put("1040-D", new ClassifierDocumentTypeDetails(new BlobContentSource(blobContainerUrl1040D)
));
documentTypesDetailsMap.put("1040-A", new ClassifierDocumentTypeDetails(new BlobContentSource(blobContainerUrl1040A)
));
documentModelAdministrationAsyncClient.beginBuildDocumentClassifier(documentTypesDetailsMap)
// if polling operation completed, retrieve the final result.
.flatMap(AsyncPollResponse::getFinalResult)
.subscribe(classifierDetails -> {
System.out.printf("Classifier ID: %s%n", classifierDetails.getClassifierId());
System.out.printf("Classifier description: %s%n", classifierDetails.getDescription());
System.out.printf("Classifier created on: %s%n", classifierDetails.getCreatedOn());
System.out.printf("Classifier expires on: %s%n", classifierDetails.getExpiresOn());
classifierDetails.getDocumentTypes().forEach((key, documentTypeDetails) -> {
if (documentTypeDetails.getContentSource() instanceof BlobContentSource) {
System.out.printf("Blob Source container Url: %s", ((BlobContentSource) documentTypeDetails
.getContentSource()).getContainerUrl());
}
});
});
Parameters:
Returns:
beginBuildDocumentClassifier
public PollerFlux
Builds a custom document analysis model. Models are built using documents that are of the following content type - 'application/pdf', 'image/jpeg', 'image/png', 'image/tiff', image/bmp. Other type of content is ignored.
The service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support.
See here for information on building your own administration data set.
Code sample
String blobContainerUrl1040D = "{SAS_URL_of_your_container_in_blob_storage}";
String blobContainerUrl1040A = "{SAS_URL_of_your_container_in_blob_storage}";
HashMap<String, ClassifierDocumentTypeDetails> documentTypesDetailsMap = new HashMap<>();
documentTypesDetailsMap.put("1040-D", new ClassifierDocumentTypeDetails(new BlobContentSource(blobContainerUrl1040D)
));
documentTypesDetailsMap.put("1040-A", new ClassifierDocumentTypeDetails(new BlobContentSource(blobContainerUrl1040A)
));
documentModelAdministrationAsyncClient.beginBuildDocumentClassifier(documentTypesDetailsMap,
new BuildDocumentClassifierOptions()
.setClassifierId("classifierId")
.setDescription("classifier desc"))
// if polling operation completed, retrieve the final result.
.flatMap(AsyncPollResponse::getFinalResult)
.subscribe(classifierDetails -> {
System.out.printf("Classifier ID: %s%n", classifierDetails.getClassifierId());
System.out.printf("Classifier description: %s%n", classifierDetails.getDescription());
System.out.printf("Classifier created on: %s%n", classifierDetails.getCreatedOn());
System.out.printf("Classifier expires on: %s%n", classifierDetails.getExpiresOn());
classifierDetails.getDocumentTypes().forEach((key, documentTypeDetails) -> {
if (documentTypeDetails.getContentSource() instanceof BlobContentSource) {
System.out.printf("Blob Source container Url: %s", ((BlobContentSource) documentTypeDetails
.getContentSource()).getContainerUrl());
}
});
});
Parameters:
Returns:
beginBuildDocumentModel
public PollerFlux
Builds a custom document analysis model. Models are built using documents that are of the following content type - 'application/pdf', 'image/jpeg', 'image/png', 'image/tiff', image/bmp. Other type of content is ignored.
The service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support.
See here for information on building your own administration data set.
Code sample
String blobContainerUrl = "{SAS-URL-of-your-container-in-blob-storage}";
String fileList = "";
documentModelAdministrationAsyncClient.beginBuildDocumentModel(
new BlobFileListContentSource(blobContainerUrl, fileList),
DocumentModelBuildMode.TEMPLATE)
// if polling operation completed, retrieve the final result.
.flatMap(AsyncPollResponse::getFinalResult)
.subscribe(documentModel -> {
System.out.printf("Model ID: %s%n", documentModel.getModelId());
System.out.printf("Model Created on: %s%n", documentModel.getCreatedOn());
documentModel.getDocumentTypes().forEach((key, documentTypeDetails) -> {
documentTypeDetails.getFieldSchema().forEach((field, documentFieldSchema) -> {
System.out.printf("Field: %s", field);
System.out.printf("Field type: %s", documentFieldSchema.getType());
System.out.printf("Field confidence: %.2f", documentTypeDetails.getFieldConfidence().get(field));
});
});
});
Parameters:
Returns:
beginBuildDocumentModel
public PollerFlux
Builds a custom document analysis model. Models are built using documents that are of the following content type - 'application/pdf', 'image/jpeg', 'image/png', 'image/tiff', image/bmp. Other type of content is ignored.
The service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support.
See here for information on building your own administration data set.
Code sample
String blobContainerUrl = "{SAS-URL-of-your-container-in-blob-storage}";
String fileList = "";
String modelId = "model-id";
Map<String, String> attrs = new HashMap<String, String>();
attrs.put("createdBy", "sample");
String prefix = "Invoice";
documentModelAdministrationAsyncClient.beginBuildDocumentModel(
new BlobFileListContentSource(blobContainerUrl, fileList),
DocumentModelBuildMode.TEMPLATE,
new BuildDocumentModelOptions()
.setModelId(modelId)
.setDescription("model desc")
.setTags(attrs))
// if polling operation completed, retrieve the final result.
.flatMap(AsyncPollResponse::getFinalResult)
.subscribe(documentModel -> {
System.out.printf("Model ID: %s%n", documentModel.getModelId());
System.out.printf("Model Description: %s%n", documentModel.getDescription());
System.out.printf("Model Created on: %s%n", documentModel.getCreatedOn());
System.out.printf("Model assigned tags: %s%n", documentModel.getTags());
documentModel.getDocumentTypes().forEach((key, documentTypeDetails) -> {
documentTypeDetails.getFieldSchema().forEach((field, documentFieldSchema) -> {
System.out.printf("Field: %s", field);
System.out.printf("Field type: %s", documentFieldSchema.getType());
System.out.printf("Field confidence: %.2f", documentTypeDetails.getFieldConfidence().get(field));
});
});
});
Parameters:
Returns:
beginBuildDocumentModel
public PollerFlux
Builds a custom document analysis model. Models are built using documents that are of the following content type - 'application/pdf', 'image/jpeg', 'image/png', 'image/tiff', image/bmp. Other type of content is ignored.
The service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support.
See here for information on building your own administration data set.
Code sample
String blobContainerUrl = "{SAS-URL-of-your-container-in-blob-storage}";
documentModelAdministrationAsyncClient.beginBuildDocumentModel(blobContainerUrl,
DocumentModelBuildMode.TEMPLATE
)
// if polling operation completed, retrieve the final result.
.flatMap(AsyncPollResponse::getFinalResult)
.subscribe(documentModel -> {
System.out.printf("Model ID: %s%n", documentModel.getModelId());
System.out.printf("Model Created on: %s%n", documentModel.getCreatedOn());
documentModel.getDocumentTypes().forEach((key, documentTypeDetails) -> {
documentTypeDetails.getFieldSchema().forEach((field, documentFieldSchema) -> {
System.out.printf("Field: %s", field);
System.out.printf("Field type: %s", documentFieldSchema.getType());
System.out.printf("Field confidence: %.2f", documentTypeDetails.getFieldConfidence().get(field));
});
});
});
Parameters:
Returns:
beginBuildDocumentModel
public PollerFlux
Builds a custom document analysis model. Models are built using documents that are of the following content type - 'application/pdf', 'image/jpeg', 'image/png', 'image/tiff', image/bmp. Other type of content is ignored.
The service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support.
See here for information on building your own administration data set.
Code sample
String blobContainerUrl = "{SAS-URL-of-your-container-in-blob-storage}";
String modelId = "model-id";
Map<String, String> attrs = new HashMap<String, String>();
attrs.put("createdBy", "sample");
String prefix = "Invoice";
documentModelAdministrationAsyncClient.beginBuildDocumentModel(blobContainerUrl,
DocumentModelBuildMode.TEMPLATE,
prefix,
new BuildDocumentModelOptions()
.setModelId(modelId)
.setDescription("model desc")
.setTags(attrs))
// if polling operation completed, retrieve the final result.
.flatMap(AsyncPollResponse::getFinalResult)
.subscribe(documentModel -> {
System.out.printf("Model ID: %s%n", documentModel.getModelId());
System.out.printf("Model Description: %s%n", documentModel.getDescription());
System.out.printf("Model Created on: %s%n", documentModel.getCreatedOn());
System.out.printf("Model assigned tags: %s%n", documentModel.getTags());
documentModel.getDocumentTypes().forEach((key, documentTypeDetails) -> {
documentTypeDetails.getFieldSchema().forEach((field, documentFieldSchema) -> {
System.out.printf("Field: %s", field);
System.out.printf("Field type: %s", documentFieldSchema.getType());
System.out.printf("Field confidence: %.2f", documentTypeDetails.getFieldConfidence().get(field));
});
});
});
Parameters:
Returns:
beginComposeDocumentModel
public PollerFlux
Create a composed model from the provided list of existing models in the account.
This operations fails if the list consists of an invalid, non-existing model Id or duplicate IDs.
The service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support.
Code sample
String modelId1 = "{model_Id_1}";
String modelId2 = "{model_Id_2}";
documentModelAdministrationAsyncClient.beginComposeDocumentModel(Arrays.asList(modelId1, modelId2)
)
// if polling operation completed, retrieve the final result.
.flatMap(AsyncPollResponse::getFinalResult)
.subscribe(documentModel -> {
System.out.printf("Model ID: %s%n", documentModel.getModelId());
System.out.printf("Model Created on: %s%n", documentModel.getCreatedOn());
documentModel.getDocumentTypes().forEach((key, documentTypeDetails) -> {
documentTypeDetails.getFieldSchema().forEach((field, documentFieldSchema) -> {
System.out.printf("Field: %s", field);
System.out.printf("Field type: %s", documentFieldSchema.getType());
System.out.printf("Field confidence: %.2f", documentTypeDetails.getFieldConfidence().get(field));
});
});
});
Parameters:
Returns:
beginComposeDocumentModel
public PollerFlux
Create a composed model from the provided list of existing models in the account.
This operations fails if the list consists of an invalid, non-existing model Id or duplicate IDs.
The service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support.
Code sample
String modelId1 = "{model_Id_1}";
String modelId2 = "{model_Id_2}";
String modelId = "my-composed-model";
Map<String, String> attrs = new HashMap<String, String>();
attrs.put("createdBy", "sample");
documentModelAdministrationAsyncClient.beginComposeDocumentModel(Arrays.asList(modelId1, modelId2),
new ComposeDocumentModelOptions()
.setModelId(modelId)
.setDescription("model-desc")
.setTags(attrs))
// if polling operation completed, retrieve the final result.
.flatMap(AsyncPollResponse::getFinalResult)
.subscribe(documentModel -> {
System.out.printf("Model ID: %s%n", documentModel.getModelId());
System.out.printf("Model Description: %s%n", documentModel.getDescription());
System.out.printf("Model Created on: %s%n", documentModel.getCreatedOn());
System.out.printf("Model assigned tags: %s%n", documentModel.getTags());
documentModel.getDocumentTypes().forEach((key, documentTypeDetails) -> {
documentTypeDetails.getFieldSchema().forEach((field, documentFieldSchema) -> {
System.out.printf("Field: %s", field);
System.out.printf("Field type: %s", documentFieldSchema.getType());
System.out.printf("Field confidence: %.2f", documentTypeDetails.getFieldConfidence().get(field));
});
});
});
Parameters:
Returns:
beginCopyDocumentModelTo
public PollerFlux
Copy a custom model stored in this resource (the source) to the user specified target Form Recognizer resource.
This should be called with the source Form Recognizer resource (with the model that is intended to be copied). The target parameter should be supplied from the target resource's output from getCopyAuthorization() method.
The service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support.
Code sample
String copyModelId = "copy-model";
// Get authorization to copy the model to target resource
documentModelAdministrationAsyncClient.getCopyAuthorization()
// Start copy operation from the source client
// The ID of the model that needs to be copied to the target resource
.subscribe(copyAuthorization -> documentModelAdministrationAsyncClient.beginCopyDocumentModelTo(copyModelId,
copyAuthorization)
.filter(pollResponse -> pollResponse.getStatus().isComplete())
.flatMap(AsyncPollResponse::getFinalResult)
.subscribe(documentModel ->
System.out.printf("Copied model has model ID: %s, was created on: %s.%n,",
documentModel.getModelId(),
documentModel.getCreatedOn())));
Parameters:
Returns:
deleteDocumentClassifier
public Mono
Deletes the specified document classifier.
Code sample
String classifierId = "{classifierId}";
documentModelAdministrationAsyncClient.deleteDocumentClassifier(classifierId)
.subscribe(ignored -> System.out.printf("Classifier ID: %s is deleted%n", classifierId));
Parameters:
Returns:
deleteDocumentClassifierWithResponse
public Mono
Deletes the specified document classifier.
Code sample
String classifierId = "{classifierId}";
documentModelAdministrationAsyncClient.deleteDocumentClassifierWithResponse(classifierId)
.subscribe(response -> {
System.out.printf("Response Status Code: %d.", response.getStatusCode());
System.out.printf("Classifier ID: %s is deleted.%n", classifierId);
});
Parameters:
Returns:
deleteDocumentModel
public Mono
Deletes the specified custom document analysis model.
Code sample
String modelId = "{model_id}";
documentModelAdministrationAsyncClient.deleteDocumentModel(modelId)
.subscribe(ignored -> System.out.printf("Model ID: %s is deleted%n", modelId));
Parameters:
Returns:
deleteDocumentModelWithResponse
public Mono
Deletes the specified custom document analysis model.
Code sample
String modelId = "{model_id}";
documentModelAdministrationAsyncClient.deleteDocumentModelWithResponse(modelId)
.subscribe(response -> {
System.out.printf("Response Status Code: %d.", response.getStatusCode());
System.out.printf("Model ID: %s is deleted.%n", modelId);
});
Parameters:
Returns:
getCopyAuthorization
public Mono
Generate authorization for copying a custom document analysis model into the target Form Recognizer resource.
This should be called by the target resource (where the model will be copied to) and the output can be passed as the target parameter into beginCopyDocumentModelTo(String sourceModelId, DocumentModelCopyAuthorization target).
Returns:
getCopyAuthorizationWithResponse
public Mono
Generate authorization for copying a custom document analysis model into the target Form Recognizer resource.
This should be called by the target resource (where the model will be copied to) and the output can be passed as the target parameter into beginCopyDocumentModelTo(String sourceModelId, DocumentModelCopyAuthorization target).
Parameters:
documentModelAdministrationAsyncClient.getCopyAuthorizationWithResponse( new CopyAuthorizationOptions() .setModelId(modelId) .setDescription("model desc") .setTags(attrs)) .subscribe(copyAuthorization -> System.out.printf("Copy Authorization response status: %s, for model id: %s, access token: %s, " + "expiration time: %s, target resource ID; %s, target resource region: %s%n", copyAuthorization.getStatusCode(), copyAuthorization.getValue().getTargetModelId(), copyAuthorization.getValue().getAccessToken(), copyAuthorization.getValue().getExpiresOn(), copyAuthorization.getValue().getTargetResourceId(), copyAuthorization.getValue().getTargetResourceRegion() ));
Returns:
getDocumentAnalysisAsyncClient
public DocumentAnalysisAsyncClient getDocumentAnalysisAsyncClient()
Creates a new DocumentAnalysisAsyncClient object. The new DocumentTrainingAsyncClient
uses the same request policy pipeline as the DocumentTrainingAsyncClient
.
Returns:
getDocumentClassifier
public Mono
Get detailed information for a document classifier by its ID.
Code sample
String modelId = "{model_id}";
documentModelAdministrationAsyncClient.getDocumentClassifier(modelId).subscribe(documentClassifier -> {
System.out.printf("Classifier ID: %s%n", documentClassifier.getClassifierId());
System.out.printf("Classifier Description: %s%n", documentClassifier.getDescription());
System.out.printf("Classifier Created on: %s%n", documentClassifier.getCreatedOn());
documentClassifier.getDocumentTypes().forEach((key, documentTypeDetails) -> {
if (documentTypeDetails.getContentSource() instanceof BlobContentSource) {
System.out.printf("Blob Source container Url: %s", ((BlobContentSource) documentTypeDetails
.getContentSource()).getContainerUrl());
}
if (documentTypeDetails.getContentSource() instanceof BlobFileListContentSource) {
System.out.printf("Blob File List Source container Url: %s",
((BlobFileListContentSource) documentTypeDetails
.getContentSource()).getContainerUrl());
}
});
});
Parameters:
Returns:
getDocumentClassifierWithResponse
public Mono
Get detailed information for a specified model ID with Http response.
Code sample
String modelId = "{model_id}";
documentModelAdministrationAsyncClient.getDocumentModelWithResponse(modelId).subscribe(response -> {
System.out.printf("Response Status Code: %d.", response.getStatusCode());
DocumentModelDetails documentModelDetails = response.getValue();
System.out.printf("Model ID: %s%n", documentModelDetails.getModelId());
System.out.printf("Model Description: %s%n", documentModelDetails.getDescription());
System.out.printf("Model Created on: %s%n", documentModelDetails.getCreatedOn());
documentModelDetails.getDocumentTypes().forEach((key, documentTypeDetails) -> {
documentTypeDetails.getFieldSchema().forEach((field, documentFieldSchema) -> {
System.out.printf("Field: %s", field);
System.out.printf("Field type: %s", documentFieldSchema.getType());
System.out.printf("Field confidence: %.2f", documentTypeDetails.getFieldConfidence().get(field));
});
});
});
Parameters:
Returns:
getDocumentModel
public Mono
Get detailed information for a specified model ID.
Code sample
String modelId = "{model_id}";
documentModelAdministrationAsyncClient.getDocumentModel(modelId).subscribe(documentModel -> {
System.out.printf("Model ID: %s%n", documentModel.getModelId());
System.out.printf("Model Description: %s%n", documentModel.getDescription());
System.out.printf("Model Created on: %s%n", documentModel.getCreatedOn());
documentModel.getDocumentTypes().forEach((key, documentTypeDetails) -> {
documentTypeDetails.getFieldSchema().forEach((field, documentFieldSchema) -> {
System.out.printf("Field: %s", field);
System.out.printf("Field type: %s", documentFieldSchema.getType());
System.out.printf("Field confidence: %.2f", documentTypeDetails.getFieldConfidence().get(field));
});
});
});
Parameters:
Returns:
getDocumentModelWithResponse
public Mono
Get detailed information for a specified model ID with Http response.
Code sample
String modelId = "{model_id}";
documentModelAdministrationAsyncClient.getDocumentModelWithResponse(modelId).subscribe(response -> {
System.out.printf("Response Status Code: %d.", response.getStatusCode());
DocumentModelDetails documentModelDetails = response.getValue();
System.out.printf("Model ID: %s%n", documentModelDetails.getModelId());
System.out.printf("Model Description: %s%n", documentModelDetails.getDescription());
System.out.printf("Model Created on: %s%n", documentModelDetails.getCreatedOn());
documentModelDetails.getDocumentTypes().forEach((key, documentTypeDetails) -> {
documentTypeDetails.getFieldSchema().forEach((field, documentFieldSchema) -> {
System.out.printf("Field: %s", field);
System.out.printf("Field type: %s", documentFieldSchema.getType());
System.out.printf("Field confidence: %.2f", documentTypeDetails.getFieldConfidence().get(field));
});
});
});
Parameters:
Returns:
getOperation
public Mono
Get detailed operation information for the specified ID.
This operations fails if the operation ID used is past 24 hours.
Code sample
String operationId = "{operation_Id}";
documentModelAdministrationAsyncClient.getOperation(operationId).subscribe(operationDetails -> {
System.out.printf("Operation ID: %s%n", operationDetails.getOperationId());
System.out.printf("Operation Kind: %s%n", operationDetails.getKind());
System.out.printf("Operation Status: %s%n", operationDetails.getStatus());
System.out.printf("Model ID created with this operation: %s%n",
((DocumentModelBuildOperationDetails) operationDetails).getResult().getModelId());
if (OperationStatus.FAILED.equals(operationDetails.getStatus())) {
System.out.printf("Operation fail error: %s%n", operationDetails.getError().getMessage());
}
});
Parameters:
Returns:
getOperationWithResponse
public Mono
Get detailed operation information for the specified ID with Http response.
This operations fails if the operation ID used is past 24 hours.
Code sample
String operationId = "{operation_Id}";
documentModelAdministrationAsyncClient.getOperationWithResponse(operationId).subscribe(response -> {
System.out.printf("Response Status Code: %d.", response.getStatusCode());
OperationDetails operationDetails = response.getValue();
System.out.printf("Operation ID: %s%n", operationDetails.getOperationId());
System.out.printf("Operation Kind: %s%n", operationDetails.getKind());
System.out.printf("Operation Status: %s%n", operationDetails.getStatus());
System.out.printf("Model ID created with this operation: %s%n",
((DocumentModelBuildOperationDetails) operationDetails).getResult().getModelId());
if (OperationStatus.FAILED.equals(operationDetails.getStatus())) {
System.out.printf("Operation fail error: %s%n", operationDetails.getError().getMessage());
}
});
Parameters:
Returns:
getResourceDetails
public Mono
Get information about the current Form Recognizer resource.
Code sample
documentModelAdministrationAsyncClient.getResourceDetails()
.subscribe(resourceInfo -> {
System.out.printf("Max number of models that can be build for this account: %d%n",
resourceInfo.getCustomDocumentModelLimit());
System.out.printf("Current count of built document analysis models: %d%n",
resourceInfo.getCustomDocumentModelCount());
});
Returns:
getResourceDetailsWithResponse
public Mono
Get the information about the current Form Recognizer resource with a Http response.
Code sample
documentModelAdministrationAsyncClient.getResourceDetailsWithResponse()
.subscribe(response -> {
System.out.printf("Response Status Code: %d.", response.getStatusCode());
ResourceDetails resourceDetails = response.getValue();
System.out.printf("Max number of models that can be build for this account: %d%n",
resourceDetails.getCustomDocumentModelLimit());
System.out.printf("Current count of built document analysis models: %d%n",
resourceDetails.getCustomDocumentModelCount());
});
Returns:
listDocumentClassifiers
public PagedFlux
List information for each document classifier on the Form Recognizer account that were built successfully.
Code sample
documentModelAdministrationAsyncClient.listDocumentClassifiers()
.subscribe(documentModelInfo ->
System.out.printf("Classifier ID: %s, Classifier description: %s, Created on: %s.%n",
documentModelInfo.getClassifierId(),
documentModelInfo.getDescription(),
documentModelInfo.getCreatedOn()));
Returns:
listDocumentModels
public PagedFlux
List information for each model on the Form Recognizer account that were built successfully.
Code sample
documentModelAdministrationAsyncClient.listDocumentModels()
.subscribe(documentModelInfo ->
System.out.printf("Model ID: %s, Model description: %s, Created on: %s.%n",
documentModelInfo.getModelId(),
documentModelInfo.getDescription(),
documentModelInfo.getCreatedOn()));
Returns:
listOperations
public PagedFlux
List information for each model operation on the Form Recognizer account in the past 24 hours.
Code sample
documentModelAdministrationAsyncClient.listOperations()
.subscribe(modelOperationSummary -> {
System.out.printf("Operation ID: %s%n", modelOperationSummary.getOperationId());
System.out.printf("Operation Status: %s%n", modelOperationSummary.getStatus());
System.out.printf("Operation Created on: %s%n", modelOperationSummary.getCreatedOn());
System.out.printf("Operation Percent completed: %d%n", modelOperationSummary.getPercentCompleted());
System.out.printf("Operation Kind: %s%n", modelOperationSummary.getKind());
System.out.printf("Operation Last updated on: %s%n", modelOperationSummary.getLastUpdatedOn());
System.out.printf("Operation resource location: %s%n", modelOperationSummary.getResourceLocation());
});
Returns:
Applies to
Azure SDK for Java