diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/CHANGELOG.md b/sdk/formrecognizer/Azure.AI.FormRecognizer/CHANGELOG.md
index 99e784be239a..dcb4c432f480 100644
--- a/sdk/formrecognizer/Azure.AI.FormRecognizer/CHANGELOG.md
+++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/CHANGELOG.md
@@ -26,6 +26,7 @@
- `RecognizeCustomFormsOperation` now returns a `RecognizedFormCollection`.
- In preparation for service-side changes, `FieldValue.AsInt32` has been replaced by `FieldValue.AsInt64`, which returns a `long`.
- The order of the values for `USReceiptType` have changed so that `Other` has now a value of `1`.
+- Parameter `useTrainingLabels` is now required for `FormTrainingClient.StartTraining`.
### New Features
diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/README.md b/sdk/formrecognizer/Azure.AI.FormRecognizer/README.md
index 5298422c68ce..d793a0e59b6e 100644
--- a/sdk/formrecognizer/Azure.AI.FormRecognizer/README.md
+++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/README.md
@@ -228,7 +228,7 @@ Train a machine-learned model on your own form types. The resulting model will b
// https://docs.microsoft.com/azure/cognitive-services/form-recognizer/quickstarts/curl-train-extract#train-a-form-recognizer-model
FormTrainingClient client = new FormTrainingClient(new Uri(endpoint), new AzureKeyCredential(apiKey));
-CustomFormModel model = await client.StartTrainingAsync(new Uri(trainingFileUrl)).WaitForCompletionAsync();
+CustomFormModel model = await client.StartTrainingAsync(new Uri(trainingFileUrl), useTrainingLabels: false).WaitForCompletionAsync();
Console.WriteLine($"Custom Model Info:");
Console.WriteLine($" Model Id: {model.ModelId}");
@@ -275,7 +275,7 @@ foreach (CustomFormModelInfo modelInfo in models.Take(10))
}
// Create a new model to store in the account
-CustomFormModel model = await client.StartTrainingAsync(new Uri(trainingFileUrl)).WaitForCompletionAsync();
+CustomFormModel model = await client.StartTrainingAsync(new Uri(trainingFileUrl), useTrainingLabels: false).WaitForCompletionAsync();
// Get the model that was just created
CustomFormModel modelCopy = client.GetCustomModel(model.ModelId);
diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/samples/Sample4_TrainModel.md b/sdk/formrecognizer/Azure.AI.FormRecognizer/samples/Sample4_TrainModel.md
index f9ae04b662cb..e6e2fd042898 100644
--- a/sdk/formrecognizer/Azure.AI.FormRecognizer/samples/Sample4_TrainModel.md
+++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/samples/Sample4_TrainModel.md
@@ -28,7 +28,7 @@ Train custom models to recognize all fields and values found in your custom form
// https://docs.microsoft.com/azure/cognitive-services/form-recognizer/quickstarts/curl-train-extract#train-a-form-recognizer-model
FormTrainingClient client = new FormTrainingClient(new Uri(endpoint), new AzureKeyCredential(apiKey));
-CustomFormModel model = await client.StartTrainingAsync(new Uri(trainingFileUrl)).WaitForCompletionAsync();
+CustomFormModel model = await client.StartTrainingAsync(new Uri(trainingFileUrl), useTrainingLabels: false).WaitForCompletionAsync();
Console.WriteLine($"Custom Model Info:");
Console.WriteLine($" Model Id: {model.ModelId}");
diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/samples/Sample5_ManageCustomModels.md b/sdk/formrecognizer/Azure.AI.FormRecognizer/samples/Sample5_ManageCustomModels.md
index 5c9ede86f99b..9bc9f7be37b8 100644
--- a/sdk/formrecognizer/Azure.AI.FormRecognizer/samples/Sample5_ManageCustomModels.md
+++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/samples/Sample5_ManageCustomModels.md
@@ -46,7 +46,7 @@ foreach (CustomFormModelInfo modelInfo in models.Take(10))
}
// Create a new model to store in the account
-CustomFormModel model = await client.StartTrainingAsync(new Uri(trainingFileUrl)).WaitForCompletionAsync();
+CustomFormModel model = await client.StartTrainingAsync(new Uri(trainingFileUrl), useTrainingLabels: false).WaitForCompletionAsync();
// Get the model that was just created
CustomFormModel modelCopy = client.GetCustomModel(model.ModelId);
diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/FormTrainingClient.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/FormTrainingClient.cs
index 2dd4982914e4..30eac2980c53 100644
--- a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/FormTrainingClient.cs
+++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/FormTrainingClient.cs
@@ -114,7 +114,7 @@ public FormTrainingClient(Uri endpoint, TokenCredential credential, FormRecogniz
/// A to wait on this long-running operation. Its .Value upon successful
/// completion will contain meta-data about the trained model.
[ForwardsClientCalls]
- public virtual TrainingOperation StartTraining(Uri trainingFilesUri, bool useTrainingLabels = false, TrainingFileFilter trainingFileFilter = default, CancellationToken cancellationToken = default)
+ public virtual TrainingOperation StartTraining(Uri trainingFilesUri, bool useTrainingLabels, TrainingFileFilter trainingFileFilter = default, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(trainingFilesUri, nameof(trainingFilesUri));
@@ -134,7 +134,7 @@ public virtual TrainingOperation StartTraining(Uri trainingFilesUri, bool useTra
/// A to wait on this long-running operation. Its .Value upon successful
/// completion will contain meta-data about the trained model.
[ForwardsClientCalls]
- public virtual async Task StartTrainingAsync(Uri trainingFilesUri, bool useTrainingLabels = false, TrainingFileFilter trainingFileFilter = default, CancellationToken cancellationToken = default)
+ public virtual async Task StartTrainingAsync(Uri trainingFilesUri, bool useTrainingLabels, TrainingFileFilter trainingFileFilter = default, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(trainingFilesUri, nameof(trainingFilesUri));
diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/FormTrainingClient/FormTrainingClientLiveTests.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/FormTrainingClient/FormTrainingClientLiveTests.cs
index b35ca753fe65..f8831afc602b 100644
--- a/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/FormTrainingClient/FormTrainingClientLiveTests.cs
+++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/FormTrainingClient/FormTrainingClientLiveTests.cs
@@ -108,7 +108,7 @@ public async Task StartTrainingError()
var containerUrl = new Uri("https://someUrl");
- TrainingOperation operation = await client.StartTrainingAsync(containerUrl);
+ TrainingOperation operation = await client.StartTrainingAsync(containerUrl, useTrainingLabels: false);
await operation.WaitForCompletionAsync();
diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/FormTrainingClient/FormTrainingClientMockTests.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/FormTrainingClient/FormTrainingClientMockTests.cs
index e90d515561fa..6b50a68099d6 100644
--- a/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/FormTrainingClient/FormTrainingClientMockTests.cs
+++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/FormTrainingClient/FormTrainingClientMockTests.cs
@@ -55,8 +55,8 @@ public async Task StartTrainingEncodesBlankSpaces()
var encodedUriString = "https://fakeuri.com/blank%20space";
var decodedUriString = "https://fakeuri.com/blank space";
- await client.StartTrainingAsync(new Uri(encodedUriString));
- await client.StartTrainingAsync(new Uri(decodedUriString));
+ await client.StartTrainingAsync(new Uri(encodedUriString), useTrainingLabels: false);
+ await client.StartTrainingAsync(new Uri(decodedUriString), useTrainingLabels: false);
Assert.AreEqual(2, mockTransport.Requests.Count);
diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/FormTrainingClient/FormTrainingClientTests.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/FormTrainingClient/FormTrainingClientTests.cs
index e0b5ef54fd05..7110887a5080 100644
--- a/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/FormTrainingClient/FormTrainingClientTests.cs
+++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/FormTrainingClient/FormTrainingClientTests.cs
@@ -95,8 +95,8 @@ public void StartTrainingArgumentValidation()
{
FormTrainingClient client = CreateInstrumentedClient();
- Assert.ThrowsAsync(() => client.StartTrainingAsync(new Uri(string.Empty)));
- Assert.ThrowsAsync(() => client.StartTrainingAsync((Uri)null));
+ Assert.ThrowsAsync(() => client.StartTrainingAsync(new Uri(string.Empty), useTrainingLabels: false));
+ Assert.ThrowsAsync(() => client.StartTrainingAsync((Uri)null, useTrainingLabels: false));
}
[Test]
diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/samples/Sample3_RecognizeCustomFormsFromFile.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/samples/Sample3_RecognizeCustomFormsFromFile.cs
index 4f6f597bdf30..8d65afea570a 100644
--- a/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/samples/Sample3_RecognizeCustomFormsFromFile.cs
+++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/samples/Sample3_RecognizeCustomFormsFromFile.cs
@@ -27,7 +27,7 @@ public async Task RecognizeCustomFormsFromFile()
// https://docs.microsoft.com/azure/cognitive-services/form-recognizer/quickstarts/label-tool
FormTrainingClient trainingClient = new FormTrainingClient(new Uri(endpoint), new AzureKeyCredential(apiKey));
- CustomFormModel model = await trainingClient.StartTraining(new Uri(trainingFileUrl)).WaitForCompletionAsync();
+ CustomFormModel model = await trainingClient.StartTraining(new Uri(trainingFileUrl), useTrainingLabels: false).WaitForCompletionAsync();
// Proceed with the custom form recognition.
diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/samples/Sample3_RecognizeCustomFormsFromUri.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/samples/Sample3_RecognizeCustomFormsFromUri.cs
index ecbe7ff92f13..dd1222c0c55c 100644
--- a/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/samples/Sample3_RecognizeCustomFormsFromUri.cs
+++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/samples/Sample3_RecognizeCustomFormsFromUri.cs
@@ -26,7 +26,7 @@ public async Task RecognizeCustomFormsFromUri()
// https://docs.microsoft.com/azure/cognitive-services/form-recognizer/quickstarts/label-tool
FormTrainingClient trainingClient = new FormTrainingClient(new Uri(endpoint), new AzureKeyCredential(apiKey));
- CustomFormModel model = await trainingClient.StartTraining(new Uri(trainingFileUrl)).WaitForCompletionAsync();
+ CustomFormModel model = await trainingClient.StartTraining(new Uri(trainingFileUrl), useTrainingLabels: false).WaitForCompletionAsync();
// Proceed with the custom form recognition.
diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/samples/Sample4_TrainModelWithForms.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/samples/Sample4_TrainModelWithForms.cs
index 11254ff6f225..332e954d5ace 100644
--- a/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/samples/Sample4_TrainModelWithForms.cs
+++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/samples/Sample4_TrainModelWithForms.cs
@@ -24,7 +24,7 @@ public async Task TrainModelWithForms()
// https://docs.microsoft.com/azure/cognitive-services/form-recognizer/quickstarts/curl-train-extract#train-a-form-recognizer-model
FormTrainingClient client = new FormTrainingClient(new Uri(endpoint), new AzureKeyCredential(apiKey));
- CustomFormModel model = await client.StartTrainingAsync(new Uri(trainingFileUrl)).WaitForCompletionAsync();
+ CustomFormModel model = await client.StartTrainingAsync(new Uri(trainingFileUrl), useTrainingLabels: false).WaitForCompletionAsync();
Console.WriteLine($"Custom Model Info:");
Console.WriteLine($" Model Id: {model.ModelId}");
diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/samples/Sample6_ManageCustomModels.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/samples/Sample6_ManageCustomModels.cs
index 5f01b5ff095f..8456eff24a8e 100644
--- a/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/samples/Sample6_ManageCustomModels.cs
+++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/samples/Sample6_ManageCustomModels.cs
@@ -42,7 +42,7 @@ public async Task ManageCustomModels()
}
// Create a new model to store in the account
- CustomFormModel model = await client.StartTrainingAsync(new Uri(trainingFileUrl)).WaitForCompletionAsync();
+ CustomFormModel model = await client.StartTrainingAsync(new Uri(trainingFileUrl), useTrainingLabels: false).WaitForCompletionAsync();
// Get the model that was just created
CustomFormModel modelCopy = client.GetCustomModel(model.ModelId);
diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/samples/Sample6_ManageCustomModelsAsync.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/samples/Sample6_ManageCustomModelsAsync.cs
index dec14dc46a53..27922da6c9c5 100644
--- a/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/samples/Sample6_ManageCustomModelsAsync.cs
+++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/samples/Sample6_ManageCustomModelsAsync.cs
@@ -40,7 +40,7 @@ public async Task ManageCustomModelsAsync()
}
// Create a new model to store in the account
- CustomFormModel model = await client.StartTrainingAsync(new Uri(trainingFileUrl)).WaitForCompletionAsync();
+ CustomFormModel model = await client.StartTrainingAsync(new Uri(trainingFileUrl), useTrainingLabels: false).WaitForCompletionAsync();
// Get the model that was just created
CustomFormModel modelCopy = await client.GetCustomModelAsync(model.ModelId);
diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/samples/Sample7_CopyModel.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/samples/Sample7_CopyModel.cs
index c6ae8db80d1f..005e382680ea 100644
--- a/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/samples/Sample7_CopyModel.cs
+++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/samples/Sample7_CopyModel.cs
@@ -31,7 +31,7 @@ public async Task CopyModel()
// For the purpose of this sample, we are going to create a trained model to copy. Please note that
// if you already have a model, this is not neccesary.
- CustomFormModel model = await sourceClient.StartTraining(new Uri(trainingFileUrl)).WaitForCompletionAsync();
+ CustomFormModel model = await sourceClient.StartTraining(new Uri(trainingFileUrl), useTrainingLabels: false).WaitForCompletionAsync();
string modelId = model.ModelId;
#region Snippet:FormRecognizerSample6CreateCopyTargetClient
diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/samples/SampleSnippets.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/samples/SampleSnippets.cs
index 1a188ee6e120..ae90678bdf2c 100644
--- a/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/samples/SampleSnippets.cs
+++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/samples/SampleSnippets.cs
@@ -132,7 +132,7 @@ public async Task RecognizeCustomFormsFromFile()
// Firstly, create a trained model we can use to recognize the custom form.
FormTrainingClient trainingClient = new FormTrainingClient(new Uri(endpoint), new AzureKeyCredential(apiKey));
- CustomFormModel model = await trainingClient.StartTraining(new Uri(trainingFileUrl)).WaitForCompletionAsync();
+ CustomFormModel model = await trainingClient.StartTraining(new Uri(trainingFileUrl), useTrainingLabels: false).WaitForCompletionAsync();
// Proceed with the custom form recognition.