From daec05bc69c6d35b2365de9994dea68e0622b414 Mon Sep 17 00:00:00 2001 From: Sameeksha Vaity Date: Fri, 5 Aug 2022 11:48:05 -0700 Subject: [PATCH] Add support for building model with AzureBlobContentSource (#30234) --- .../perf/BuildDocumentModelTest.java | 4 +- .../azure-ai-formrecognizer/CHANGELOG.md | 8 +- .../azure-ai-formrecognizer/README.md | 5 +- .../migration-guide.md | 5 +- ...ocumentModelAdministrationAsyncClient.java | 58 +++++++------ .../DocumentModelAdministrationClient.java | 34 ++++---- .../models/BuildModelOptions.java | 27 ------ .../ai/formrecognizer/ReadmeSamples.java | 5 +- .../administration/BuildModel.java | 6 +- .../administration/BuildModelAsync.java | 7 +- .../administration/ComposeModelAsync.java | 4 +- ...elAdminAsyncClientJavaDocCodeSnippets.java | 25 +++--- ...ntModelAdminClientJavaDocCodeSnippets.java | 16 ++-- ...Test => DocumentModelAdminClientTest.java} | 83 ++++++++++--------- ...entModelAdministrationAsyncClientTest.java | 32 +++---- ...mentModelAdministrationClientTestBase.java | 4 + ...nBuildModelFailsWithInvalidPrefix[1].json} | 0 ...deSubfolderWithNonExistPrefixName[1].json} | 0 ...ientTest.beginBuildModelNullInput[1].json} | 0 ...beginBuildModelWithJPGTrainingSet[1].json} | 0 ...dModelWithMultiPagePDFTrainingSet[1].json} | 0 ...entModelAdminClientTest.beginCopy[1].json} | 0 ...ientTest.beginCreateComposedModel[1].json} | 0 ...AdminClientTest.copyAuthorization[1].json} | 0 ...est.deleteModelNonExistingModelID[1].json} | 0 ...leteModelValidModelIDWithResponse[1].json} | 0 ...DocumentAnalysisClientAndValidate[1].json} | 0 ...ntTest.getModelNonExistingModelID[1].json} | 0 ...minClientTest.getModelNullModelID[1].json} | 0 ...inClientTest.getModelWithResponse[1].json} | 0 ...nClientTest.listModelsWithContext[1].json} | 0 ...ntModelAdminClientTest.listModels[1].json} | 0 ...lidGetResourceDetailsWithResponse[1].json} | 0 ...lientTest.validGetResourceDetails[1].json} | 0 ...lidGetResourceDetailsWithResponse[1].json} | 0 ...lientTest.validGetResourceDetails[1].json} | 0 36 files changed, 161 insertions(+), 162 deletions(-) rename sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/administration/{DocumentModelAdministrationClientTest => DocumentModelAdminClientTest.java} (86%) rename sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/{DocumentModelAdministrationClientTest.beginBuildModelFailsWithInvalidPrefix[1].json => DocumentModelAdminClientTest.beginBuildModelFailsWithInvalidPrefix[1].json} (100%) rename sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/{DocumentModelAdministrationClientTest.beginBuildModelIncludeSubfolderWithNonExistPrefixName[1].json => DocumentModelAdminClientTest.beginBuildModelIncludeSubfolderWithNonExistPrefixName[1].json} (100%) rename sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/{DocumentModelAdministrationClientTest.beginBuildModelNullInput[1].json => DocumentModelAdminClientTest.beginBuildModelNullInput[1].json} (100%) rename sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/{DocumentModelAdministrationClientTest.beginBuildModelWithJPGTrainingSet[1].json => DocumentModelAdminClientTest.beginBuildModelWithJPGTrainingSet[1].json} (100%) rename sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/{DocumentModelAdministrationClientTest.beginBuildModelWithMultiPagePDFTrainingSet[1].json => DocumentModelAdminClientTest.beginBuildModelWithMultiPagePDFTrainingSet[1].json} (100%) rename sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/{DocumentModelAdministrationClientTest.beginCopy[1].json => DocumentModelAdminClientTest.beginCopy[1].json} (100%) rename sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/{DocumentModelAdministrationClientTest.beginCreateComposedModel[1].json => DocumentModelAdminClientTest.beginCreateComposedModel[1].json} (100%) rename sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/{DocumentModelAdministrationClientTest.copyAuthorization[1].json => DocumentModelAdminClientTest.copyAuthorization[1].json} (100%) rename sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/{DocumentModelAdministrationClientTest.deleteModelNonExistingModelID[1].json => DocumentModelAdminClientTest.deleteModelNonExistingModelID[1].json} (100%) rename sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/{DocumentModelAdministrationClientTest.deleteModelValidModelIDWithResponse[1].json => DocumentModelAdminClientTest.deleteModelValidModelIDWithResponse[1].json} (100%) rename sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/{DocumentModelAdministrationClientTest.getDocumentAnalysisClientAndValidate[1].json => DocumentModelAdminClientTest.getDocumentAnalysisClientAndValidate[1].json} (100%) rename sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/{DocumentModelAdministrationClientTest.getModelNonExistingModelID[1].json => DocumentModelAdminClientTest.getModelNonExistingModelID[1].json} (100%) rename sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/{DocumentModelAdministrationClientTest.getModelNullModelID[1].json => DocumentModelAdminClientTest.getModelNullModelID[1].json} (100%) rename sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/{DocumentModelAdministrationClientTest.getModelWithResponse[1].json => DocumentModelAdminClientTest.getModelWithResponse[1].json} (100%) rename sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/{DocumentModelAdministrationClientTest.listModelsWithContext[1].json => DocumentModelAdminClientTest.listModelsWithContext[1].json} (100%) rename sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/{DocumentModelAdministrationClientTest.listModels[1].json => DocumentModelAdminClientTest.listModels[1].json} (100%) rename sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/{DocumentModelAdministrationClientTest.validGetResourceInfoWithResponse[1].json => DocumentModelAdminClientTest.validGetResourceDetailsWithResponse[1].json} (100%) rename sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/{DocumentModelAdministrationClientTest.validGetResourceInfo[1].json => DocumentModelAdminClientTest.validGetResourceDetails[1].json} (100%) rename sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/{DocumentModelAdministrationAsyncClientTest.validGetResourceInfoWithResponse[1].json => DocumentModelAdministrationAsyncClientTest.validGetResourceDetailsWithResponse[1].json} (100%) rename sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/{DocumentModelAdministrationAsyncClientTest.validGetResourceInfo[1].json => DocumentModelAdministrationAsyncClientTest.validGetResourceDetails[1].json} (100%) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer-perf/src/main/java/com/azure/ai/formrecognizer/perf/BuildDocumentModelTest.java b/sdk/formrecognizer/azure-ai-formrecognizer-perf/src/main/java/com/azure/ai/formrecognizer/perf/BuildDocumentModelTest.java index 9a86e77a65e73..715f5500f5ff0 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer-perf/src/main/java/com/azure/ai/formrecognizer/perf/BuildDocumentModelTest.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer-perf/src/main/java/com/azure/ai/formrecognizer/perf/BuildDocumentModelTest.java @@ -34,7 +34,7 @@ public void run() { SyncPoller syncPoller = documentModelAdministrationAsyncClient .beginBuildModel(FORM_RECOGNIZER_TRAINING_BLOB_CONTAINER_SAS_URL, - DocumentModelBuildMode.TEMPLATE, + DocumentModelBuildMode.TEMPLATE, null, new BuildModelOptions().setDescription("perf-training-model")) .getSyncPoller(); modelId = syncPoller.getFinalResult().getModelId(); @@ -45,7 +45,7 @@ public void run() { public Mono runAsync() { return documentModelAdministrationAsyncClient .beginBuildModel(FORM_RECOGNIZER_TRAINING_BLOB_CONTAINER_SAS_URL, - DocumentModelBuildMode.TEMPLATE, + DocumentModelBuildMode.TEMPLATE, null, new BuildModelOptions().setDescription("perf-training-model")) .last() .flatMap(pollResponse -> { diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md b/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md index b09226a8893f0..b3f6672d32f60 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md +++ b/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md @@ -4,13 +4,12 @@ ### Features Added - Add a constructor to create an instance of `CopyAuthorization` model. +- Added BinaryData support to document analysis client using `beginAnalyzeDocument(String modelId, BinaryData document, long length)` ### Breaking Changes -- Added BinaryData support to document analysis client using `beginAnalyzeDocument(String modelId, BinaryData document, long length)` - Renamed `beginCreateComposedModel` method to `beginComposeModel` on DocumentModelAdministrationClient and DocumentModelAdministrationAsyncClient. - Renamed `CreateComposedModelOptions` model to `ComposeModelOptions` -- Renamed `DocumentModelInfo` model to `DocumentModelSummary` -- Renamed `DocumentModelDetails` model to `DocumentModelInfo` +- Renamed `DocumentModelInfo` model to `DocumentModelDetails` - Renamed `ModelOperation` model to `ModelOperationDetails` - Renamed `ModelOperationInfo` model to `ModelOperationSummary` - Renamed `getAccountProperties` method to `getResourceDetails` @@ -20,6 +19,9 @@ - Renamed `DocTypeInfo` model to `DocumentTypeDetails` - Renamed `docTypes` property on `DocumentModelDetails` model to `documentTypes` - Removed models `DocumentModelOperationException`, `DocumentModelOperationError` and `DocumentModelOperationInnerError`. +- Renamed `trainingFilesUrl` to `blobContainerUrl` in `beginBuildModel` method +- Changed method `beginBuildModel(String, DocumentModelBuildMode, BuildModelOptions)` to `beginBuildModel(String, DocumentModelBuildMode, String, BuildModelOptions)` +- Removed `prefix` property on model `BuildModelOptions` ### Bugs Fixed diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/README.md b/sdk/formrecognizer/azure-ai-formrecognizer/README.md index 5f62933293c34..066f8f1bfe57a 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/README.md +++ b/sdk/formrecognizer/azure-ai-formrecognizer/README.md @@ -376,10 +376,13 @@ More details on setting up a container and required file structure can be found // Build custom document analysis model String trainingFilesUrl = "{SAS_URL_of_your_container_in_blob_storage}"; // The shared access signature (SAS) Url of your Azure Blob Storage container with your forms. +String prefix = "{blob_name_prefix}}"; SyncPoller buildOperationPoller = documentModelAdminClient.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, - new BuildModelOptions().setModelId("my-build-model").setDescription("model desc"), Context.NONE); + prefix, + new BuildModelOptions().setModelId("my-build-model").setDescription("model desc"), + Context.NONE); DocumentModelDetails documentModelDetails = buildOperationPoller.getFinalResult(); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/migration-guide.md b/sdk/formrecognizer/azure-ai-formrecognizer/migration-guide.md index 9fcdd14e2508c..ecde67c367fe7 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/migration-guide.md +++ b/sdk/formrecognizer/azure-ai-formrecognizer/migration-guide.md @@ -522,10 +522,13 @@ Build a custom document model using 4.x.x `beginBuildModel`: // Build custom document analysis model String trainingFilesUrl = "{SAS_URL_of_your_container_in_blob_storage}"; // The shared access signature (SAS) Url of your Azure Blob Storage container with your forms. +String prefix = "{blob_name_prefix}}"; SyncPoller buildOperationPoller = documentModelAdminClient.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, - new BuildModelOptions().setModelId("my-build-model").setDescription("model desc"), Context.NONE); + prefix, + new BuildModelOptions().setModelId("my-build-model").setDescription("model desc"), + Context.NONE); DocumentModelDetails documentModelDetails = buildOperationPoller.getFinalResult(); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/administration/DocumentModelAdministrationAsyncClient.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/administration/DocumentModelAdministrationAsyncClient.java index 414f32058ba6d..b459e85e77265 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/administration/DocumentModelAdministrationAsyncClient.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/administration/DocumentModelAdministrationAsyncClient.java @@ -151,8 +151,8 @@ DocumentAnalysisAudience getAudience() { *

Code sample

* *
-     * String trainingFilesUrl = "{SAS-URL-of-your-container-in-blob-storage}";
-     * documentModelAdministrationAsyncClient.beginBuildModel(trainingFilesUrl,
+     * String blobContainerUrl = "{SAS-URL-of-your-container-in-blob-storage}";
+     * documentModelAdministrationAsyncClient.beginBuildModel(blobContainerUrl,
      *         DocumentModelBuildMode.TEMPLATE
      *     )
      *     // if polling operation completed, retrieve the final result.
@@ -171,7 +171,7 @@ DocumentAnalysisAudience getAudience() {
      * 
* * - * @param trainingFilesUrl an Azure Storage blob container's SAS URI. A container URI (without SAS) + * @param blobContainerUrl an Azure Storage blob container's SAS URI. A container URI (without SAS) * can be used if the container is public or has a managed identity configured. For more information on * setting up a training data set, see: here. * @param buildMode the preferred technique for creating models. For faster training of models use @@ -180,12 +180,12 @@ DocumentAnalysisAudience getAudience() { * @return A {@link PollerFlux} that polls the building model operation until it has completed, has failed, or has * been cancelled. The completed operation returns the trained {@link DocumentModelDetails custom document analysis model}. * @throws HttpResponseException If building a model fails with {@link OperationStatus#FAILED} is created. - * @throws NullPointerException If {@code trainingFilesUrl} is null. + * @throws NullPointerException If {@code blobContainerUrl} is null. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginBuildModel(String trainingFilesUrl, + public PollerFlux beginBuildModel(String blobContainerUrl, DocumentModelBuildMode buildMode) { - return beginBuildModel(trainingFilesUrl, buildMode, null); + return beginBuildModel(blobContainerUrl, buildMode, null, null); } /** @@ -199,17 +199,18 @@ public PollerFlux beginBuildModel * for information on building your own administration data set. * *

Code sample

- * + * *
-     * String trainingFilesUrl = "{SAS-URL-of-your-container-in-blob-storage}";
+     * 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.beginBuildModel(trainingFilesUrl,
+     * documentModelAdministrationAsyncClient.beginBuildModel(blobContainerUrl,
      *         DocumentModelBuildMode.TEMPLATE,
+     *         prefix,
      *         new BuildModelOptions()
-     *             .setPrefix("Invoice")
      *             .setModelId(modelId)
      *             .setDescription("model desc")
      *             .setTags(attrs))
@@ -229,32 +230,35 @@ public PollerFlux beginBuildModel
      *         });
      *     });
      * 
- * + * * - * @param trainingFilesUrl an Azure Storage blob container's SAS URI. A container URI (without SAS) + * @param blobContainerUrl an Azure Storage blob container's SAS URI. A container URI (without SAS) * can be used if the container is public or has a managed identity configured. For more information on * setting up a training data set, see: here. * @param buildMode the preferred technique for creating models. For faster training of models use * {@link DocumentModelBuildMode#TEMPLATE}. See here * for more information on building mode for custom documents. + * @param prefix case-sensitive prefix blob name prefix to filter documents for training. * @param buildModelOptions The configurable {@link BuildModelOptions options} to pass when * building a custom document analysis model. * @return A {@link PollerFlux} that polls the building model operation until it has completed, has failed, or has * been cancelled. The completed operation returns the trained {@link DocumentModelDetails custom document analysis model}. * @throws HttpResponseException If building a model fails with {@link OperationStatus#FAILED} is created. - * @throws NullPointerException If {@code trainingFilesUrl} is null. + * @throws NullPointerException If {@code blobContainerUrl} is null. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginBuildModel(String trainingFilesUrl, - DocumentModelBuildMode buildMode, - BuildModelOptions buildModelOptions) { - return beginBuildModel(trainingFilesUrl, buildMode, buildModelOptions, Context.NONE); + public PollerFlux beginBuildModel(String blobContainerUrl, + DocumentModelBuildMode buildMode, + String prefix, + BuildModelOptions buildModelOptions) { + return beginBuildModel(blobContainerUrl, buildMode, prefix, buildModelOptions, Context.NONE); } - PollerFlux beginBuildModel(String trainingFilesUrl, - DocumentModelBuildMode buildMode, - BuildModelOptions buildModelOptions, - Context context) { + PollerFlux beginBuildModel(String blobContainerUrl, + DocumentModelBuildMode buildMode, + String prefix, + BuildModelOptions buildModelOptions, + Context context) { buildModelOptions = buildModelOptions == null ? new BuildModelOptions() : buildModelOptions; String modelId = buildModelOptions.getModelId(); @@ -263,7 +267,7 @@ PollerFlux beginBuildModel(String } return new PollerFlux( DEFAULT_POLL_INTERVAL, - buildModelActivationOperation(trainingFilesUrl, buildMode, modelId, buildModelOptions, context), + buildModelActivationOperation(blobContainerUrl, buildMode, modelId, prefix, buildModelOptions, context), createModelPollOperation(context), (activationResponse, pollingContext) -> Mono.error(new RuntimeException("Cancellation is not supported")), fetchModelResultOperation(context)); @@ -928,18 +932,18 @@ PagedFlux listOperations(Context context) { private Function, Mono> buildModelActivationOperation( - String trainingFilesUrl, DocumentModelBuildMode buildMode, String modelId, - BuildModelOptions buildModelOptions, Context context) { + String blobContainerUrl, DocumentModelBuildMode buildMode, String modelId, + String prefix, BuildModelOptions buildModelOptions, Context context) { return (pollingContext) -> { try { - Objects.requireNonNull(trainingFilesUrl, "'trainingFilesUrl' cannot be null."); + Objects.requireNonNull(blobContainerUrl, "'blobContainerUrl' cannot be null."); BuildDocumentModelRequest buildDocumentModelRequest = new BuildDocumentModelRequest() .setModelId(modelId) .setBuildMode(com.azure.ai.formrecognizer.implementation.models.DocumentBuildMode .fromString(buildMode.toString())) .setAzureBlobSource(new AzureBlobContentSource() - .setContainerUrl(trainingFilesUrl) - .setPrefix(buildModelOptions.getPrefix())) + .setContainerUrl(blobContainerUrl) + .setPrefix(prefix)) .setDescription(buildModelOptions.getDescription()) .setTags(buildModelOptions.getTags()); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/administration/DocumentModelAdministrationClient.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/administration/DocumentModelAdministrationClient.java index d68328254908d..dcd0c97b51e2b 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/administration/DocumentModelAdministrationClient.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/administration/DocumentModelAdministrationClient.java @@ -85,9 +85,9 @@ public DocumentAnalysisClient getDocumentAnalysisClient() { *

Code sample

* *
-     * String trainingFilesUrl = "{SAS-URL-of-your-container-in-blob-storage}";
+     * String blobContainerUrl = "{SAS-URL-of-your-container-in-blob-storage}";
      * DocumentModelDetails documentModelDetails
-     *     = documentModelAdministrationClient.beginBuildModel(trainingFilesUrl,
+     *     = documentModelAdministrationClient.beginBuildModel(blobContainerUrl,
      *         DocumentModelBuildMode.TEMPLATE)
      *     .getFinalResult();
      *
@@ -103,7 +103,7 @@ public DocumentAnalysisClient getDocumentAnalysisClient() {
      * 
* * - * @param trainingFilesUrl an Azure Storage blob container's SAS URI. A container URI (without SAS) + * @param blobContainerUrl an Azure Storage blob container's SAS URI. A container URI (without SAS) * can be used if the container is public or has a managed identity configured. For more information on * setting up a training data set, see: here. * @param buildMode the preferred technique for creating models. For faster training of models use @@ -112,12 +112,12 @@ public DocumentAnalysisClient getDocumentAnalysisClient() { * @return A {@link SyncPoller} that polls the building model operation until it has completed, has failed, or has * been cancelled. The completed operation returns the trained {@link DocumentModelDetails custom document analysis model}. * @throws HttpResponseException If building model fails with {@link OperationStatus#FAILED} is created. - * @throws NullPointerException If {@code trainingFilesUrl} is null. + * @throws NullPointerException If {@code blobContainerUrl} is null. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller beginBuildModel( - String trainingFilesUrl, DocumentModelBuildMode buildMode) { - return beginBuildModel(trainingFilesUrl, buildMode, null, Context.NONE); + String blobContainerUrl, DocumentModelBuildMode buildMode) { + return beginBuildModel(blobContainerUrl, buildMode, null, null, Context.NONE); } /** @@ -130,21 +130,21 @@ public SyncPoller beginBuildModel * error message indicating absence of cancellation support.

* *

Code sample

- * + * *
-     * String trainingFilesUrl = "{SAS-URL-of-your-container-in-blob-storage}";
+     * String blobContainerUrl = "{SAS-URL-of-your-container-in-blob-storage}";
      * String modelId = "custom-model-id";
      * String prefix = "Invoice";
      * Map<String, String> attrs = new HashMap<String, String>();
      * attrs.put("createdBy", "sample");
      *
      * DocumentModelDetails documentModelDetails
-     *     = documentModelAdministrationClient.beginBuildModel(trainingFilesUrl,
+     *     = documentModelAdministrationClient.beginBuildModel(blobContainerUrl,
      *         DocumentModelBuildMode.TEMPLATE,
+     *         prefix,
      *         new BuildModelOptions()
      *             .setModelId(modelId)
      *             .setDescription("model desc")
-     *             .setPrefix(prefix)
      *             .setTags(attrs),
      *         Context.NONE)
      *     .getFinalResult();
@@ -161,29 +161,29 @@ public SyncPoller beginBuildModel
      *     });
      * });
      * 
- * + * * - * @param trainingFilesUrl an Azure Storage blob container's SAS URI. A container URI (without SAS) + * @param blobContainerUrl an Azure Storage blob container's SAS URI. A container URI (without SAS) * can be used if the container is public or has a managed identity configured. For more information on * setting up a training data set, see: here. * @param buildMode the preferred technique for creating models. For faster training of models use * {@link DocumentModelBuildMode#TEMPLATE}. See here * for more information on building mode for custom documents. + * @param prefix case-sensitive prefix blob name prefix to filter documents for training. * @param buildModelOptions The configurable {@link BuildModelOptions options} to pass when * building a custom document analysis model. * @param context Additional context that is passed through the Http pipeline during the service call. - * * @return A {@link SyncPoller} that polls the building model operation until it has completed, has failed, or has * been cancelled. The completed operation returns the built {@link DocumentModelDetails custom document analysis model}. * @throws HttpResponseException If building the model fails with {@link OperationStatus#FAILED} is created. - * @throws NullPointerException If {@code trainingFilesUrl} is null. + * @throws NullPointerException If {@code blobContainerUrl} is null. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller beginBuildModel( - String trainingFilesUrl, DocumentModelBuildMode buildMode, - BuildModelOptions buildModelOptions, + String blobContainerUrl, DocumentModelBuildMode buildMode, + String prefix, BuildModelOptions buildModelOptions, Context context) { - return client.beginBuildModel(trainingFilesUrl, buildMode, buildModelOptions, context) + return client.beginBuildModel(blobContainerUrl, buildMode, prefix, buildModelOptions, context) .getSyncPoller(); } diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/administration/models/BuildModelOptions.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/administration/models/BuildModelOptions.java index 4cc563364823d..b029915649fca 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/administration/models/BuildModelOptions.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/administration/models/BuildModelOptions.java @@ -14,12 +14,6 @@ public final class BuildModelOptions { private String description; - /* - * A case-sensitive prefix string to filter documents in the source path - * for training. - */ - private String prefix; - private Map tags; private String modelId; @@ -44,27 +38,6 @@ public BuildModelOptions setDescription(String description) { return this; } - /** - * Get the case-sensitive prefix string to filter - * documents in the source path for training. - * - * @return the case-sensitive prefix string to filter documents for training. - */ - public String getPrefix() { - return this.prefix; - } - - /** - * Set the case-sensitive prefix string to filter documents in the source path for training. - * - * @param prefix the prefix value to set. - * @return the BuildModelOptions object itself. - */ - public BuildModelOptions setPrefix(String prefix) { - this.prefix = prefix; - return this; - } - /** * Get the user defined attributes associated with the model. * diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/ReadmeSamples.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/ReadmeSamples.java index b80ce5ab4fc0c..7ffa84816d000 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/ReadmeSamples.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/ReadmeSamples.java @@ -214,10 +214,13 @@ public void buildModel() { // Build custom document analysis model String trainingFilesUrl = "{SAS_URL_of_your_container_in_blob_storage}"; // The shared access signature (SAS) Url of your Azure Blob Storage container with your forms. + String prefix = "{blob_name_prefix}}"; SyncPoller buildOperationPoller = documentModelAdminClient.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, - new BuildModelOptions().setModelId("my-build-model").setDescription("model desc"), Context.NONE); + prefix, + new BuildModelOptions().setModelId("my-build-model").setDescription("model desc"), + Context.NONE); DocumentModelDetails documentModelDetails = buildOperationPoller.getFinalResult(); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/administration/BuildModel.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/administration/BuildModel.java index 562a20188af50..8ed3f5bacb371 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/administration/BuildModel.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/administration/BuildModel.java @@ -39,11 +39,13 @@ public static void main(String[] args) { .buildClient(); // Build custom document analysis model - String trainingFilesUrl = "{SAS_URL_of_your_container_in_blob_storage}"; + String blobContainerUrl = "{SAS_URL_of_your_container_in_blob_storage}"; // The shared access signature (SAS) Url of your Azure Blob Storage container with your forms. + String prefix = "{blob_name_prefix}"; SyncPoller buildOperationPoller = - client.beginBuildModel(trainingFilesUrl, + client.beginBuildModel(blobContainerUrl, DocumentModelBuildMode.TEMPLATE, + prefix, new BuildModelOptions() .setModelId("custom-model-id") .setDescription("model desc"), diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/administration/BuildModelAsync.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/administration/BuildModelAsync.java index ef9146e9f2b5c..5e5becc3c91a3 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/administration/BuildModelAsync.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/administration/BuildModelAsync.java @@ -40,11 +40,12 @@ public static void main(String[] args) { .endpoint("https://{endpoint}.cognitiveservices.azure.com/") .buildAsyncClient(); - String trainingFilesUrl = "{SAS_URL_of_your_container_in_blob_storage}"; + String blobContainerUrl = "{SAS_URL_of_your_container_in_blob_storage}"; // The shared access signature (SAS) Url of your Azure Blob Storage container with your forms. + String prefix = "{blob_name_prefix}"; PollerFlux buildModelPoller = - client.beginBuildModel(trainingFilesUrl, - DocumentModelBuildMode.TEMPLATE, + client.beginBuildModel(blobContainerUrl, + DocumentModelBuildMode.TEMPLATE, prefix, new BuildModelOptions() .setModelId("custom-model-id") .setDescription("my custom model desc")); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/administration/ComposeModelAsync.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/administration/ComposeModelAsync.java index e89b1f0b1055a..27ca52d40ff2a 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/administration/ComposeModelAsync.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/administration/ComposeModelAsync.java @@ -43,13 +43,13 @@ public static void main(final String[] args) { String model1TrainingFiles = "{SAS_URL_of_your_container_in_blob_storage_for_model_1}"; // The shared access signature (SAS) Url of your Azure Blob Storage container with your forms. PollerFlux model1Poller = - client.beginBuildModel(model1TrainingFiles, DocumentModelBuildMode.TEMPLATE, null); + client.beginBuildModel(model1TrainingFiles, DocumentModelBuildMode.TEMPLATE); // Build custom document analysis model String model2TrainingFiles = "{SAS_URL_of_your_container_in_blob_storage_for_model_2}"; // The shared access signature (SAS) Url of your Azure Blob Storage container with your forms. PollerFlux model2Poller = - client.beginBuildModel(model2TrainingFiles, DocumentModelBuildMode.TEMPLATE, null); + client.beginBuildModel(model2TrainingFiles, DocumentModelBuildMode.TEMPLATE); String labeledModelId1 = model1Poller.getSyncPoller().getFinalResult().getModelId(); String labeledModelId2 = model2Poller.getSyncPoller().getFinalResult().getModelId(); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/administration/DocumentModelAdminAsyncClientJavaDocCodeSnippets.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/administration/DocumentModelAdminAsyncClientJavaDocCodeSnippets.java index 98d585eb5a02d..1484a6f3ab45a 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/administration/DocumentModelAdminAsyncClientJavaDocCodeSnippets.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/administration/DocumentModelAdminAsyncClientJavaDocCodeSnippets.java @@ -3,15 +3,15 @@ package com.azure.ai.formrecognizer.administration; -import com.azure.ai.formrecognizer.administration.models.DocumentModelDetails; -import com.azure.ai.formrecognizer.administration.models.ModelOperationDetails; -import com.azure.ai.formrecognizer.administration.models.ResourceDetails; import com.azure.ai.formrecognizer.administration.models.BuildModelOptions; +import com.azure.ai.formrecognizer.administration.models.ComposeModelOptions; import com.azure.ai.formrecognizer.administration.models.CopyAuthorization; import com.azure.ai.formrecognizer.administration.models.CopyAuthorizationOptions; -import com.azure.ai.formrecognizer.administration.models.ComposeModelOptions; import com.azure.ai.formrecognizer.administration.models.DocumentModelBuildMode; +import com.azure.ai.formrecognizer.administration.models.DocumentModelDetails; +import com.azure.ai.formrecognizer.administration.models.ModelOperationDetails; import com.azure.ai.formrecognizer.administration.models.ModelOperationStatus; +import com.azure.ai.formrecognizer.administration.models.ResourceDetails; import com.azure.core.credential.AzureKeyCredential; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; @@ -62,8 +62,8 @@ public void createDocumentModelAdministrationAsyncClientWithPipeline() { */ public void beginBuildModel() { // BEGIN: com.azure.ai.formrecognizer.administration.DocumentModelAdministrationAsyncClient.beginBuildModel#String-DocumentModelBuildMode - String trainingFilesUrl = "{SAS-URL-of-your-container-in-blob-storage}"; - documentModelAdministrationAsyncClient.beginBuildModel(trainingFilesUrl, + String blobContainerUrl = "{SAS-URL-of-your-container-in-blob-storage}"; + documentModelAdministrationAsyncClient.beginBuildModel(blobContainerUrl, DocumentModelBuildMode.TEMPLATE ) // if polling operation completed, retrieve the final result. @@ -83,20 +83,21 @@ public void beginBuildModel() { } /** - * Code snippet for {@link DocumentModelAdministrationAsyncClient#beginBuildModel(String, DocumentModelBuildMode, BuildModelOptions)} + * Code snippet for {@link DocumentModelAdministrationAsyncClient#beginBuildModel(String, DocumentModelBuildMode, String, BuildModelOptions)} * with options */ public void beginBuildModelWithOptions() { - // BEGIN: com.azure.ai.formrecognizer.administration.DocumentModelAdministrationAsyncClient.beginBuildModel#String-DocumentModelBuildMode-BuildModelOptions - String trainingFilesUrl = "{SAS-URL-of-your-container-in-blob-storage}"; + // BEGIN: com.azure.ai.formrecognizer.administration.DocumentModelAdministrationAsyncClient.beginBuildModel#String-DocumentModelBuildMode-String-BuildModelOptions + String blobContainerUrl = "{SAS-URL-of-your-container-in-blob-storage}"; String modelId = "model-id"; Map attrs = new HashMap(); attrs.put("createdBy", "sample"); + String prefix = "Invoice"; - documentModelAdministrationAsyncClient.beginBuildModel(trainingFilesUrl, + documentModelAdministrationAsyncClient.beginBuildModel(blobContainerUrl, DocumentModelBuildMode.TEMPLATE, + prefix, new BuildModelOptions() - .setPrefix("Invoice") .setModelId(modelId) .setDescription("model desc") .setTags(attrs)) @@ -115,7 +116,7 @@ public void beginBuildModelWithOptions() { }); }); }); - // END: com.azure.ai.formrecognizer.administration.DocumentModelAdministrationAsyncClient.beginBuildModel#String-DocumentModelBuildMode-BuildModelOptions + // END: com.azure.ai.formrecognizer.administration.DocumentModelAdministrationAsyncClient.beginBuildModel#String-DocumentModelBuildMode-String-BuildModelOptions } /** diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/administration/DocumentModelAdminClientJavaDocCodeSnippets.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/administration/DocumentModelAdminClientJavaDocCodeSnippets.java index 6141e108c52c4..084a4bf2d6c47 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/administration/DocumentModelAdminClientJavaDocCodeSnippets.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/samples/java/com/azure/ai/formrecognizer/administration/DocumentModelAdminClientJavaDocCodeSnippets.java @@ -45,9 +45,9 @@ public void documentModelAdministrationClientInInitialization() { */ public void beginBuildModel() { // BEGIN: com.azure.ai.formrecognizer.administration.DocumentModelAdministrationClient.beginBuildModel#String-DocumentModelBuildMode - String trainingFilesUrl = "{SAS-URL-of-your-container-in-blob-storage}"; + String blobContainerUrl = "{SAS-URL-of-your-container-in-blob-storage}"; DocumentModelDetails documentModelDetails - = documentModelAdministrationClient.beginBuildModel(trainingFilesUrl, + = documentModelAdministrationClient.beginBuildModel(blobContainerUrl, DocumentModelBuildMode.TEMPLATE) .getFinalResult(); @@ -64,24 +64,24 @@ public void beginBuildModel() { } /** - * Code snippet for {@link DocumentModelAdministrationClient#beginBuildModel(String, DocumentModelBuildMode, BuildModelOptions, Context)} + * Code snippet for {@link DocumentModelAdministrationClient#beginBuildModel(String, DocumentModelBuildMode, String, BuildModelOptions, Context)} * with options */ public void beginBuildModelWithOptions() { - // BEGIN: com.azure.ai.formrecognizer.administration.DocumentModelAdministrationClient.beginBuildModel#String-DocumentModelBuildMode-BuildModelOptions-Context - String trainingFilesUrl = "{SAS-URL-of-your-container-in-blob-storage}"; + // BEGIN: com.azure.ai.formrecognizer.administration.DocumentModelAdministrationClient.beginBuildModel#String-DocumentModelBuildMode-String-BuildModelOptions-Context + String blobContainerUrl = "{SAS-URL-of-your-container-in-blob-storage}"; String modelId = "custom-model-id"; String prefix = "Invoice"; Map attrs = new HashMap(); attrs.put("createdBy", "sample"); DocumentModelDetails documentModelDetails - = documentModelAdministrationClient.beginBuildModel(trainingFilesUrl, + = documentModelAdministrationClient.beginBuildModel(blobContainerUrl, DocumentModelBuildMode.TEMPLATE, + prefix, new BuildModelOptions() .setModelId(modelId) .setDescription("model desc") - .setPrefix(prefix) .setTags(attrs), Context.NONE) .getFinalResult(); @@ -97,7 +97,7 @@ public void beginBuildModelWithOptions() { System.out.printf("Field confidence: %.2f", documentTypeDetails.getFieldConfidence().get(field)); }); }); - // END: com.azure.ai.formrecognizer.administration.DocumentModelAdministrationClient.beginBuildModel#String-DocumentModelBuildMode-BuildModelOptions-Context + // END: com.azure.ai.formrecognizer.administration.DocumentModelAdministrationClient.beginBuildModel#String-DocumentModelBuildMode-String-BuildModelOptions-Context } /** diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/administration/DocumentModelAdministrationClientTest b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/administration/DocumentModelAdminClientTest.java similarity index 86% rename from sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/administration/DocumentModelAdministrationClientTest rename to sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/administration/DocumentModelAdminClientTest.java index b026644276c8a..bc2deade8b4bf 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/administration/DocumentModelAdministrationClientTest +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/administration/DocumentModelAdminClientTest.java @@ -5,21 +5,21 @@ import com.azure.ai.formrecognizer.DocumentAnalysisClient; import com.azure.ai.formrecognizer.DocumentAnalysisServiceVersion; -import com.azure.ai.formrecognizer.administration.models.ResourceDetails; import com.azure.ai.formrecognizer.administration.models.BuildModelOptions; -import com.azure.ai.formrecognizer.administration.models.CopyAuthorization; import com.azure.ai.formrecognizer.administration.models.ComposeModelOptions; +import com.azure.ai.formrecognizer.administration.models.CopyAuthorization; import com.azure.ai.formrecognizer.administration.models.DocumentModelBuildMode; -import com.azure.ai.formrecognizer.administration.models.DocumentModelSummary; import com.azure.ai.formrecognizer.administration.models.DocumentModelDetails; +import com.azure.ai.formrecognizer.administration.models.DocumentModelSummary; +import com.azure.ai.formrecognizer.administration.models.ResourceDetails; import com.azure.ai.formrecognizer.models.AnalyzeResult; import com.azure.ai.formrecognizer.models.DocumentOperationResult; import com.azure.core.exception.HttpResponseException; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedResponse; -import com.azure.core.util.BinaryData; import com.azure.core.http.rest.Response; import com.azure.core.models.ResponseError; +import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.polling.SyncPoller; import io.netty.handler.codec.http.HttpResponseStatus; @@ -37,7 +37,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; -public class DocumentModelAdministrationClientTest extends DocumentModelAdministrationClientTestBase { +public class DocumentModelAdminClientTest extends DocumentModelAdministrationClientTestBase { private DocumentModelAdministrationClient client; private DocumentModelAdministrationClient getDocumentModelAdministrationClient(HttpClient httpClient, @@ -94,10 +94,10 @@ public void getModelNonExistingModelID(HttpClient httpClient, DocumentAnalysisSe public void getModelWithResponse(HttpClient httpClient, DocumentAnalysisServiceVersion serviceVersion) { client = getDocumentModelAdministrationClient(httpClient, serviceVersion); buildModelRunner((trainingDataSasUrl) -> { - DocumentModelInfo documentModelDetails = + DocumentModelDetails documentModelDetails = client.beginBuildModel(trainingDataSasUrl, DocumentModelBuildMode.TEMPLATE) .setPollInterval(durationTestMode).getFinalResult(); - Response documentModelResponse = + Response documentModelResponse = client.getModelWithResponse(documentModelDetails.getModelId(), Context.NONE); client.deleteModel(documentModelDetails.getModelId()); @@ -112,9 +112,9 @@ public void getModelWithResponse(HttpClient httpClient, DocumentAnalysisServiceV */ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.formrecognizer.TestUtils#getTestParameters") - public void validGetResourceInfo(HttpClient httpClient, DocumentAnalysisServiceVersion serviceVersion) { + public void validGetResourceDetails(HttpClient httpClient, DocumentAnalysisServiceVersion serviceVersion) { client = getDocumentModelAdministrationClient(httpClient, serviceVersion); - validateResourceInfo(client.getResourceInfo()); + validateResourceInfo(client.getResourceDetails()); } /** @@ -122,12 +122,12 @@ public void validGetResourceInfo(HttpClient httpClient, DocumentAnalysisServiceV */ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.formrecognizer.TestUtils#getTestParameters") - public void validGetResourceInfoWithResponse(HttpClient httpClient, - DocumentAnalysisServiceVersion serviceVersion) { + public void validGetResourceDetailsWithResponse(HttpClient httpClient, + DocumentAnalysisServiceVersion serviceVersion) { client = getDocumentModelAdministrationClient(httpClient, serviceVersion); - Response resourceInfoResponse = client.getResourceInfoWithResponse(Context.NONE); - assertEquals(resourceInfoResponse.getStatusCode(), HttpResponseStatus.OK.code()); - validateResourceInfo(resourceInfoResponse.getValue()); + Response resourceDetailsResponse = client.getResourceDetailsWithResponse(Context.NONE); + assertEquals(resourceDetailsResponse.getStatusCode(), HttpResponseStatus.OK.code()); + validateResourceInfo(resourceDetailsResponse.getValue()); } /** @@ -149,11 +149,11 @@ public void deleteModelValidModelIDWithResponse(HttpClient httpClient, DocumentAnalysisServiceVersion serviceVersion) { client = getDocumentModelAdministrationClient(httpClient, serviceVersion); buildModelRunner((trainingDataSasUrl) -> { - SyncPoller syncPoller = + SyncPoller syncPoller = client.beginBuildModel(trainingDataSasUrl, DocumentModelBuildMode.TEMPLATE) .setPollInterval(durationTestMode); syncPoller.waitForCompletion(); - DocumentModelInfo createdModel = syncPoller.getFinalResult(); + DocumentModelDetails createdModel = syncPoller.getFinalResult(); final Response deleteModelWithResponse = client.deleteModelWithResponse(createdModel.getModelId(), Context.NONE); @@ -220,7 +220,7 @@ public void beginBuildModelNullInput(HttpClient httpClient, DocumentAnalysisServ client = getDocumentModelAdministrationClient(httpClient, serviceVersion); Exception exception = assertThrows(NullPointerException.class, () -> client.beginBuildModel(null, DocumentModelBuildMode.TEMPLATE)); - assertEquals("'trainingFilesUrl' cannot be null.", exception.getMessage()); + assertEquals("'blobContainerUrl' cannot be null.", exception.getMessage()); } /** @@ -231,18 +231,18 @@ public void beginBuildModelNullInput(HttpClient httpClient, DocumentAnalysisServ public void beginCopy(HttpClient httpClient, DocumentAnalysisServiceVersion serviceVersion) { client = getDocumentModelAdministrationClient(httpClient, serviceVersion); buildModelRunner((trainingFilesUrl) -> { - SyncPoller syncPoller = + SyncPoller syncPoller = client.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE) .setPollInterval(durationTestMode); syncPoller.waitForCompletion(); - DocumentModelInfo actualModel = syncPoller.getFinalResult(); + DocumentModelDetails actualModel = syncPoller.getFinalResult(); CopyAuthorization target = client.getCopyAuthorization(); - SyncPoller + SyncPoller copyPoller = client.beginCopyModelTo(actualModel.getModelId(), target) .setPollInterval(durationTestMode); - DocumentModelInfo copiedModel = copyPoller.getFinalResult(); + DocumentModelDetails copiedModel = copyPoller.getFinalResult(); Assertions.assertEquals(target.getTargetModelId(), copiedModel.getModelId()); client.deleteModel(actualModel.getModelId()); @@ -269,7 +269,7 @@ public void beginBuildModelWithJPGTrainingSet(HttpClient httpClient, DocumentAnalysisServiceVersion serviceVersion) { client = getDocumentModelAdministrationClient(httpClient, serviceVersion); buildModelRunner((trainingFilesUrl) -> { - SyncPoller buildModelPoller = + SyncPoller buildModelPoller = client.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE) .setPollInterval(durationTestMode); buildModelPoller.waitForCompletion(); @@ -287,7 +287,7 @@ public void beginBuildModelWithMultiPagePDFTrainingSet(HttpClient httpClient, DocumentAnalysisServiceVersion serviceVersion) { client = getDocumentModelAdministrationClient(httpClient, serviceVersion); multipageTrainingRunner(trainingFilesUrl -> { - SyncPoller buildModelPoller = + SyncPoller buildModelPoller = client.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE) .setPollInterval(durationTestMode); buildModelPoller.waitForCompletion(); @@ -303,13 +303,16 @@ public void beginBuildModelWithMultiPagePDFTrainingSet(HttpClient httpClient, @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.formrecognizer.TestUtils#getTestParameters") public void beginBuildModelFailsWithInvalidPrefix(HttpClient httpClient, - DocumentAnalysisServiceVersion serviceVersion) { + DocumentAnalysisServiceVersion serviceVersion) { client = getDocumentModelAdministrationClient(httpClient, serviceVersion); buildModelRunner((trainingFilesUrl) -> { HttpResponseException exception = assertThrows(HttpResponseException.class, () -> - client.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, - new BuildModelOptions().setPrefix("invalidPrefix") + client.beginBuildModel(trainingFilesUrl, + DocumentModelBuildMode.TEMPLATE, + "invalidPrefix", + null, + Context.NONE) .setPollInterval(durationTestMode)); final ResponseError responseError = (ResponseError) exception.getValue(); @@ -328,7 +331,7 @@ public void beginBuildModelIncludeSubfolderWithNonExistPrefixName(HttpClient htt client = getDocumentModelAdministrationClient(httpClient, serviceVersion); multipageTrainingRunner(trainingFilesUrl -> { HttpResponseException exception = assertThrows(HttpResponseException.class, () -> - client.beginBuildModel(trainingFilesUrl.setPrefix("subfolders"), DocumentModelBuildMode.TEMPLATE) + client.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, "subfolders", null, Context.NONE) .setPollInterval(durationTestMode)); final ResponseError responseError = (ResponseError) exception.getValue(); @@ -344,25 +347,25 @@ public void beginBuildModelIncludeSubfolderWithNonExistPrefixName(HttpClient htt public void beginCreateComposedModel(HttpClient httpClient, DocumentAnalysisServiceVersion serviceVersion) { client = getDocumentModelAdministrationClient(httpClient, serviceVersion); buildModelRunner((trainingFilesUrl) -> { - SyncPoller syncPoller1 = - client.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, - new BuildModelOptions().setModelId("sync_component_model_1" + UUID.randomUUID()), Context.NONE) + SyncPoller syncPoller1 = + client.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, null, + new BuildModelOptions().setModelId("sync_component_model_1" + UUID.randomUUID()), Context.NONE) .setPollInterval(durationTestMode); syncPoller1.waitForCompletion(); - DocumentModelInfo createdModel1 = syncPoller1.getFinalResult(); + DocumentModelDetails createdModel1 = syncPoller1.getFinalResult(); - SyncPoller syncPoller2 = - client.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, - new BuildModelOptions().setModelId("sync_component_model_2" + UUID.randomUUID()), Context.NONE) + SyncPoller syncPoller2 = + client.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, null, + new BuildModelOptions().setModelId("sync_component_model_2" + UUID.randomUUID()), Context.NONE) .setPollInterval(durationTestMode); syncPoller2.waitForCompletion(); - DocumentModelInfo createdModel2 = syncPoller2.getFinalResult(); + DocumentModelDetails createdModel2 = syncPoller2.getFinalResult(); final List modelIDList = Arrays.asList(createdModel1.getModelId(), createdModel2.getModelId()); - DocumentModelInfo composedModel = - client.beginCreateComposedModel(modelIDList, - new CreateComposedModelOptions().setModelId("sync_java_composed_model" + UUID.randomUUID()) + DocumentModelDetails composedModel = + client.beginComposeModel(modelIDList, + new ComposeModelOptions().setModelId("sync_java_composed_model" + UUID.randomUUID()) .setDescription("test desc"), Context.NONE) .setPollInterval(durationTestMode) @@ -370,8 +373,8 @@ public void beginCreateComposedModel(HttpClient httpClient, DocumentAnalysisServ assertNotNull(composedModel.getModelId()); assertEquals("test desc", composedModel.getDescription()); - assertEquals(2, composedModel.getDocTypes().size()); - composedModel.getDocTypes().forEach((key, documentTypeDetails) -> { + assertEquals(2, composedModel.getDocumentTypes().size()); + composedModel.getDocumentTypes().forEach((key, documentTypeDetails) -> { if (key.contains("sync_component_model_1") || key.contains("sync_component_model_2")) { assert true; } else { diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/administration/DocumentModelAdministrationAsyncClientTest.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/administration/DocumentModelAdministrationAsyncClientTest.java index 8dff37a9cf8f3..8ab61f7255a57 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/administration/DocumentModelAdministrationAsyncClientTest.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/administration/DocumentModelAdministrationAsyncClientTest.java @@ -84,7 +84,7 @@ public void getDocumentAnalysisClientAndValidate(HttpClient httpClient, */ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.formrecognizer.TestUtils#getTestParameters") - public void validGetResourceInfo(HttpClient httpClient, DocumentAnalysisServiceVersion serviceVersion) { + public void validGetResourceDetails(HttpClient httpClient, DocumentAnalysisServiceVersion serviceVersion) { client = getDocumentModelAdminAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getResourceDetails()) .assertNext(DocumentModelAdministrationClientTestBase::validateResourceInfo) @@ -96,7 +96,7 @@ public void validGetResourceInfo(HttpClient httpClient, DocumentAnalysisServiceV */ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.formrecognizer.TestUtils#getTestParameters") - public void validGetResourceInfoWithResponse(HttpClient httpClient, + public void validGetResourceDetailsWithResponse(HttpClient httpClient, DocumentAnalysisServiceVersion serviceVersion) { client = getDocumentModelAdminAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getResourceDetails()) @@ -112,7 +112,7 @@ public void deleteModelValidModelIdWithResponse(HttpClient httpClient, client = getDocumentModelAdminAsyncClient(httpClient, serviceVersion); buildModelRunner((trainingFilesUrl) -> { SyncPoller syncPoller1 = - client.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, null) + client.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, null, null) .setPollInterval(durationTestMode).getSyncPoller(); syncPoller1.waitForCompletion(); DocumentModelDetails createdModel = syncPoller1.getFinalResult(); @@ -155,14 +155,14 @@ public void beginCreateComposedModel(HttpClient httpClient, DocumentAnalysisServ client = getDocumentModelAdminAsyncClient(httpClient, serviceVersion); buildModelRunner((trainingFilesUrl) -> { SyncPoller syncPoller1 = - client.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, + client.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, null, new BuildModelOptions().setModelId("async_component_model_1")) .setPollInterval(durationTestMode).getSyncPoller(); syncPoller1.waitForCompletion(); DocumentModelDetails createdModel1 = syncPoller1.getFinalResult(); SyncPoller syncPoller2 = - client.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, + client.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, null, new BuildModelOptions().setModelId("async_component_model_2")) .setPollInterval(durationTestMode).getSyncPoller(); syncPoller2.waitForCompletion(); @@ -203,13 +203,13 @@ public void createComposedModelWithOptions(HttpClient httpClient, DocumentAnalys buildModelRunner((trainingFilesUrl) -> { SyncPoller syncPoller1 = - client.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, null) + client.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, null, null) .setPollInterval(durationTestMode).getSyncPoller(); syncPoller1.waitForCompletion(); DocumentModelDetails createdModel1 = syncPoller1.getFinalResult(); SyncPoller syncPoller2 = - client.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, null) + client.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, null, null) .setPollInterval(durationTestMode).getSyncPoller(); syncPoller2.waitForCompletion(); DocumentModelDetails createdModel2 = syncPoller2.getFinalResult(); @@ -246,7 +246,7 @@ public void beginBuildModel(HttpClient httpClient, DocumentAnalysisServiceVersio client = getDocumentModelAdminAsyncClient(httpClient, serviceVersion); buildModelRunner((trainingFilesUrl) -> { SyncPoller syncPoller1 = - client.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, null) + client.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, null, null) .setPollInterval(durationTestMode).getSyncPoller(); syncPoller1.waitForCompletion(); DocumentModelDetails createdModel1 = syncPoller1.getFinalResult(); @@ -268,7 +268,7 @@ public void beginBuildModelThrowsHttpResponseException(HttpClient httpClient, Do if (!AzureAuthorityHosts.AZURE_GOVERNMENT.equals(TestUtils.getAuthority(client.getEndpoint()))) { HttpResponseException httpResponseException = Assertions.assertThrows(HttpResponseException.class, () -> - client.beginBuildModel(errorTrainingFilesUrl, DocumentModelBuildMode.TEMPLATE, null) + client.beginBuildModel(errorTrainingFilesUrl, DocumentModelBuildMode.TEMPLATE) .setPollInterval(durationTestMode) .getSyncPoller() .getFinalResult()); @@ -278,7 +278,7 @@ public void beginBuildModelThrowsHttpResponseException(HttpClient httpClient, Do } else { HttpResponseException httpResponseException = Assertions.assertThrows(HttpResponseException.class, () -> - client.beginBuildModel(errorTrainingFilesUrl, DocumentModelBuildMode.TEMPLATE, null) + client.beginBuildModel(errorTrainingFilesUrl, DocumentModelBuildMode.TEMPLATE, null, null) .setPollInterval(durationTestMode) .getSyncPoller() .getFinalResult()); @@ -301,7 +301,7 @@ public void beginBuildModelWithOptions(HttpClient httpClient, DocumentAnalysisSe buildModelRunner((trainingFilesUrl) -> { SyncPoller syncPoller1 = - client.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, + client.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, null, new BuildModelOptions() .setModelId(modelId) .setDescription(TestUtils.EXPECTED_DESC) @@ -329,8 +329,8 @@ public void beginBuildModelFailsWithInvalidPrefix(HttpClient httpClient, Documen client = getDocumentModelAdminAsyncClient(httpClient, serviceVersion); buildModelRunner((trainingFilesUrl) -> { - StepVerifier.create(client.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, - new BuildModelOptions().setPrefix("invalidPrefix")) + StepVerifier.create(client.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, "invalidPrefix", + null) .setPollInterval(durationTestMode)) .verifyErrorSatisfies(throwable -> { assertEquals(HttpResponseException.class, throwable.getClass()); @@ -349,7 +349,7 @@ public void beginCopy(HttpClient httpClient, DocumentAnalysisServiceVersion serv client = getDocumentModelAdminAsyncClient(httpClient, serviceVersion); buildModelRunner((trainingFilesUrl) -> { SyncPoller syncPoller1 = - client.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, null) + client.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, null, null) .setPollInterval(durationTestMode).getSyncPoller(); syncPoller1.waitForCompletion(); DocumentModelDetails actualModel = syncPoller1.getFinalResult(); @@ -382,7 +382,7 @@ public void beginCopyWithOptions(HttpClient httpClient, DocumentAnalysisServiceV buildModelRunner((trainingFilesUrl) -> { SyncPoller syncPoller1 = - client.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, null) + client.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, null, null) .setPollInterval(durationTestMode).getSyncPoller(); syncPoller1.waitForCompletion(); DocumentModelDetails actualModel = syncPoller1.getFinalResult(); @@ -452,7 +452,7 @@ public void getModelWithResponse(HttpClient httpClient, DocumentAnalysisServiceV client = getDocumentModelAdminAsyncClient(httpClient, serviceVersion); buildModelRunner((trainingFilesUrl) -> { SyncPoller syncPoller1 = - client.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, null) + client.beginBuildModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, null, null) .setPollInterval(durationTestMode).getSyncPoller(); syncPoller1.waitForCompletion(); DocumentModelDetails createdModel = syncPoller1.getFinalResult(); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/administration/DocumentModelAdministrationClientTestBase.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/administration/DocumentModelAdministrationClientTestBase.java index 082a05b6688d9..ed5c3966440b5 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/administration/DocumentModelAdministrationClientTestBase.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/administration/DocumentModelAdministrationClientTestBase.java @@ -134,6 +134,10 @@ void buildModelErrorRunner(Consumer testRunner) { TestUtils.getErrorTrainingDataContainerHelper(testRunner, interceptorManager.isPlaybackMode()); } + void multipageTrainingRunner(Consumer testRunner) { + TestUtils.getMultipageTrainingContainerHelper(testRunner, interceptorManager.isPlaybackMode()); + } + private String getEndpoint() { return interceptorManager.isPlaybackMode() ? "https://localhost:8080" diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.beginBuildModelFailsWithInvalidPrefix[1].json b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.beginBuildModelFailsWithInvalidPrefix[1].json similarity index 100% rename from sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.beginBuildModelFailsWithInvalidPrefix[1].json rename to sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.beginBuildModelFailsWithInvalidPrefix[1].json diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.beginBuildModelIncludeSubfolderWithNonExistPrefixName[1].json b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.beginBuildModelIncludeSubfolderWithNonExistPrefixName[1].json similarity index 100% rename from sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.beginBuildModelIncludeSubfolderWithNonExistPrefixName[1].json rename to sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.beginBuildModelIncludeSubfolderWithNonExistPrefixName[1].json diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.beginBuildModelNullInput[1].json b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.beginBuildModelNullInput[1].json similarity index 100% rename from sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.beginBuildModelNullInput[1].json rename to sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.beginBuildModelNullInput[1].json diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.beginBuildModelWithJPGTrainingSet[1].json b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.beginBuildModelWithJPGTrainingSet[1].json similarity index 100% rename from sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.beginBuildModelWithJPGTrainingSet[1].json rename to sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.beginBuildModelWithJPGTrainingSet[1].json diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.beginBuildModelWithMultiPagePDFTrainingSet[1].json b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.beginBuildModelWithMultiPagePDFTrainingSet[1].json similarity index 100% rename from sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.beginBuildModelWithMultiPagePDFTrainingSet[1].json rename to sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.beginBuildModelWithMultiPagePDFTrainingSet[1].json diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.beginCopy[1].json b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.beginCopy[1].json similarity index 100% rename from sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.beginCopy[1].json rename to sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.beginCopy[1].json diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.beginCreateComposedModel[1].json b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.beginCreateComposedModel[1].json similarity index 100% rename from sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.beginCreateComposedModel[1].json rename to sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.beginCreateComposedModel[1].json diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.copyAuthorization[1].json b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.copyAuthorization[1].json similarity index 100% rename from sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.copyAuthorization[1].json rename to sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.copyAuthorization[1].json diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.deleteModelNonExistingModelID[1].json b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.deleteModelNonExistingModelID[1].json similarity index 100% rename from sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.deleteModelNonExistingModelID[1].json rename to sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.deleteModelNonExistingModelID[1].json diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.deleteModelValidModelIDWithResponse[1].json b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.deleteModelValidModelIDWithResponse[1].json similarity index 100% rename from sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.deleteModelValidModelIDWithResponse[1].json rename to sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.deleteModelValidModelIDWithResponse[1].json diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.getDocumentAnalysisClientAndValidate[1].json b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.getDocumentAnalysisClientAndValidate[1].json similarity index 100% rename from sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.getDocumentAnalysisClientAndValidate[1].json rename to sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.getDocumentAnalysisClientAndValidate[1].json diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.getModelNonExistingModelID[1].json b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.getModelNonExistingModelID[1].json similarity index 100% rename from sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.getModelNonExistingModelID[1].json rename to sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.getModelNonExistingModelID[1].json diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.getModelNullModelID[1].json b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.getModelNullModelID[1].json similarity index 100% rename from sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.getModelNullModelID[1].json rename to sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.getModelNullModelID[1].json diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.getModelWithResponse[1].json b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.getModelWithResponse[1].json similarity index 100% rename from sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.getModelWithResponse[1].json rename to sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.getModelWithResponse[1].json diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.listModelsWithContext[1].json b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.listModelsWithContext[1].json similarity index 100% rename from sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.listModelsWithContext[1].json rename to sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.listModelsWithContext[1].json diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.listModels[1].json b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.listModels[1].json similarity index 100% rename from sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.listModels[1].json rename to sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.listModels[1].json diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.validGetResourceInfoWithResponse[1].json b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.validGetResourceDetailsWithResponse[1].json similarity index 100% rename from sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.validGetResourceInfoWithResponse[1].json rename to sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.validGetResourceDetailsWithResponse[1].json diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.validGetResourceInfo[1].json b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.validGetResourceDetails[1].json similarity index 100% rename from sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationClientTest.validGetResourceInfo[1].json rename to sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdminClientTest.validGetResourceDetails[1].json diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationAsyncClientTest.validGetResourceInfoWithResponse[1].json b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationAsyncClientTest.validGetResourceDetailsWithResponse[1].json similarity index 100% rename from sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationAsyncClientTest.validGetResourceInfoWithResponse[1].json rename to sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationAsyncClientTest.validGetResourceDetailsWithResponse[1].json diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationAsyncClientTest.validGetResourceInfo[1].json b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationAsyncClientTest.validGetResourceDetails[1].json similarity index 100% rename from sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationAsyncClientTest.validGetResourceInfo[1].json rename to sdk/formrecognizer/azure-ai-formrecognizer/src/test/resources/session-records/DocumentModelAdministrationAsyncClientTest.validGetResourceDetails[1].json