From 9ac19d42fa444100a3cb360c9efa95be5dcfae8a Mon Sep 17 00:00:00 2001 From: Ahmed Leithy Date: Tue, 21 Sep 2021 19:53:09 +0200 Subject: [PATCH 01/22] Resolving generated code --- .../src/Generated/Models/AnalyzeTasks.cs | 1 + .../src/Generated/Models/CustomEntitiesTask.cs | 2 ++ .../Models/CustomEntitiesTaskParameters.Serialization.cs | 2 +- .../src/Generated/Models/CustomEntitiesTaskParameters.cs | 2 +- .../src/Generated/Models/CustomEntitiesTaskResult.cs | 1 + .../src/Generated/Models/CustomMultiClassificationTask.cs | 2 ++ .../CustomMultiClassificationTaskParameters.Serialization.cs | 2 +- .../Models/CustomMultiClassificationTaskParameters.cs | 2 +- .../Generated/Models/CustomMultiClassificationTaskResult.cs | 1 + .../src/Generated/Models/CustomSingleClassificationTask.cs | 2 ++ .../CustomSingleClassificationTaskParameters.Serialization.cs | 2 +- .../Models/CustomSingleClassificationTaskParameters.cs | 2 +- .../Generated/Models/CustomSingleClassificationTaskResult.cs | 1 + .../Generated/Models/CustomSingleClassificationTasksItem.cs | 1 + .../src/Generated/Models/ExtractiveSummarizationTask.cs | 1 + .../src/Generated/Models/JobManifestTasks.cs | 4 ++++ .../src/Generated/Models/SingleClassificationDocument.cs | 1 + .../Models/TasksStateTasksCustomEntityRecognitionTasksItem.cs | 1 + .../TasksStateTasksCustomMultiClassificationTasksItem.cs | 1 + 19 files changed, 25 insertions(+), 6 deletions(-) diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTasks.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTasks.cs index 36e71d78e761..f094401a3eed 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTasks.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTasks.cs @@ -76,6 +76,7 @@ internal AnalyzeTasks(int completed, int failed, int inProgress, int total, IRea public IReadOnlyList EntityLinkingTasks { get; } public IReadOnlyList SentimentAnalysisTasks { get; } public IReadOnlyList ExtractiveSummarizationTasks { get; } + /// Gets the custom entity recognition tasks. public IReadOnlyList CustomEntityRecognitionTasks { get; } public IReadOnlyList CustomSingleClassificationTasks { get; } public IReadOnlyList CustomMultiClassificationTasks { get; } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTask.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTask.cs index 55818bf4d8f9..5ef5e897ea2b 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTask.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTask.cs @@ -15,7 +15,9 @@ public CustomEntitiesTask() { } + /// Gets or sets the parameters. public CustomEntitiesTaskParameters Parameters { get; set; } + /// Gets or sets the task name. public string TaskName { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskParameters.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskParameters.Serialization.cs index b9c741e77014..32ea35170ecd 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskParameters.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskParameters.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.AI.TextAnalytics.Models { - internal partial class CustomEntitiesTaskParameters : IUtf8JsonSerializable + public partial class CustomEntitiesTaskParameters : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskParameters.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskParameters.cs index d1a13d9bb3d1..94954472c5e2 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskParameters.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskParameters.cs @@ -10,7 +10,7 @@ namespace Azure.AI.TextAnalytics.Models { /// The CustomEntitiesTaskParameters. - internal partial class CustomEntitiesTaskParameters + public partial class CustomEntitiesTaskParameters { /// Initializes a new instance of CustomEntitiesTaskParameters. /// diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskResult.cs index 63c5e9c5f539..6135a7943522 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskResult.cs @@ -22,6 +22,7 @@ internal CustomEntitiesTaskResult(CustomEntitiesResult results) Results = results; } + /// Gets the results. public CustomEntitiesResult Results { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTask.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTask.cs index fe67e23473fa..3a32778e9a28 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTask.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTask.cs @@ -15,7 +15,9 @@ public CustomMultiClassificationTask() { } + /// Gets or sets the parameters. public CustomMultiClassificationTaskParameters Parameters { get; set; } + /// Gets or sets the task name. public string TaskName { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTaskParameters.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTaskParameters.Serialization.cs index dfbffed0afae..35bff98ae396 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTaskParameters.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTaskParameters.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.AI.TextAnalytics.Models { - internal partial class CustomMultiClassificationTaskParameters : IUtf8JsonSerializable + public partial class CustomMultiClassificationTaskParameters : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTaskParameters.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTaskParameters.cs index 44090d6ec3cd..85ecf3c119e4 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTaskParameters.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTaskParameters.cs @@ -10,7 +10,7 @@ namespace Azure.AI.TextAnalytics.Models { /// The CustomMultiClassificationTaskParameters. - internal partial class CustomMultiClassificationTaskParameters + public partial class CustomMultiClassificationTaskParameters { /// Initializes a new instance of CustomMultiClassificationTaskParameters. /// diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTaskResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTaskResult.cs index 050eeee1e4b7..df0878a961fe 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTaskResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTaskResult.cs @@ -22,6 +22,7 @@ internal CustomMultiClassificationTaskResult(CustomMultiClassificationResult res Results = results; } + /// Gets the results. public CustomMultiClassificationResult Results { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTask.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTask.cs index 952de7610f8c..45417d373524 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTask.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTask.cs @@ -15,7 +15,9 @@ public CustomSingleClassificationTask() { } + /// Gets or sets the parameters. public CustomSingleClassificationTaskParameters Parameters { get; set; } + /// Gets or sets the task name. public string TaskName { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTaskParameters.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTaskParameters.Serialization.cs index 5d96c7ef6108..a7d76e298f46 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTaskParameters.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTaskParameters.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.AI.TextAnalytics.Models { - internal partial class CustomSingleClassificationTaskParameters : IUtf8JsonSerializable + public partial class CustomSingleClassificationTaskParameters : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTaskParameters.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTaskParameters.cs index 078a10ae94ba..3e83dcf14785 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTaskParameters.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTaskParameters.cs @@ -10,7 +10,7 @@ namespace Azure.AI.TextAnalytics.Models { /// The CustomSingleClassificationTaskParameters. - internal partial class CustomSingleClassificationTaskParameters + public partial class CustomSingleClassificationTaskParameters { /// Initializes a new instance of CustomSingleClassificationTaskParameters. /// diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTaskResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTaskResult.cs index 0a5dcece9cce..feec1de8531b 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTaskResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTaskResult.cs @@ -22,6 +22,7 @@ internal CustomSingleClassificationTaskResult(CustomSingleClassificationResult r Results = results; } + /// Gets the results. public CustomSingleClassificationResult Results { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTasksItem.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTasksItem.cs index 688815726b1f..1018cbf22f9e 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTasksItem.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTasksItem.cs @@ -30,6 +30,7 @@ internal CustomSingleClassificationTasksItem(DateTimeOffset lastUpdateDateTime, Results = results; } + /// Gets the results. public CustomSingleClassificationResult Results { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationTask.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationTask.cs index 3be425325457..612d3bcf408d 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationTask.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationTask.cs @@ -16,6 +16,7 @@ public ExtractiveSummarizationTask() } public ExtractiveSummarizationTaskParameters Parameters { get; set; } + /// Gets or sets the task name. public string TaskName { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/JobManifestTasks.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/JobManifestTasks.cs index 59d858f79b42..acc019fa31ca 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/JobManifestTasks.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/JobManifestTasks.cs @@ -27,7 +27,11 @@ public JobManifestTasks() CustomSingleClassificationTasks = new ChangeTrackingList(); CustomMultiClassificationTasks = new ChangeTrackingList(); } + /// Gets the custom entity recognition tasks. public IList CustomEntityRecognitionTasks { get; } + /// Gets the custom single classification tasks. + public IList CustomSingleClassificationTasks { get; } + /// Gets the custom multi classification tasks. public IList CustomMultiClassificationTasks { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SingleClassificationDocument.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SingleClassificationDocument.cs index 9df01df57d2e..e24fe1c9070b 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SingleClassificationDocument.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SingleClassificationDocument.cs @@ -55,6 +55,7 @@ internal SingleClassificationDocument(string id, ClassificationResult classifica /// Unique, non-empty document identifier. public string Id { get; } + /// Gets the classification. public ClassificationResult Classification { get; } /// Warnings encountered while processing document. public IReadOnlyList Warnings { get; } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TasksStateTasksCustomEntityRecognitionTasksItem.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TasksStateTasksCustomEntityRecognitionTasksItem.cs index f40aa0fa71ea..e2ee2cd63ffa 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TasksStateTasksCustomEntityRecognitionTasksItem.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TasksStateTasksCustomEntityRecognitionTasksItem.cs @@ -30,6 +30,7 @@ internal TasksStateTasksCustomEntityRecognitionTasksItem(DateTimeOffset lastUpda Results = results; } + /// Gets the results. public CustomEntitiesResult Results { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TasksStateTasksCustomMultiClassificationTasksItem.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TasksStateTasksCustomMultiClassificationTasksItem.cs index 229186041f2c..da30fd18cf84 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TasksStateTasksCustomMultiClassificationTasksItem.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TasksStateTasksCustomMultiClassificationTasksItem.cs @@ -30,6 +30,7 @@ internal TasksStateTasksCustomMultiClassificationTasksItem(DateTimeOffset lastUp Results = results; } + /// Gets the results. public CustomMultiClassificationResult Results { get; } } } From be8113e2a1b048e549489b75048696442b002d3b Mon Sep 17 00:00:00 2001 From: Ahmed Leithy Date: Wed, 22 Sep 2021 14:58:40 +0200 Subject: [PATCH 02/22] Added Models --- .../src/ClassifyCustomCategoriesAction.cs | 52 ++++++++++ .../ClassifyCustomCategoriesActionResult.cs | 48 ++++++++++ .../src/ClassifyCustomCategoriesResult.cs | 46 +++++++++ ...lassifyCustomCategoriesResultCollection.cs | 95 +++++++++++++++++++ .../src/DocumentClassification.cs | 35 +++++++ .../src/DocumentClassificationCollection.cs | 59 ++++++++++++ 6 files changed, 335 insertions(+) create mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassifyCustomCategoriesAction.cs create mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassifyCustomCategoriesActionResult.cs create mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassifyCustomCategoriesResult.cs create mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassifyCustomCategoriesResultCollection.cs create mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/DocumentClassification.cs create mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/DocumentClassificationCollection.cs diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassifyCustomCategoriesAction.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassifyCustomCategoriesAction.cs new file mode 100644 index 000000000000..17cc11922d0f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassifyCustomCategoriesAction.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Azure.AI.TextAnalytics +{ + /// + /// Configurations that allow callers to specify details about how to execute + /// a Classify Custom Categories action on a set of documents. This corresponds + /// to a Multi Classification task in the text analytics service. + /// For example, the target project and deployment names are required + /// for a successful custom classification action. + /// + public class ClassifyCustomCategoriesAction + { + /// + /// Initializes a new instance of the + /// class which allows callers to specify details about how to execute + /// a Classify Custom Categories action on a set of documents. + /// Sets the and properties. + /// + public ClassifyCustomCategoriesAction(string projectName, string deploymentName) + { + DeploymentName = deploymentName; + ProjectName = projectName; + } + + /// + /// Gets the value of the property corresponding to the name of the + /// target project for this action. This property is set when calling + /// the constructor. + /// + public string ProjectName { get; } + + /// + /// Gets the value of the property corresponding to the name of the + /// deployment for this action. This property is set when calling + /// the constructor. + /// + public string DeploymentName { get; } + + /// + /// The default value of this property is 'false'. This means, Text Analytics service logs your input text for 48 hours, + /// solely to allow for troubleshooting issues. + /// Setting this property to true, disables input logging and may limit our ability to investigate issues that occur. + /// + /// Please see Cognitive Services Compliance and Privacy notes at for additional details, + /// and Microsoft Responsible AI principles at . + /// + /// + public bool? DisableServiceLogs { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassifyCustomCategoriesActionResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassifyCustomCategoriesActionResult.cs new file mode 100644 index 000000000000..9c60c601288d --- /dev/null +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassifyCustomCategoriesActionResult.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using Azure.AI.TextAnalytics.Models; + +namespace Azure.AI.TextAnalytics +{ + /// + /// The result of the execution of an on the input documents. + /// + public class ClassifyCustomCategoriesActionResult : TextAnalyticsActionResult + { + private readonly ClassifyCustomCategoriesResultCollection _documentsResults; + + /// + /// Successful action. + /// + internal ClassifyCustomCategoriesActionResult(ClassifyCustomCategoriesResultCollection result, DateTimeOffset completedOn) + : base(completedOn) + { + _documentsResults = result; + } + + /// + /// Action with an error. + /// + internal ClassifyCustomCategoriesActionResult(DateTimeOffset completedOn, TextAnalyticsErrorInternal error) + : base(completedOn, error) { } + + /// + /// Gets the result of the execution of an per each input document. + /// + public ClassifyCustomCategoriesResultCollection DocumentsResults + { + get + { + if (HasError) + { +#pragma warning disable CA1065 // Do not raise exceptions in unexpected locations + throw new InvalidOperationException($"Cannot access the results of this action, due to error {Error.ErrorCode}: {Error.Message}"); +#pragma warning restore CA1065 // Do not raise exceptions in unexpected locations + } + return _documentsResults; + } + } + } +} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassifyCustomCategoriesResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassifyCustomCategoriesResult.cs new file mode 100644 index 000000000000..b8d37ec72ce3 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassifyCustomCategoriesResult.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; + +namespace Azure.AI.TextAnalytics +{ + /// + /// The result of the classify custom categories operation on a document, + /// containing the collection of objects + /// predicted for that document. + /// + public class ClassifyCustomCategoriesResult : TextAnalyticsResult + { + private readonly DocumentClassificationCollection _documentClassifications; + internal ClassifyCustomCategoriesResult(string id, TextDocumentStatistics statistics, DocumentClassificationCollection documentClassifications, IReadOnlyCollection warnings) + : base(id, statistics) + { + _documentClassifications = documentClassifications; + Warnings = warnings; + } + + internal ClassifyCustomCategoriesResult(string id, TextAnalyticsError error) : base(id, error) { } + + /// + /// Warnings encountered while processing the document. + /// + public IReadOnlyCollection Warnings { get; } + + /// + /// Gets the collection of objects predicted for the corresponding document. + /// + public DocumentClassificationCollection DocumentClassifications + { + get + { + if (HasError) + { + throw new InvalidOperationException($"Cannot access result for document {Id}, due to error {Error.ErrorCode}: {Error.Message}"); + } + return _documentClassifications; + } + } + } +} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassifyCustomCategoriesResultCollection.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassifyCustomCategoriesResultCollection.cs new file mode 100644 index 000000000000..04ff297fce07 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassifyCustomCategoriesResultCollection.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.Linq; + +namespace Azure.AI.TextAnalytics +{ + /// + /// Collection of objects corresponding + /// to a batch of documents, and information about the batch operation. + /// + [DebuggerTypeProxy(typeof(ClassifyCustomCategoriesResultCollectionDebugView))] + public class ClassifyCustomCategoriesResultCollection : ReadOnlyCollection + { + internal ClassifyCustomCategoriesResultCollection(IList list, TextDocumentBatchStatistics statistics, + string projectName, string deploymentName) : base(list) + { + Statistics = statistics; + ProjectName = projectName; + DeploymentName = deploymentName; + } + + /// + /// Gets statistics about the documents and how it was processed + /// by the service. This property will have a value when IncludeStatistics + /// is set to true in the client call. + /// + public TextDocumentBatchStatistics Statistics { get; } + + /// + /// Gets the value of the property corresponding to the name of the + /// target project that produced these results. This should be the same + /// as the project name set when creating the + /// object used to start the operation. + /// + public string ProjectName { get; } + + /// + /// Gets the value of the property corresponding to the deployment name + /// of the project that produced these results. This should be the same + /// as the deployment name set when creating the + /// object used to start the operation. + /// + public string DeploymentName { get; } + + /// + /// Debugger Proxy class for . + /// + internal class ClassifyCustomCategoriesResultCollectionDebugView + { + private ClassifyCustomCategoriesResultCollection BaseCollection { get; } + + public ClassifyCustomCategoriesResultCollectionDebugView(ClassifyCustomCategoriesResultCollection collection) + { + BaseCollection = collection; + } + + [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] + public List Items + { + get + { + return BaseCollection.ToList(); + } + } + + public TextDocumentBatchStatistics Statistics + { + get + { + return BaseCollection.Statistics; + } + } + + public string ProjectName + { + get + { + return BaseCollection.ProjectName; + } + } + + public string DeploymentName + { + get + { + return BaseCollection.DeploymentName; + } + } + } + } +} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/DocumentClassification.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/DocumentClassification.cs new file mode 100644 index 000000000000..9391923bc67e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/DocumentClassification.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.AI.TextAnalytics.Models; + +namespace Azure.AI.TextAnalytics +{ + /// + /// A classification of an input document extracted by the classify custom category + /// operation. The service attributes a confidence score to the predicted category + /// for measuring how confident the model is in the returned prediction. + /// + public readonly struct DocumentClassification + { + internal DocumentClassification(SingleClassificationDocument sentence) + { + Category = sentence.Classification.Category; + ConfidenceScore = sentence.Classification.ConfidenceScore; + } + + /// + /// Gets the predicted category for the respective document. The possible values + /// of the category string depends on the custom categories set in the Text Analytics + /// service for the targetted project. + /// + public string Category { get; } + + /// + /// Gets the confidence score of the predictive category. This is a value + /// between 0 and 1 that represents the model's confidence in the predicted + /// class, which can be used as an indicator of the probability of correctness. + /// + public double ConfidenceScore { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/DocumentClassificationCollection.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/DocumentClassificationCollection.cs new file mode 100644 index 000000000000..53244d33bebd --- /dev/null +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/DocumentClassificationCollection.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.Linq; + +namespace Azure.AI.TextAnalytics +{ + /// + /// Collection of objects in a document, + /// and warnings encountered while processing the document. + /// + [DebuggerTypeProxy(typeof(DocumentClassificationCollectionDebugView))] + public class DocumentClassificationCollection : ReadOnlyCollection + { + internal DocumentClassificationCollection(IList documentClassifications, IList warnings) + : base(documentClassifications) + { + Warnings = new ReadOnlyCollection(warnings); + } + + /// + /// Warnings encountered while processing the document. + /// + public IReadOnlyCollection Warnings { get; } + + /// + /// Debugger Proxy class for . + /// + internal class DocumentClassificationCollectionDebugView + { + private DocumentClassificationCollection BaseCollection { get; } + + public DocumentClassificationCollectionDebugView(DocumentClassificationCollection collection) + { + BaseCollection = collection; + } + + [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] + public List Items + { + get + { + return BaseCollection.ToList(); + } + } + + public IReadOnlyCollection Warnings + { + get + { + return BaseCollection.Warnings; + } + } + } + } +} From a2b925ef2eb39e01a7b8179e632234a9c1305fbb Mon Sep 17 00:00:00 2001 From: Ahmed Leithy Date: Wed, 22 Sep 2021 15:23:59 +0200 Subject: [PATCH 03/22] Added ClassifyCustomCategories to Actions --- .../Azure.AI.TextAnalytics/src/TextAnalyticsActions.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsActions.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsActions.cs index 873564b79eed..c1ae4fb5a95f 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsActions.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsActions.cs @@ -69,5 +69,14 @@ public TextAnalyticsActions() /// This property only applies for and up. /// public IReadOnlyCollection SingleCategoryClassifyActions { get; set; } + + /// + /// The set of that will get executed on the input documents. + /// Note that currently only one is supported. + /// + /// + /// This property only applies for and up. + /// + public IReadOnlyCollection ClassifyCustomCategoriesActions { get; set; } } } From 78660d21a281176f3852d0f18cc5c0a8cce62fc8 Mon Sep 17 00:00:00 2001 From: Ahmed Leithy Date: Wed, 22 Sep 2021 15:37:11 +0200 Subject: [PATCH 04/22] Added ClassifyCustomCategories to CreatedTasks --- .../src/Generated/Models/JobManifestTasks.cs | 2 -- .../src/JobManifestTasks.cs | 5 +++++ .../src/TextAnalyticsClient.cs | 8 ++++++- .../Azure.AI.TextAnalytics/src/Transforms.cs | 22 +++++++++++++++++++ 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/JobManifestTasks.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/JobManifestTasks.cs index acc019fa31ca..4b7f8127f016 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/JobManifestTasks.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/JobManifestTasks.cs @@ -31,7 +31,5 @@ public JobManifestTasks() public IList CustomEntityRecognitionTasks { get; } /// Gets the custom single classification tasks. public IList CustomSingleClassificationTasks { get; } - /// Gets the custom multi classification tasks. - public IList CustomMultiClassificationTasks { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/JobManifestTasks.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/JobManifestTasks.cs index 04d0dcc47a04..9a500e08cabf 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/JobManifestTasks.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/JobManifestTasks.cs @@ -47,5 +47,10 @@ internal partial class JobManifestTasks /// CustomSingleClassificationTasks /// internal IList CustomSingleClassificationTasks { get; set; } + + /// + /// CustomMultiClassificationTasks + /// + internal IList CustomMultiClassificationTasks { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsClient.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsClient.cs index 243290efdae4..9e06636f98ed 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsClient.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsClient.cs @@ -2478,6 +2478,10 @@ private static JobManifestTasks CreateTasks(TextAnalyticsActions actions) { tasks.CustomSingleClassificationTasks = Transforms.ConvertFromSingleCategoryClassifyActionsToTasks(actions.SingleCategoryClassifyActions); } + if (actions.ClassifyCustomCategoriesActions != null) + { + tasks.CustomMultiClassificationTasks = Transforms.ConvertFromClassifyCustomCategoriesActionsToTasks(actions.ClassifyCustomCategoriesActions); + } return tasks; } @@ -2489,7 +2493,9 @@ private static void ValidateActions(TextAnalyticsActions actions) actions.ExtractKeyPhrasesActions?.Count > 1 || actions.AnalyzeSentimentActions?.Count > 1 || actions.ExtractSummaryActions?.Count > 1 || - actions.SingleCategoryClassifyActions?.Count > 1) + actions.SingleCategoryClassifyActions?.Count > 1 || + actions.ClassifyCustomCategoriesActions?.Count > 1 + ) { throw new ArgumentException("Multiple of the same action is not currently supported."); } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Transforms.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Transforms.cs index 0bca2de36643..415ea836521c 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Transforms.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Transforms.cs @@ -473,6 +473,17 @@ internal static CustomSingleClassificationTask ConvertToCustomSingleClassificati } }; } + + internal static CustomMultiClassificationTask ConvertToCustomMultiClassificationTask(ClassifyCustomCategoriesAction action) + { + return new CustomMultiClassificationTask() + { + Parameters = new CustomMultiClassificationTaskParameters(action.ProjectName, action.DeploymentName) + { + LoggingOptOut = action.DisableServiceLogs, + } + }; + } internal static IList ConvertFromRecognizeLinkedEntitiesActionsToTasks(IReadOnlyCollection recognizeLinkedEntitiesActions) { @@ -545,6 +556,17 @@ internal static IList ConvertFromExtractSummaryActi return list; } + internal static IList ConvertFromClassifyCustomCategoriesActionsToTasks(IReadOnlyCollection ClassifyCustomCategoriesActions) + { + List list = new List(); + + foreach (ClassifyCustomCategoriesAction action in ClassifyCustomCategoriesActions) + { + list.Add(ConvertToCustomMultiClassificationTask(action)); + } + + return list; + } internal static IList ConvertFromSingleCategoryClassifyActionsToTasks(IReadOnlyCollection singleCategoryClassifyActions) { From 267ae379e38df93e0d8848b921e3a6ca6b7bcd97 Mon Sep 17 00:00:00 2001 From: Ahmed Leithy Date: Wed, 22 Sep 2021 16:27:51 +0200 Subject: [PATCH 05/22] Setup ConvertToClassifyCustomCategoryResultCollection --- .../src/AnalyzeActionsResult.cs | 7 +++ .../src/DocumentClassification.cs | 12 +++- .../Models/AnalyzeTasks.Serialization.cs | 6 +- .../src/Generated/Models/AnalyzeTasks.cs | 6 +- ...iClassificationTasksItem.Serialization.cs} | 6 +- ... => CustomMultiClassificationTasksItem.cs} | 10 +-- .../CustomMultiClassificationTasksItem.cs | 13 ++++ .../Azure.AI.TextAnalytics/src/Transforms.cs | 62 ++++++++++++++++++- 8 files changed, 104 insertions(+), 18 deletions(-) rename sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/{TasksStateTasksCustomMultiClassificationTasksItem.Serialization.cs => CustomMultiClassificationTasksItem.Serialization.cs} (82%) rename sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/{TasksStateTasksCustomMultiClassificationTasksItem.cs => CustomMultiClassificationTasksItem.cs} (51%) create mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Internal/CustomMultiClassificationTasksItem.cs diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/AnalyzeActionsResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/AnalyzeActionsResult.cs index d2e4ea2201ce..69084b0ce3e0 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/AnalyzeActionsResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/AnalyzeActionsResult.cs @@ -18,6 +18,7 @@ internal AnalyzeActionsResult( IReadOnlyCollection analyzeSentimentActionResults, IReadOnlyCollection extractSummaryActionResults, IReadOnlyCollection singleCategoryClassifyActionResults + IReadOnlyCollection classifyCustomCategoriesActionResults ) { ExtractKeyPhrasesResults = extractKeyPhrasesActionResults; @@ -27,6 +28,7 @@ IReadOnlyCollection singleCategoryClassifyAc AnalyzeSentimentResults = analyzeSentimentActionResults; ExtractSummaryResults = extractSummaryActionResults; SingleCategoryClassifyResults = singleCategoryClassifyActionResults; + ClassifyCustomCategoriesResults = classifyCustomCategoriesActionResults; } /// @@ -63,5 +65,10 @@ IReadOnlyCollection singleCategoryClassifyAc /// Determines the collection of . /// public IReadOnlyCollection SingleCategoryClassifyResults { get; } + + /// + /// Determines the collection of . + /// + public IReadOnlyCollection ClassifyCustomCategoriesResults { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/DocumentClassification.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/DocumentClassification.cs index 9391923bc67e..794cbb90509e 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/DocumentClassification.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/DocumentClassification.cs @@ -12,10 +12,16 @@ namespace Azure.AI.TextAnalytics /// public readonly struct DocumentClassification { - internal DocumentClassification(SingleClassificationDocument sentence) + internal DocumentClassification(SingleClassificationDocument classification) { - Category = sentence.Classification.Category; - ConfidenceScore = sentence.Classification.ConfidenceScore; + Category = classification.Classification.Category; + ConfidenceScore = classification.Classification.ConfidenceScore; + } + + internal DocumentClassification(ClassificationResult classification) + { + Category = classification.Category; + ConfidenceScore = classification.ConfidenceScore; } /// diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTasks.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTasks.Serialization.cs index da14b8a0e8f9..48ad9b8bbee5 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTasks.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTasks.Serialization.cs @@ -27,7 +27,7 @@ internal static AnalyzeTasks DeserializeAnalyzeTasks(JsonElement element) Optional> extractiveSummarizationTasks = default; Optional> customEntityRecognitionTasks = default; Optional> customSingleClassificationTasks = default; - Optional> customMultiClassificationTasks = default; + Optional> customMultiClassificationTasks = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("completed")) @@ -177,10 +177,10 @@ internal static AnalyzeTasks DeserializeAnalyzeTasks(JsonElement element) property.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(TasksStateTasksCustomMultiClassificationTasksItem.DeserializeTasksStateTasksCustomMultiClassificationTasksItem(item)); + array.Add(CustomMultiClassificationTasksItem.DeserializeCustomMultiClassificationTasksItem(item)); } customMultiClassificationTasks = array; continue; diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTasks.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTasks.cs index f094401a3eed..96acf6153aab 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTasks.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTasks.cs @@ -32,7 +32,7 @@ internal AnalyzeTasks(int completed, int failed, int inProgress, int total) ExtractiveSummarizationTasks = new ChangeTrackingList(); CustomEntityRecognitionTasks = new ChangeTrackingList(); CustomSingleClassificationTasks = new ChangeTrackingList(); - CustomMultiClassificationTasks = new ChangeTrackingList(); + CustomMultiClassificationTasks = new ChangeTrackingList(); } /// Initializes a new instance of AnalyzeTasks. @@ -49,7 +49,7 @@ internal AnalyzeTasks(int completed, int failed, int inProgress, int total) /// /// /// - internal AnalyzeTasks(int completed, int failed, int inProgress, int total, IReadOnlyList entityRecognitionTasks, IReadOnlyList entityRecognitionPiiTasks, IReadOnlyList keyPhraseExtractionTasks, IReadOnlyList entityLinkingTasks, IReadOnlyList sentimentAnalysisTasks, IReadOnlyList extractiveSummarizationTasks, IReadOnlyList customEntityRecognitionTasks, IReadOnlyList customSingleClassificationTasks, IReadOnlyList customMultiClassificationTasks) + internal AnalyzeTasks(int completed, int failed, int inProgress, int total, IReadOnlyList entityRecognitionTasks, IReadOnlyList entityRecognitionPiiTasks, IReadOnlyList keyPhraseExtractionTasks, IReadOnlyList entityLinkingTasks, IReadOnlyList sentimentAnalysisTasks, IReadOnlyList extractiveSummarizationTasks, IReadOnlyList customEntityRecognitionTasks, IReadOnlyList customSingleClassificationTasks, IReadOnlyList customMultiClassificationTasks) { Completed = completed; Failed = failed; @@ -79,6 +79,6 @@ internal AnalyzeTasks(int completed, int failed, int inProgress, int total, IRea /// Gets the custom entity recognition tasks. public IReadOnlyList CustomEntityRecognitionTasks { get; } public IReadOnlyList CustomSingleClassificationTasks { get; } - public IReadOnlyList CustomMultiClassificationTasks { get; } + public IReadOnlyList CustomMultiClassificationTasks { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TasksStateTasksCustomMultiClassificationTasksItem.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTasksItem.Serialization.cs similarity index 82% rename from sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TasksStateTasksCustomMultiClassificationTasksItem.Serialization.cs rename to sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTasksItem.Serialization.cs index 2aeb6bd14005..ba2befd49d30 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TasksStateTasksCustomMultiClassificationTasksItem.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTasksItem.Serialization.cs @@ -12,9 +12,9 @@ namespace Azure.AI.TextAnalytics.Models { - internal partial class TasksStateTasksCustomMultiClassificationTasksItem + internal partial class CustomMultiClassificationTasksItem { - internal static TasksStateTasksCustomMultiClassificationTasksItem DeserializeTasksStateTasksCustomMultiClassificationTasksItem(JsonElement element) + internal static CustomMultiClassificationTasksItem DeserializeCustomMultiClassificationTasksItem(JsonElement element) { Optional results = default; DateTimeOffset lastUpdateDateTime = default; @@ -48,7 +48,7 @@ internal static TasksStateTasksCustomMultiClassificationTasksItem DeserializeTas continue; } } - return new TasksStateTasksCustomMultiClassificationTasksItem(lastUpdateDateTime, taskName.Value, status, results.Value); + return new CustomMultiClassificationTasksItem(lastUpdateDateTime, taskName.Value, status, results.Value); } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TasksStateTasksCustomMultiClassificationTasksItem.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTasksItem.cs similarity index 51% rename from sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TasksStateTasksCustomMultiClassificationTasksItem.cs rename to sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTasksItem.cs index da30fd18cf84..b04321854442 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TasksStateTasksCustomMultiClassificationTasksItem.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTasksItem.cs @@ -11,21 +11,21 @@ namespace Azure.AI.TextAnalytics.Models { /// The TasksStateTasksCustomMultiClassificationTasksItem. - internal partial class TasksStateTasksCustomMultiClassificationTasksItem : TaskState + internal partial class CustomMultiClassificationTasksItem : TaskState { - /// Initializes a new instance of TasksStateTasksCustomMultiClassificationTasksItem. + /// Initializes a new instance of CustomMultiClassificationTasksItem. /// /// - internal TasksStateTasksCustomMultiClassificationTasksItem(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status) : base(lastUpdateDateTime, status) + internal CustomMultiClassificationTasksItem(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status) : base(lastUpdateDateTime, status) { } - /// Initializes a new instance of TasksStateTasksCustomMultiClassificationTasksItem. + /// Initializes a new instance of CustomMultiClassificationTasksItem. /// /// /// /// - internal TasksStateTasksCustomMultiClassificationTasksItem(DateTimeOffset lastUpdateDateTime, string taskName, TextAnalyticsOperationStatus status, CustomMultiClassificationResult results) : base(lastUpdateDateTime, taskName, status) + internal CustomMultiClassificationTasksItem(DateTimeOffset lastUpdateDateTime, string taskName, TextAnalyticsOperationStatus status, CustomMultiClassificationResult results) : base(lastUpdateDateTime, taskName, status) { Results = results; } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Internal/CustomMultiClassificationTasksItem.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Internal/CustomMultiClassificationTasksItem.cs new file mode 100644 index 000000000000..886715f8c8cb --- /dev/null +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Internal/CustomMultiClassificationTasksItem.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core; + +namespace Azure.AI.TextAnalytics.Models +{ + /// + /// ExtractiveSummarizationTasksItem. + /// + [CodeGenModel("TasksStateTasksCustomMultiClassificationTasksItem")] + internal partial class CustomMultiClassificationTasksItem { } +} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Transforms.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Transforms.cs index 415ea836521c..520c12a78ec9 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Transforms.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Transforms.cs @@ -350,6 +350,37 @@ internal static ExtractSummaryResultCollection ConvertToExtractSummaryResultColl } #endregion + + #region Classify Custom Categories + internal static List ConvertToDocumentClassificationList(List classifications) + => classifications.Select((classification) => new DocumentClassification(classification)).ToList(); + + internal static DocumentClassificationCollection ConvertToDocumentClassificationCollection(MultiClassificationDocument extractedClassificationsDocuments) + { + return new DocumentClassificationCollection(ConvertToDocumentClassificationList(extractedClassificationsDocuments.Classifications.ToList()), ConvertToWarnings(extractedClassificationsDocuments.Warnings)); + } + + internal static ClassifyCustomCategoriesResultCollection ConvertToClassifyCustomCategoryResultCollection(CustomMultiClassificationResult results, IDictionary idToIndexMap) + { + var classifiedCustomCategoryResults = new List(); + + //Read errors + foreach (DocumentError error in results.Errors) + { + classifiedCustomCategoryResults.Add(new ClassifyCustomCategoriesResult(error.Id, ConvertToError(error.Error))); + } + + //Read sentiments + foreach (MultiClassificationDocument classificationsDocument in results.Documents) + { + classifiedCustomCategoryResults.Add(new ClassifyCustomCategoriesResult(classificationsDocument.Id, classificationsDocument.Statistics ?? default, ConvertToDocumentClassificationCollection(classificationsDocument), ConvertToWarnings(classificationsDocument.Warnings))); + } + + classifiedCustomCategoryResults = SortHeterogeneousCollection(classifiedCustomCategoryResults, idToIndexMap); + + return new ClassifyCustomCategoriesResultCollection(classifiedCustomCategoryResults, results.Statistics, results.ProjectName, results.DeploymentName); + } + #endregion #region SingleCategoryClassifyResult internal static SingleCategoryClassifyResultCollection ConvertToSingleCategoryClassifyResultCollection(CustomSingleClassificationResult results, IDictionary idToIndexMap) @@ -610,6 +641,7 @@ internal static AnalyzeActionsResult ConvertToAnalyzeActionsResult(AnalyzeJobSta IDictionary analyzeSentimentErrors = new Dictionary(); IDictionary extractSummaryErrors = new Dictionary(); IDictionary singleCategoryClassifyErrors = new Dictionary(); + IDictionary classifyCustomCategoriesErrors = new Dictionary(); if (jobState.Errors.Any()) { @@ -650,6 +682,10 @@ internal static AnalyzeActionsResult ConvertToAnalyzeActionsResult(AnalyzeJobSta { singleCategoryClassifyErrors.Add(taskIndex, error); } + else if ("customMultiClassificationTasks".Equals(taskName)) + { + classifyCustomCategoriesErrors.Add(taskIndex, error); + } else { throw new InvalidOperationException($"Invalid task name in target reference - {taskName}. \n Additional information: Error code: {error.Code} Error message: {error.Message}"); @@ -664,7 +700,31 @@ internal static AnalyzeActionsResult ConvertToAnalyzeActionsResult(AnalyzeJobSta ConvertToRecognizeLinkedEntitiesActionsResults(jobState, map, entitiesLinkingRecognitionErrors), ConvertToAnalyzeSentimentActionsResults(jobState, map, analyzeSentimentErrors), ConvertToExtractSummaryActionsResults(jobState, map, extractSummaryErrors), - ConvertToSingleCategoryClassifyResults(jobState, map, singleCategoryClassifyErrors)); + ConvertToSingleCategoryClassifyResults(jobState, map, singleCategoryClassifyErrors) + ConvertToClassifyCustomCategoriesActionsResults(jobState, map, extractSummaryErrors) + ); + } + + private static IReadOnlyCollection ConvertToClassifyCustomCategoriesActionsResults(AnalyzeJobState jobState, IDictionary idToIndexMap, IDictionary tasksErrors) + { + var collection = new List(); + int index = 0; + foreach (CustomMultiClassificationTasksItem task in jobState.Tasks.CustomMultiClassificationTasks) + { + tasksErrors.TryGetValue(index, out TextAnalyticsErrorInternal taskError); + + if (taskError != null) + { + collection.Add(new ClassifyCustomCategoriesActionResult(task.LastUpdateDateTime, taskError)); + } + else + { + collection.Add(new ClassifyCustomCategoriesActionResult(ConvertToClassifyCustomCategoryResultCollection(task.Results, idToIndexMap), task.LastUpdateDateTime)); + } + index++; + } + + return collection; } private static IReadOnlyCollection ConvertToSingleCategoryClassifyResults(AnalyzeJobState jobState, IDictionary idToIndexMap, IDictionary tasksErrors) From 7685a9cd7b6a018fdfcf6308e86a759265b0d634 Mon Sep 17 00:00:00 2001 From: Ahmed Leithy Date: Wed, 22 Sep 2021 17:53:40 +0200 Subject: [PATCH 06/22] Fixing CustomEntititesTaskParameters + ModelFactory build errors --- .../Models/CustomEntitiesTaskParameters.Serialization.cs | 2 +- .../src/Generated/Models/CustomEntitiesTaskParameters.cs | 2 +- .../src/TextAnalyticsModelFactory.cs | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskParameters.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskParameters.Serialization.cs index 32ea35170ecd..b9c741e77014 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskParameters.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskParameters.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.AI.TextAnalytics.Models { - public partial class CustomEntitiesTaskParameters : IUtf8JsonSerializable + internal partial class CustomEntitiesTaskParameters : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskParameters.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskParameters.cs index 94954472c5e2..d1a13d9bb3d1 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskParameters.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskParameters.cs @@ -10,7 +10,7 @@ namespace Azure.AI.TextAnalytics.Models { /// The CustomEntitiesTaskParameters. - public partial class CustomEntitiesTaskParameters + internal partial class CustomEntitiesTaskParameters { /// Initializes a new instance of CustomEntitiesTaskParameters. /// diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsModelFactory.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsModelFactory.cs index f698cca0344d..bd9d42ea1c13 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsModelFactory.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsModelFactory.cs @@ -726,7 +726,9 @@ public static AnalyzeActionsResult AnalyzeActionsResult( recognizeLinkedEntitiesActionsResults.ToList(), analyzeSentimentActionsResults.ToList(), new List(), - new List()); + new List(), + new List() + ); } /// @@ -757,7 +759,9 @@ IEnumerable singleCategoryClassifyActionResu recognizeLinkedEntitiesActionResults.ToList(), analyzeSentimentActionResults.ToList(), extractSummaryActionResults.ToList(), - singleCategoryClassifyActionResults.ToList()); + singleCategoryClassifyActionResults.ToList(), + new List() + ); } /// From 4e890f020d010d059b3bbb4f4c5be4dd50f32da3 Mon Sep 17 00:00:00 2001 From: Ahmed Leithy Date: Thu, 23 Sep 2021 11:59:10 +0200 Subject: [PATCH 07/22] Added samples + sample markdown --- .../Sample11_ClassifyCustomCategories.md | 102 +++++++++++++++ .../TextAnalyticsTestEnvironment.cs | 2 + .../Sample11_ClassifyCustomCategories.cs | 116 ++++++++++++++++++ .../Sample11_ClassifyCustomCategoriesAsync.cs | 103 ++++++++++++++++ ...e11_ClassifyCustomCategoriesConvenience.cs | 113 +++++++++++++++++ ...lassifyCustomCategoriesConvenienceAsync.cs | 106 ++++++++++++++++ 6 files changed, 542 insertions(+) create mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample11_ClassifyCustomCategories.md create mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategories.cs create mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategoriesAsync.cs create mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategoriesConvenience.cs create mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategoriesConvenienceAsync.cs diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample11_ClassifyCustomCategories.md b/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample11_ClassifyCustomCategories.md new file mode 100644 index 000000000000..7f31dfd1ad09 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample11_ClassifyCustomCategories.md @@ -0,0 +1,102 @@ +# Perform Custom Multiple Categories Classification in Documents +This sample demonstrates how to run a Classify Custom Multiple Categories action in one or more documents. To get started you will need a Text Analytics endpoint and credentials. See [README][README] for links and instructions. + +## Creating a `TextAnalyticsClient` + +To create a new `TextAnalyticsClient` to perform a custom category classification on a document, you need a Text Analytics endpoint and credentials. You can use the [DefaultAzureCredential][DefaultAzureCredential] to try a number of common authentication methods optimized for both running as a service and development. In the sample below, however, you'll use a Text Analytics API key credential by creating an `AzureKeyCredential` object, that if needed, will allow you to update the API key without creating a new client. + +You can set `endpoint` and `apiKey` based on an environment variable, a configuration setting, or any way that works for your application. + +```C# Snippet:CreateTextAnalyticsClient +string endpoint = ""; +string apiKey = ""; +var client = new TextAnalyticsClient(new Uri(endpoint), new AzureKeyCredential(apiKey)); +``` + +## Performing Custom Multiple Categories Classification in one or multiple documents + +To perform Custom Multiple Categories Classification in one or multiple documents, set up an `ClassifyCustomCategoriesAction` and call `StartAnalyzeActionsAsync` on the documents. The result is a Long Running operation of type `AnalyzeActionsOperation` which polls for the results from the API. + +```C# Snippet:TextAnalyticsClassifyCustomCategoriesAsync +// Get input document. +string document = @"I need a reservation for an indoor restaurant in China. Please don't stop the music. Play music and add it to my playlist."; + +// Prepare analyze operation input. You can add multiple documents to this list and perform the same +// operation to all of them. +var batchInput = new List +{ + document +}; + +var classifyCustomCategoryAction = new ClassifyCustomCategoryAction(TestEnvironment.ProjectName, TestEnvironment.DeploymentName); + +TextAnalyticsActions actions = new TextAnalyticsActions() +{ + ClassifyCustomCategoryActions = new List() { classifyCustomCategoryAction } +}; + +// Start analysis process. +AnalyzeActionsOperation operation = await client.StartAnalyzeActionsAsync(batchInput, actions); + +await operation.WaitForCompletionAsync(); +``` + +The returned `AnalyzeActionsOperation` contains general information about the status of the operation. It can be requested while the operation is running or when it has completed. For example: + +```C# Snippet:TextAnalyticsClassifyCustomCategoriesOperationStatus +// View operation status. +Console.WriteLine($"AnalyzeActions operation has completed"); +Console.WriteLine(); + +Console.WriteLine($"Created On : {operation.CreatedOn}"); +Console.WriteLine($"Expires On : {operation.ExpiresOn}"); +Console.WriteLine($"Id : {operation.Id}"); +Console.WriteLine($"Status : {operation.Status}"); +Console.WriteLine($"Last Modified: {operation.LastModified}"); +Console.WriteLine(); +``` + +To view the final results of the long-running operation: + +```C# Snippet:TextAnalyticsClassifyCustomCategoriesAsyncViewResults +// View operation results. +await foreach (AnalyzeActionsResult documentsInPage in operation.Value) +{ + IReadOnlyCollection classificationResultsCollection = documentsInPage.ClassifyCustomCategoryResults; + + foreach (ClassifyCustomCategoryActionResult classificationActionResults in classificationResultsCollection) + { + if (classificationActionResults.HasError) + { + Console.WriteLine($" Error!"); + Console.WriteLine($" Action error code: {classificationActionResults.Error.ErrorCode}."); + Console.WriteLine($" Message: {classificationActionResults.Error.Message}"); + continue; + } + + foreach (ClassifyCustomCategoryResult documentResults in classificationActionResults.DocumentsResults) + { + if (documentResults.HasError) + { + Console.WriteLine($" Error!"); + Console.WriteLine($" Document error code: {documentResults.Error.ErrorCode}."); + Console.WriteLine($" Message: {documentResults.Error.Message}"); + continue; + } + + Console.WriteLine($" Class category \"{documentResults.DocumentClassification.Category}\" predicted with a confidence score of {documentResults.DocumentClassification.ConfidenceScore}."); + Console.WriteLine(); + } + } +} +``` + +To see the full example source files, see: + +* [Synchronously Classify Custom Multiple Categories](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategories.cs) +* [Asynchronously Classify Custom Multiple Categories](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategoriesAsync.cs) +* [Synchronously Classify Custom Multiple Categories Convenience](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategoriesConvenience.cs) +* [Asynchronously Classify Custom Multiple Categories Convenience](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategoriesConvenienceAsync.cs) + +[DefaultAzureCredential]: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/README.md +[README]: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/textanalytics/Azure.AI.TextAnalytics/README.md diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/Infrastructure/TextAnalyticsTestEnvironment.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/Infrastructure/TextAnalyticsTestEnvironment.cs index 11c2ad2b7925..c62e437d6a36 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/Infrastructure/TextAnalyticsTestEnvironment.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/Infrastructure/TextAnalyticsTestEnvironment.cs @@ -11,5 +11,7 @@ public class TextAnalyticsTestEnvironment: TestEnvironment public string ApiKey => GetRecordedVariable("TEXT_ANALYTICS_API_KEY", options => options.IsSecret()); public string SingleClassificationProjectName = "659c1851-be0b-4142-b12a-087da9785926"; public string SingleClassificationDeploymentName = "659c1851-be0b-4142-b12a-087da9785926"; + public string MultiCategoriesProjectName = "7cdace98-537b-494a-b69a-c19754718025"; + public string MultiCategoriesDeploymentName = "7cdace98-537b-494a-b69a-c19754718025"; } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategories.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategories.cs new file mode 100644 index 000000000000..986501c70279 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategories.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Threading; +using Azure.AI.TextAnalytics.Tests; +using Azure.Core.TestFramework; +using NUnit.Framework; + +namespace Azure.AI.TextAnalytics.Samples +{ + public partial class TextAnalyticsSamples : SamplesBase + { + [Test] + public void ClassifyCustomCategories() + { + // Create a text analytics client. + string endpoint = TestEnvironment.Endpoint; + string apiKey = TestEnvironment.ApiKey; + string projectName = TestEnvironment.MultiCategoriesProjectName; + string deploymentName = TestEnvironment.MultiCategoriesDeploymentName; + + var client = new TextAnalyticsClient(new Uri(endpoint), new AzureKeyCredential(apiKey)); + + // Get input document. + string document = @"I need a reservation for an indoor restaurant in China. Please don't stop the music. Play music and add it to my playlist."; + + // Prepare analyze operation input. You can add multiple documents to this list and perform the same + // operation to all of them. + var batchDocuments = new List + { + new TextDocumentInput("1", document) + { + Language = "en", + } + }; + + var classifyCustomCategoriesAction = new ClassifyCustomCategoriesAction(projectName, deploymentName); + + TextAnalyticsActions actions = new TextAnalyticsActions() + { + ClassifyCustomCategoriesActions = new List() { classifyCustomCategoriesAction } + }; + + // Start analysis process. + AnalyzeActionsOperation operation = client.StartAnalyzeActions(batchDocuments, actions); + + // Wait for completion with manual polling. + TimeSpan pollingInterval = new TimeSpan(1000); + + while (true) + { + Console.WriteLine($"Status: {operation.Status}"); + operation.UpdateStatus(); + if (operation.HasCompleted) + { + break; + } + + Thread.Sleep(pollingInterval); + } + + // View operation status. + Console.WriteLine($"AnalyzeActions operation has completed"); + Console.WriteLine(); + + Console.WriteLine($"Created On : {operation.CreatedOn}"); + Console.WriteLine($"Expires On : {operation.ExpiresOn}"); + Console.WriteLine($"Id : {operation.Id}"); + Console.WriteLine($"Status : {operation.Status}"); + Console.WriteLine($"Last Modified: {operation.LastModified}"); + Console.WriteLine(); + + // View operation results. + foreach (AnalyzeActionsResult documentsInPage in operation.GetValues()) + { + IReadOnlyCollection classificationResultsCollection = documentsInPage.ClassifyCustomCategoriesResults; + + foreach (ClassifyCustomCategoriesActionResult classificationActionResults in classificationResultsCollection) + { + if (classificationActionResults.HasError) + { + Console.WriteLine($" Error!"); + Console.WriteLine($" Action error code: {classificationActionResults.Error.ErrorCode}."); + Console.WriteLine($" Message: {classificationActionResults.Error.Message}"); + continue; + } + + foreach (ClassifyCustomCategoriesResult documentResults in classificationActionResults.DocumentsResults) + { + if (documentResults.HasError) + { + Console.WriteLine($" Error!"); + Console.WriteLine($" Document error code: {documentResults.Error.ErrorCode}."); + Console.WriteLine($" Message: {documentResults.Error.Message}"); + continue; + } + + if (documentResults.DocumentClassifications.Count > 0) + { + Console.WriteLine($" The following classes were predicted for this document:"); + + foreach (DocumentClassification classification in documentResults.DocumentClassifications) + { + Console.WriteLine($" Class category \"{classification.Category}\" predicted with a confidence score of {classification.ConfidenceScore}."); + } + + Console.WriteLine(); + } + } + } + } + } + } +} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategoriesAsync.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategoriesAsync.cs new file mode 100644 index 000000000000..bf5118c34a29 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategoriesAsync.cs @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure.AI.TextAnalytics.Tests; +using Azure.Core.TestFramework; +using NUnit.Framework; + +namespace Azure.AI.TextAnalytics.Samples +{ + public partial class TextAnalyticsSamples : SamplesBase + { + [Test] + public async Task ClassifyCustomCategoriesAsync() + { + // Create a text analytics client. + string endpoint = TestEnvironment.Endpoint; + string apiKey = TestEnvironment.ApiKey; + string projectName = TestEnvironment.MultiCategoriesProjectName; + string deploymentName = TestEnvironment.MultiCategoriesDeploymentName; + + var client = new TextAnalyticsClient(new Uri(endpoint), new AzureKeyCredential(apiKey)); + + // Get input document. + string document = @"I need a reservation for an indoor restaurant in China. Please don't stop the music. Play music and add it to my playlist."; + + // Prepare analyze operation input. You can add multiple documents to this list and perform the same + // operation to all of them. + var batchDocuments = new List + { + new TextDocumentInput("1", document) + { + Language = "en", + } + }; + + var classifyCustomCategoriesAction = new ClassifyCustomCategoriesAction(projectName, deploymentName); + + TextAnalyticsActions actions = new TextAnalyticsActions() + { + ClassifyCustomCategoriesActions = new List() { classifyCustomCategoriesAction } + }; + + // Start analysis process. + AnalyzeActionsOperation operation = await client.StartAnalyzeActionsAsync(batchDocuments, actions); + + await operation.WaitForCompletionAsync(); + + // View operation status. + Console.WriteLine($"AnalyzeActions operation has completed"); + Console.WriteLine(); + + Console.WriteLine($"Created On : {operation.CreatedOn}"); + Console.WriteLine($"Expires On : {operation.ExpiresOn}"); + Console.WriteLine($"Id : {operation.Id}"); + Console.WriteLine($"Status : {operation.Status}"); + Console.WriteLine($"Last Modified: {operation.LastModified}"); + Console.WriteLine(); + + // View operation results. + await foreach (AnalyzeActionsResult documentsInPage in operation.Value) + { + IReadOnlyCollection classificationResultsCollection = documentsInPage.ClassifyCustomCategoriesResults; + + foreach (ClassifyCustomCategoriesActionResult classificationActionResults in classificationResultsCollection) + { + if (classificationActionResults.HasError) + { + Console.WriteLine($" Error!"); + Console.WriteLine($" Action error code: {classificationActionResults.Error.ErrorCode}."); + Console.WriteLine($" Message: {classificationActionResults.Error.Message}"); + continue; + } + + foreach (ClassifyCustomCategoriesResult documentResults in classificationActionResults.DocumentsResults) + { + if (documentResults.HasError) + { + Console.WriteLine($" Error!"); + Console.WriteLine($" Document error code: {documentResults.Error.ErrorCode}."); + Console.WriteLine($" Message: {documentResults.Error.Message}"); + continue; + } + + if (documentResults.DocumentClassifications.Count > 0) + { + Console.WriteLine($" The following classes were predicted for this document:"); + + foreach (DocumentClassification classification in documentResults.DocumentClassifications) + { + Console.WriteLine($" Class category \"{classification.Category}\" predicted with a confidence score of {classification.ConfidenceScore}."); + } + + Console.WriteLine(); + } + } + } + } + } + } +} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategoriesConvenience.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategoriesConvenience.cs new file mode 100644 index 000000000000..79f9990ea213 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategoriesConvenience.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Threading; +using Azure.AI.TextAnalytics.Tests; +using Azure.Core.TestFramework; +using NUnit.Framework; + +namespace Azure.AI.TextAnalytics.Samples +{ + public partial class TextAnalyticsSamples : SamplesBase + { + [Test] + public void ClassifyCustomCategoriesConvenience() + { + // Create a text analytics client. + string endpoint = TestEnvironment.Endpoint; + string apiKey = TestEnvironment.ApiKey; + string projectName = TestEnvironment.MultiCategoriesProjectName; + string deploymentName = TestEnvironment.MultiCategoriesDeploymentName; + + var client = new TextAnalyticsClient(new Uri(endpoint), new AzureKeyCredential(apiKey)); + + // Get input document. + string document = @"I need a reservation for an indoor restaurant in China. Please don't stop the music. Play music and add it to my playlist."; + + // Prepare analyze operation input. You can add multiple documents to this list and perform the same + // operation to all of them. + var batchInput = new List + { + document + }; + + var classifyCustomCategoriesAction = new ClassifyCustomCategoriesAction(projectName, deploymentName); + + TextAnalyticsActions actions = new TextAnalyticsActions() + { + ClassifyCustomCategoriesActions = new List() { classifyCustomCategoriesAction } + }; + + // Start analysis process. + AnalyzeActionsOperation operation = client.StartAnalyzeActions(batchInput, actions); + + // Wait for completion with manual polling. + TimeSpan pollingInterval = new TimeSpan(1000); + + while (true) + { + Console.WriteLine($"Status: {operation.Status}"); + operation.UpdateStatus(); + if (operation.HasCompleted) + { + break; + } + + Thread.Sleep(pollingInterval); + } + + // View operation status. + Console.WriteLine($"AnalyzeActions operation has completed"); + Console.WriteLine(); + + Console.WriteLine($"Created On : {operation.CreatedOn}"); + Console.WriteLine($"Expires On : {operation.ExpiresOn}"); + Console.WriteLine($"Id : {operation.Id}"); + Console.WriteLine($"Status : {operation.Status}"); + Console.WriteLine($"Last Modified: {operation.LastModified}"); + Console.WriteLine(); + + // View operation results. + foreach (AnalyzeActionsResult documentsInPage in operation.GetValues()) + { + IReadOnlyCollection classificationResultsCollection = documentsInPage.ClassifyCustomCategoriesResults; + + foreach (ClassifyCustomCategoriesActionResult classificationActionResults in classificationResultsCollection) + { + if (classificationActionResults.HasError) + { + Console.WriteLine($" Error!"); + Console.WriteLine($" Action error code: {classificationActionResults.Error.ErrorCode}."); + Console.WriteLine($" Message: {classificationActionResults.Error.Message}"); + continue; + } + + foreach (ClassifyCustomCategoriesResult documentResults in classificationActionResults.DocumentsResults) + { + if (documentResults.HasError) + { + Console.WriteLine($" Error!"); + Console.WriteLine($" Document error code: {documentResults.Error.ErrorCode}."); + Console.WriteLine($" Message: {documentResults.Error.Message}"); + continue; + } + + if (documentResults.DocumentClassifications.Count > 0) + { + Console.WriteLine($" The following classes were predicted for this document:"); + + foreach (DocumentClassification classification in documentResults.DocumentClassifications) + { + Console.WriteLine($" Class category \"{classification.Category}\" predicted with a confidence score of {classification.ConfidenceScore}."); + } + + Console.WriteLine(); + } + } + } + } + } + } +} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategoriesConvenienceAsync.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategoriesConvenienceAsync.cs new file mode 100644 index 000000000000..ad7fa6adc74b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategoriesConvenienceAsync.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure.AI.TextAnalytics.Tests; +using Azure.Core.TestFramework; +using NUnit.Framework; + +namespace Azure.AI.TextAnalytics.Samples +{ + public partial class TextAnalyticsSamples : SamplesBase + { + [Test] + public async Task ClassifyCustomCategoriesConvenienceAsync() + { + // Create a text analytics client. + string endpoint = TestEnvironment.Endpoint; + string apiKey = TestEnvironment.ApiKey; + string projectName = TestEnvironment.MultiCategoriesProjectName; + string deploymentName = TestEnvironment.MultiCategoriesDeploymentName; + + var client = new TextAnalyticsClient(new Uri(endpoint), new AzureKeyCredential(apiKey)); + + #region Snippet:TextAnalyticsClassifyCustomCategoriesAsync + // Get input document. + string document = @"I need a reservation for an indoor restaurant in China. Please don't stop the music. Play music and add it to my playlist."; + + // Prepare analyze operation input. You can add multiple documents to this list and perform the same + // operation to all of them. + var batchInput = new List + { + document + }; + + var classifyCustomCategoriesAction = new ClassifyCustomCategoriesAction(projectName, deploymentName); + + TextAnalyticsActions actions = new TextAnalyticsActions() + { + ClassifyCustomCategoriesActions = new List() { classifyCustomCategoriesAction } + }; + + // Start analysis process. + AnalyzeActionsOperation operation = await client.StartAnalyzeActionsAsync(batchInput, actions); + + await operation.WaitForCompletionAsync(); + #endregion Snippet:TextAnalyticsClassifyCustomCategoriesAsync + + #region Snippet:TextAnalyticsClassifyCustomCategoriesOperationStatus + // View operation status. + Console.WriteLine($"AnalyzeActions operation has completed"); + Console.WriteLine(); + + Console.WriteLine($"Created On : {operation.CreatedOn}"); + Console.WriteLine($"Expires On : {operation.ExpiresOn}"); + Console.WriteLine($"Id : {operation.Id}"); + Console.WriteLine($"Status : {operation.Status}"); + Console.WriteLine($"Last Modified: {operation.LastModified}"); + Console.WriteLine(); + #endregion Snippet:TextAnalyticsClassifyCustomCategoriesOperationStatus + + #region Snippet:TextAnalyticsClassifyCustomCategoriesAsyncViewResults + // View operation results. + await foreach (AnalyzeActionsResult documentsInPage in operation.Value) + { + IReadOnlyCollection classificationResultsCollection = documentsInPage.ClassifyCustomCategoriesResults; + + foreach (ClassifyCustomCategoriesActionResult classificationActionResults in classificationResultsCollection) + { + if (classificationActionResults.HasError) + { + Console.WriteLine($" Error!"); + Console.WriteLine($" Action error code: {classificationActionResults.Error.ErrorCode}."); + Console.WriteLine($" Message: {classificationActionResults.Error.Message}"); + continue; + } + + foreach (ClassifyCustomCategoriesResult documentResults in classificationActionResults.DocumentsResults) + { + if (documentResults.HasError) + { + Console.WriteLine($" Error!"); + Console.WriteLine($" Document error code: {documentResults.Error.ErrorCode}."); + Console.WriteLine($" Message: {documentResults.Error.Message}"); + continue; + } + + if (documentResults.DocumentClassifications.Count > 0) + { + Console.WriteLine($" The following classes were predicted for this document:"); + + foreach (DocumentClassification classification in documentResults.DocumentClassifications) + { + Console.WriteLine($" Class category \"{classification.Category}\" predicted with a confidence score of {classification.ConfidenceScore}."); + } + + Console.WriteLine(); + } + } + } + } + #endregion Snippet:TextAnalyticsClassifyCustomCategoriesAsyncViewResults + } + } +} From 2cf558305fff2643c54bcfacbf6702c0678b8ee7 Mon Sep 17 00:00:00 2001 From: Ahmed Leithy Date: Thu, 23 Sep 2021 12:15:42 +0200 Subject: [PATCH 08/22] Updated ChangeLog --- sdk/textanalytics/Azure.AI.TextAnalytics/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/CHANGELOG.md b/sdk/textanalytics/Azure.AI.TextAnalytics/CHANGELOG.md index d8abb1eb35db..5653e521572d 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/CHANGELOG.md +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/CHANGELOG.md @@ -5,6 +5,8 @@ ### Features Added - Added property `SingleCategoryClassifyAction` to `TextAnalyticsActions` to support the new 'Custom Single Classification' API. This action can be used to get a custom classification for an input document or batch of documents. +- Added property `ClassifyCustomCategoriesAction` to `TextAnalyticsActions` to support the new 'Custom Multiple Classification' API. This action can be used to get multiple custom classifications for an input document or batch of documents. + ### Breaking Changes ### Bugs Fixed From 66d99e2e3e997f8164e9e7910a4cd9bb42048282 Mon Sep 17 00:00:00 2001 From: Ahmed Leithy Date: Thu, 23 Sep 2021 12:45:50 +0200 Subject: [PATCH 09/22] Added AnalyzeOperationMock Tests + Adjusted AnalyzeOperationTest --- .../Azure.AI.TextAnalytics/src/Transforms.cs | 2 +- .../tests/AnalyzeOperationMockTests.cs | 85 ++++++++++++++++++- .../tests/AnalyzeOperationTests.cs | 2 + 3 files changed, 87 insertions(+), 2 deletions(-) diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Transforms.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Transforms.cs index 520c12a78ec9..5b29aaf43a59 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Transforms.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Transforms.cs @@ -617,7 +617,7 @@ private static string[] parseActionErrorTarget(string targetReference) { throw new InvalidOperationException("Expected an error with a target field referencing an action but did not get one"); } - Regex _targetRegex = new Regex("#/tasks/(keyPhraseExtractionTasks|entityRecognitionPiiTasks|entityRecognitionTasks|entityLinkingTasks|sentimentAnalysisTasks|extractiveSummarizationTasks|customSingleClassificationTasks)/(\\d+)", RegexOptions.Compiled, TimeSpan.FromSeconds(2)); + Regex _targetRegex = new Regex("#/tasks/(keyPhraseExtractionTasks|entityRecognitionPiiTasks|entityRecognitionTasks|entityLinkingTasks|sentimentAnalysisTasks|extractiveSummarizationTasks|customSingleClassificationTasks|customMultiClassificationTasks)/(\\d+)", RegexOptions.Compiled, TimeSpan.FromSeconds(2)); // action could be failed and the target reference is "#/tasks/keyPhraseExtractionTasks/0"; Match targetMatch = _targetRegex.Match(targetReference); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/AnalyzeOperationMockTests.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/AnalyzeOperationMockTests.cs index 8f50e33d4277..4bcc32145d4f 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/AnalyzeOperationMockTests.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/AnalyzeOperationMockTests.cs @@ -776,6 +776,72 @@ public void AnalyzeOperationExtractSummaryWithTwoActions() #endregion Extract summary + #region Classify Custom Categories + + [Test] + public async Task AnalyzeOperationClassifyCustomCategoriesWithDisableServiceLogs() + { + var mockResponse = new MockResponse(202); + mockResponse.AddHeader(new HttpHeader("Operation-Location", "something/jobs/2a96a91f-7edf-4931-a880-3fdee1d56f15")); + + var mockTransport = new MockTransport(new[] { mockResponse, mockResponse }); + var client = CreateTestClient(mockTransport); + + var documents = new List + { + "Elon Musk is the CEO of SpaceX and Tesla." + }; + + var actions = new ClassifyCustomCategoriesAction(FakeProjectName, FakeDeploymentName) + { + DisableServiceLogs = true + }; + + TextAnalyticsActions batchActions = new TextAnalyticsActions() + { + ClassifyCustomCategoriesActions = new List() { actions }, + }; + + await client.StartAnalyzeActionsAsync(documents, batchActions); + + var contentString = GetString(mockTransport.Requests.Single().Content); + string logging = contentString.Substring(contentString.IndexOf("loggingOptOut"), 19); + + var expectedContent = "loggingOptOut\":true"; + Assert.AreEqual(expectedContent, logging); + } + + [Test] + public void AnalyzeOperationClassifyCustomCategoryWithTwoActions() + { + var mockResponse = new MockResponse(202); + mockResponse.AddHeader(new HttpHeader("Operation-Location", "something/jobs/2a96a91f-7edf-4931-a880-3fdee1d56f15")); + + var mockTransport = new MockTransport(new[] { mockResponse, mockResponse }); + var client = CreateTestClient(mockTransport); + + var documents = new List + { + "Elon Musk is the CEO of SpaceX and Tesla." + }; + + TextAnalyticsActions batchActions = new() + { + ClassifyCustomCategoriesActions = new List() + { + new ClassifyCustomCategoriesAction(FakeProjectName, FakeDeploymentName), + new ClassifyCustomCategoriesAction(FakeProjectName, FakeDeploymentName) + { + DisableServiceLogs = true + } + }, + }; + + ArgumentException ex = Assert.ThrowsAsync(async () => await client.StartAnalyzeActionsAsync(documents, batchActions)); + Assert.AreEqual("Multiple of the same action is not currently supported.", ex.Message); + } + #endregion + #region Single Category Classify [Test] @@ -888,6 +954,11 @@ public async Task AnalyzeOperationWithActionsError() ""code"": ""InvalidRequest"", ""message"": ""Some error"", ""target"": ""#/tasks/customSingleClassificationTasks/0"" + }, + { + ""code"": ""InvalidRequest"", + ""message"": ""Some error"", + ""target"": ""#/tasks/customMultiClassificationTasks/0"" } ], ""tasks"": { @@ -941,7 +1012,14 @@ public async Task AnalyzeOperationWithActionsError() ""state"": ""failed"" } ], - ""customSingleClassificationTasks"": [ + ""customSingleClassificationTasks"": [ + { + ""lastUpdateDateTime"": ""2021-03-03T22:39:37.1716697Z"", + ""taskName"": ""something"", + ""state"": ""failed"" + } + ], + ""customMultiClassificationTasks"": [ { ""lastUpdateDateTime"": ""2021-03-03T22:39:37.1716697Z"", ""taskName"": ""something"", @@ -971,6 +1049,7 @@ public async Task AnalyzeOperationWithActionsError() AnalyzeSentimentActions = new List() { new AnalyzeSentimentAction() }, ExtractSummaryActions = new List() { new ExtractSummaryAction() }, SingleCategoryClassifyActions = new List { new SingleCategoryClassifyAction(FakeProjectName, FakeDeploymentName)}, + ClassifyCustomCategoriesActions = new List() { new ClassifyCustomCategoriesAction(FakeProjectName, FakeDeploymentName) }, DisplayName = "AnalyzeOperationBatchWithErrorTest" }; @@ -992,6 +1071,7 @@ public async Task AnalyzeOperationWithActionsError() AnalyzeSentimentActionResult analyzeSentimentActionsResults = resultCollection.AnalyzeSentimentResults.FirstOrDefault(); ExtractSummaryActionResult extractSummaryActionsResults = resultCollection.ExtractSummaryResults.FirstOrDefault(); SingleCategoryClassifyActionResult singleCategoryClassifyActionResult = resultCollection.SingleCategoryClassifyResults.FirstOrDefault(); + ClassifyCustomCategoriesActionResult classifyCustomCategoriesActionResult = resultCollection.ClassifyCustomCategoriesResults.FirstOrDefault(); Assert.IsTrue(entitiesActionsResults.HasError); Assert.Throws(() => entitiesActionsResults.DocumentsResults.GetType()); @@ -1013,6 +1093,9 @@ public async Task AnalyzeOperationWithActionsError() Assert.IsTrue(singleCategoryClassifyActionResult.HasError); Assert.Throws(() => singleCategoryClassifyActionResult.DocumentsResults.GetType()); + + Assert.IsTrue(classifyCustomCategoriesActionResult.HasError); + Assert.Throws(() => classifyCustomCategoriesActionResult.DocumentsResults.GetType()); } [Test] diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/AnalyzeOperationTests.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/AnalyzeOperationTests.cs index 39c7a721e43d..134a0e9dc6b2 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/AnalyzeOperationTests.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/AnalyzeOperationTests.cs @@ -84,6 +84,7 @@ public async Task AnalyzeOperationTest() IReadOnlyCollection analyzeSentimentActionsResults = resultCollection.AnalyzeSentimentResults; IReadOnlyCollection extractSummaryActionsResults = resultCollection.ExtractSummaryResults; IReadOnlyCollection singleCategoryClassifyResults = resultCollection.SingleCategoryClassifyResults; + IReadOnlyCollection classifyCustomCategoriesResults = resultCollection.ClassifyCustomCategoriesResults; Assert.IsNotNull(keyPhrasesActionsResults); Assert.IsNotNull(entitiesActionsResults); @@ -92,6 +93,7 @@ public async Task AnalyzeOperationTest() Assert.IsNotNull(analyzeSentimentActionsResults); Assert.IsNotNull(extractSummaryActionsResults); Assert.IsNotNull(singleCategoryClassifyResults); + Assert.IsNotNull(classifyCustomCategoriesResults); var keyPhrasesListId1 = new List { "CEO", "SpaceX", "Elon Musk", "Tesla" }; var keyPhrasesListId2 = new List { "Tesla stock" }; From 0926b8e4ec73243e732e0cc9910962e468cac4e8 Mon Sep 17 00:00:00 2001 From: Ahmed Leithy Date: Thu, 23 Sep 2021 13:15:33 +0200 Subject: [PATCH 10/22] Added Tests --- .../tests/ClassifyCustomCategoriesTests.cs | 266 ++++++++++++++++++ 1 file changed, 266 insertions(+) create mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/tests/ClassifyCustomCategoriesTests.cs diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/ClassifyCustomCategoriesTests.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/ClassifyCustomCategoriesTests.cs new file mode 100644 index 000000000000..393dc182b43d --- /dev/null +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/ClassifyCustomCategoriesTests.cs @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Azure.Core.TestFramework; +using NUnit.Framework; + +namespace Azure.AI.TextAnalytics.Tests +{ + [ServiceVersion(Min = TextAnalyticsClientOptions.ServiceVersion.V3_2_Preview_2)] + public class ClassifyCustomCategoriesTests : TextAnalyticsClientLiveTestBase + { + public ClassifyCustomCategoriesTests(bool isAsync, TextAnalyticsClientOptions.ServiceVersion serviceVersion) + : base(isAsync, serviceVersion) + { + } + + private const string ClassifyCustomCategoriesDocument1 = + "I need a reservation for an indoor restaurant in China. Please don't stop the music. Play music and add it to my playlist"; + + private const string ClassifyCustomCategoriesDocument2 = + "David Schmidt, senior vice president--Food Safety, International Food Information Council (IFIC), Washington, D.C., discussed the physical activity component."; + + private static readonly List s_classifyCustomCategoriesBatchConvenienceDocuments = new List + { + ClassifyCustomCategoriesDocument1, + ClassifyCustomCategoriesDocument2 + }; + + private static List s_classifyCustomCategoriesBatchDocuments = new List + { + new TextDocumentInput("1", ClassifyCustomCategoriesDocument1) + { + Language = "en", + }, + new TextDocumentInput("2", ClassifyCustomCategoriesDocument2) + { + Language = "en", + } + }; + + [RecordedTest] + public async Task ClassifyCustomCategoriesWithDisableServiceLogs() + { + TextAnalyticsClient client = GetClient(); + + TextAnalyticsActions batchActions = new TextAnalyticsActions() + { + ClassifyCustomCategoriesActions = new List() { new ClassifyCustomCategoriesAction(TestEnvironment.MultiCategoriesProjectName, TestEnvironment.MultiCategoriesDeploymentName) { DisableServiceLogs = true } } + }; + + AnalyzeActionsOperation operation = await client.StartAnalyzeActionsAsync(s_classifyCustomCategoriesBatchConvenienceDocuments, batchActions); + + await operation.WaitForCompletionAsync(); + + // Take the first page + AnalyzeActionsResult resultCollection = operation.Value.ToEnumerableAsync().Result.FirstOrDefault(); + + IReadOnlyCollection classifyCustomCategoriesActionsResults = resultCollection.ClassifyCustomCategoriesResults; + + Assert.IsNotNull(classifyCustomCategoriesActionsResults); + Assert.AreEqual(2, classifyCustomCategoriesActionsResults.FirstOrDefault().DocumentsResults.Count); + } + + [RecordedTest] + public async Task ClassifyCustomCategoriesBatchWithErrorTest() + { + TextAnalyticsClient client = GetClient(); + + var documents = new List + { + "Subject is taking 100mg of ibuprofen twice daily", + "", + }; + TextAnalyticsActions batchActions = new TextAnalyticsActions() + { + ClassifyCustomCategoriesActions = new List() + { + new ClassifyCustomCategoriesAction(TestEnvironment.MultiCategoriesProjectName, TestEnvironment.MultiCategoriesDeploymentName) + } + }; + + AnalyzeActionsOperation operation = await client.StartAnalyzeActionsAsync(documents, batchActions, "en"); + await operation.WaitForCompletionAsync(); + + // Take the first page + AnalyzeActionsResult resultCollection = operation.Value.ToEnumerableAsync().Result.FirstOrDefault(); + + List classifyCustomCategoriesActions = resultCollection.ClassifyCustomCategoriesResults.ToList(); + + Assert.AreEqual(1, classifyCustomCategoriesActions.Count); + + ClassifyCustomCategoriesResultCollection documentsResults = classifyCustomCategoriesActions[0].DocumentsResults; + Assert.IsFalse(documentsResults[0].HasError); + Assert.IsTrue(documentsResults[1].HasError); + Assert.AreEqual(TextAnalyticsErrorCode.InvalidDocument, documentsResults[1].Error.ErrorCode.ToString()); + } + + [RecordedTest] + public async Task ClassifyCustomCategoriesBatchConvenienceTest() + { + TextAnalyticsClient client = GetClient(); + + TextAnalyticsActions batchActions = new TextAnalyticsActions() + { + ClassifyCustomCategoriesActions = new List() + { + new ClassifyCustomCategoriesAction(TestEnvironment.MultiCategoriesProjectName, TestEnvironment.MultiCategoriesDeploymentName) + } + }; + + AnalyzeActionsOperation operation = await client.StartAnalyzeActionsAsync(s_classifyCustomCategoriesBatchConvenienceDocuments, batchActions); + + await operation.WaitForCompletionAsync(); + + // Take the first page + AnalyzeActionsResult resultCollection = operation.Value.ToEnumerableAsync().Result.FirstOrDefault(); + + IReadOnlyCollection classifyCustomCategoriesActionsResults = resultCollection.ClassifyCustomCategoriesResults; + ClassifyCustomCategoriesResultCollection classifyCustomCategoriesResults = classifyCustomCategoriesActionsResults.FirstOrDefault().DocumentsResults; + + ValidateSummaryBatchResult(classifyCustomCategoriesResults); + } + + [RecordedTest] + public async Task ClassifyCustomCategoriesBatchConvenienceWithStatisticsTest() + { + TextAnalyticsClient client = GetClient(); + + TextAnalyticsActions batchActions = new TextAnalyticsActions() + { + ClassifyCustomCategoriesActions = new List() + { + new ClassifyCustomCategoriesAction(TestEnvironment.MultiCategoriesProjectName, TestEnvironment.MultiCategoriesDeploymentName) + } + }; + + AnalyzeActionsOptions options = new AnalyzeActionsOptions() + { + IncludeStatistics = true + }; + + AnalyzeActionsOperation operation = await client.StartAnalyzeActionsAsync(s_classifyCustomCategoriesBatchConvenienceDocuments, batchActions, "en", options); + + await operation.WaitForCompletionAsync(); + + // Take the first page + AnalyzeActionsResult resultCollection = operation.Value.ToEnumerableAsync().Result.FirstOrDefault(); + + IReadOnlyCollection classifyCustomCategoriesActionsResults = resultCollection.ClassifyCustomCategoriesResults; + ClassifyCustomCategoriesResultCollection classifyCustomCategoriesResults = classifyCustomCategoriesActionsResults.FirstOrDefault().DocumentsResults; + + ValidateSummaryBatchResult(classifyCustomCategoriesResults, includeStatistics: true); + } + + [RecordedTest] + public async Task ClassifyCustomCategoriesBatchTest() + { + TextAnalyticsClient client = GetClient(); + + TextAnalyticsActions batchActions = new TextAnalyticsActions() + { + ClassifyCustomCategoriesActions = new List() + { + new ClassifyCustomCategoriesAction(TestEnvironment.MultiCategoriesProjectName, TestEnvironment.MultiCategoriesDeploymentName) + } + }; + + AnalyzeActionsOperation operation = await client.StartAnalyzeActionsAsync(s_classifyCustomCategoriesBatchDocuments, batchActions); + + await operation.WaitForCompletionAsync(); + + // Take the first page + AnalyzeActionsResult resultCollection = operation.Value.ToEnumerableAsync().Result.FirstOrDefault(); + + IReadOnlyCollection classifyCustomCategoriesActionsResults = resultCollection.ClassifyCustomCategoriesResults; + ClassifyCustomCategoriesResultCollection classifyCustomCategoriesResults = classifyCustomCategoriesActionsResults.FirstOrDefault().DocumentsResults; + + ValidateSummaryBatchResult(classifyCustomCategoriesResults); + } + + [RecordedTest] + public async Task ClassifyCustomCategoriesBatchWithStatisticsTest() + { + TextAnalyticsClient client = GetClient(); + + TextAnalyticsActions batchActions = new TextAnalyticsActions() + { + ClassifyCustomCategoriesActions = new List() + { + new ClassifyCustomCategoriesAction(TestEnvironment.MultiCategoriesProjectName, TestEnvironment.MultiCategoriesDeploymentName) + } + }; + + AnalyzeActionsOptions options = new AnalyzeActionsOptions() + { + IncludeStatistics = true + }; + + AnalyzeActionsOperation operation = await client.StartAnalyzeActionsAsync(s_classifyCustomCategoriesBatchDocuments, batchActions, options); + + await operation.WaitForCompletionAsync(); + + // Take the first page + AnalyzeActionsResult resultCollection = operation.Value.ToEnumerableAsync().Result.FirstOrDefault(); + + IReadOnlyCollection classifyCustomCategoriesActionsResults = resultCollection.ClassifyCustomCategoriesResults; + ClassifyCustomCategoriesResultCollection classifyCustomCategoriesResults = classifyCustomCategoriesActionsResults.FirstOrDefault().DocumentsResults; + + ValidateSummaryBatchResult(classifyCustomCategoriesResults, includeStatistics: true); + } + + private void ValidateSummaryDocumentResult(DocumentClassificationCollection classificationCollection) + { + Assert.IsNotNull(classificationCollection.Warnings); + + foreach (var classification in classificationCollection) + { + Assert.GreaterOrEqual(classification.ConfidenceScore, 0); + Assert.LessOrEqual(classification.ConfidenceScore, 1); + Assert.NotNull(classification.Category); + } + } + + private void ValidateSummaryBatchResult(ClassifyCustomCategoriesResultCollection results, bool includeStatistics = false) + { + Assert.AreEqual(results.ProjectName, TestEnvironment.MultiCategoriesProjectName); + Assert.AreEqual(results.DeploymentName, TestEnvironment.MultiCategoriesDeploymentName); + + if (includeStatistics) + { + Assert.IsNotNull(results.Statistics); + Assert.Greater(results.Statistics.DocumentCount, 0); + Assert.Greater(results.Statistics.TransactionCount, 0); + Assert.GreaterOrEqual(results.Statistics.InvalidDocumentCount, 0); + Assert.GreaterOrEqual(results.Statistics.ValidDocumentCount, 0); + } + else + { + Assert.IsNull(results.Statistics); + } + + foreach (ClassifyCustomCategoriesResult result in results) + { + Assert.That(result.Id, Is.Not.Null.And.Not.Empty); + Assert.False(result.HasError); + Assert.IsNotNull(result.Warnings); + + if (includeStatistics) + { + Assert.GreaterOrEqual(result.Statistics.CharacterCount, 0); + Assert.Greater(result.Statistics.TransactionCount, 0); + } + else + { + Assert.AreEqual(0, result.Statistics.CharacterCount); + Assert.AreEqual(0, result.Statistics.TransactionCount); + } + + ValidateSummaryDocumentResult(result.DocumentClassifications); + } + } + } +} From 9dbcfc4146406f2d701d0b93165cce944a7f9753 Mon Sep 17 00:00:00 2001 From: Ahmed Leithy Date: Thu, 23 Sep 2021 13:22:47 +0200 Subject: [PATCH 11/22] Added Test Recordings --- ...yCustomCategoriesBatchConvenienceTest.json | 162 ++++++++++++++++ ...omCategoriesBatchConvenienceTestAsync.json | 162 ++++++++++++++++ ...iesBatchConvenienceWithStatisticsTest.json | 176 ++++++++++++++++++ ...tchConvenienceWithStatisticsTestAsync.json | 176 ++++++++++++++++++ .../ClassifyCustomCategoriesBatchTest.json | 162 ++++++++++++++++ ...lassifyCustomCategoriesBatchTestAsync.json | 162 ++++++++++++++++ ...ifyCustomCategoriesBatchWithErrorTest.json | 164 ++++++++++++++++ ...stomCategoriesBatchWithErrorTestAsync.json | 164 ++++++++++++++++ ...stomCategoriesBatchWithStatisticsTest.json | 176 ++++++++++++++++++ ...ategoriesBatchWithStatisticsTestAsync.json | 176 ++++++++++++++++++ ...ustomCategoriesWithDisableServiceLogs.json | 163 ++++++++++++++++ ...CategoriesWithDisableServiceLogsAsync.json | 163 ++++++++++++++++ 12 files changed, 2006 insertions(+) create mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceTest.json create mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceTestAsync.json create mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceWithStatisticsTest.json create mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceWithStatisticsTestAsync.json create mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchTest.json create mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchTestAsync.json create mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithErrorTest.json create mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithErrorTestAsync.json create mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithStatisticsTest.json create mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithStatisticsTestAsync.json create mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesWithDisableServiceLogs.json create mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesWithDisableServiceLogsAsync.json diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceTest.json b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceTest.json new file mode 100644 index 000000000000..535930950f14 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceTest.json @@ -0,0 +1,162 @@ +{ + "Entries": [ + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Content-Length": "564", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-f112de12dc92cb4ab9c8dec7c08e57b5-710f5a0e7e980e47-00", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "8f6f8a55883a7457986c0480f2d6e14e", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "analysisInput": { + "documents": [ + { + "id": "0", + "text": "I need a reservation for an indoor restaurant in China. Please don\u0027t stop the music. Play music and add it to my playlist", + "language": "en" + }, + { + "id": "1", + "text": "David Schmidt, senior vice president--Food Safety, International Food Information Council (IFIC), Washington, D.C., discussed the physical activity component.", + "language": "en" + } + ] + }, + "tasks": { + "customMultiClassificationTasks": [ + { + "parameters": { + "project-name": "7cdace98-537b-494a-b69a-c19754718025", + "deployment-name": "7cdace98-537b-494a-b69a-c19754718025" + } + } + ] + } + }, + "StatusCode": 202, + "ResponseHeaders": { + "apim-request-id": "7f7b56a5-f86c-44f4-983f-1fb2ceb75c3c", + "Date": "Thu, 23 Sep 2021 11:20:34 GMT", + "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/b2c1e7af-6698-4357-8e14-5fabbba5501f", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "169" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/b2c1e7af-6698-4357-8e14-5fabbba5501f", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "0197d076524904e36ebb2ecd0fe85877", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "a358ddf3-481a-473a-a7bb-cbe420099d61", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 23 Sep 2021 11:20:36 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "8" + }, + "ResponseBody": { + "jobId": "b2c1e7af-6698-4357-8e14-5fabbba5501f", + "lastUpdateDateTime": "2021-09-23T11:20:35Z", + "createdDateTime": "2021-09-23T11:20:35Z", + "expirationDateTime": "2021-09-24T11:20:35Z", + "status": "notStarted", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 0, + "failed": 0, + "inProgress": 1, + "total": 1 + } + } + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/b2c1e7af-6698-4357-8e14-5fabbba5501f", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "82a65baaf78c925bb637ab8d4021698a", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "425f7f5a-6e6a-497a-ba85-275c076893e6", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 23 Sep 2021 11:20:37 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "71" + }, + "ResponseBody": { + "jobId": "b2c1e7af-6698-4357-8e14-5fabbba5501f", + "lastUpdateDateTime": "2021-09-23T11:20:36Z", + "createdDateTime": "2021-09-23T11:20:35Z", + "expirationDateTime": "2021-09-24T11:20:35Z", + "status": "succeeded", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 1, + "failed": 0, + "inProgress": 0, + "total": 1, + "customMultiClassificationTasks": [ + { + "lastUpdateDateTime": "2021-09-23T11:20:36.5283021Z", + "state": "succeeded", + "results": { + "documents": [ + { + "id": "0", + "classifications": [ + { + "category": "BookRestaurant", + "confidenceScore": 0.97 + } + ], + "warnings": [] + }, + { + "id": "1", + "classifications": [], + "warnings": [] + } + ], + "errors": [], + "projectName": "7cdace98-537b-494a-b69a-c19754718025", + "deploymentName": "7cdace98-537b-494a-b69a-c19754718025" + } + } + ] + } + } + } + ], + "Variables": { + "RandomSeed": "199054673", + "TEXT_ANALYTICS_API_KEY": "Sanitized", + "TEXT_ANALYTICS_ENDPOINT": "https://cognitiveweppe.azure-api.net" + } +} \ No newline at end of file diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceTestAsync.json b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceTestAsync.json new file mode 100644 index 000000000000..9822999964c5 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceTestAsync.json @@ -0,0 +1,162 @@ +{ + "Entries": [ + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Content-Length": "564", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-ad31ffbf0e361643ae22f8e7e44b29d1-801b629e5e44524f-00", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "0ddc88a07756fef0bc14cf4b9b6ebc78", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "analysisInput": { + "documents": [ + { + "id": "0", + "text": "I need a reservation for an indoor restaurant in China. Please don\u0027t stop the music. Play music and add it to my playlist", + "language": "en" + }, + { + "id": "1", + "text": "David Schmidt, senior vice president--Food Safety, International Food Information Council (IFIC), Washington, D.C., discussed the physical activity component.", + "language": "en" + } + ] + }, + "tasks": { + "customMultiClassificationTasks": [ + { + "parameters": { + "project-name": "7cdace98-537b-494a-b69a-c19754718025", + "deployment-name": "7cdace98-537b-494a-b69a-c19754718025" + } + } + ] + } + }, + "StatusCode": 202, + "ResponseHeaders": { + "apim-request-id": "a03b1ecd-5282-435c-b992-4f9e91a6ed90", + "Date": "Thu, 23 Sep 2021 11:20:38 GMT", + "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/6dc152d1-b31b-49be-81ae-6ef3dc7c6742", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "225" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/6dc152d1-b31b-49be-81ae-6ef3dc7c6742", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "521fd6a6b5fc70fa268cfca6cde8683e", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "4330a4ff-528f-42c2-abe1-6de399a37e12", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 23 Sep 2021 11:20:38 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "6" + }, + "ResponseBody": { + "jobId": "6dc152d1-b31b-49be-81ae-6ef3dc7c6742", + "lastUpdateDateTime": "2021-09-23T11:20:38Z", + "createdDateTime": "2021-09-23T11:20:38Z", + "expirationDateTime": "2021-09-24T11:20:38Z", + "status": "notStarted", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 0, + "failed": 0, + "inProgress": 1, + "total": 1 + } + } + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/6dc152d1-b31b-49be-81ae-6ef3dc7c6742", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "4200402e3b3f954fda62759441954f7b", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "0202d370-94f3-49ed-bd26-6c42dddc022f", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 23 Sep 2021 11:20:39 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "78" + }, + "ResponseBody": { + "jobId": "6dc152d1-b31b-49be-81ae-6ef3dc7c6742", + "lastUpdateDateTime": "2021-09-23T11:20:39Z", + "createdDateTime": "2021-09-23T11:20:38Z", + "expirationDateTime": "2021-09-24T11:20:38Z", + "status": "succeeded", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 1, + "failed": 0, + "inProgress": 0, + "total": 1, + "customMultiClassificationTasks": [ + { + "lastUpdateDateTime": "2021-09-23T11:20:39.0944392Z", + "state": "succeeded", + "results": { + "documents": [ + { + "id": "0", + "classifications": [ + { + "category": "BookRestaurant", + "confidenceScore": 0.97 + } + ], + "warnings": [] + }, + { + "id": "1", + "classifications": [], + "warnings": [] + } + ], + "errors": [], + "projectName": "7cdace98-537b-494a-b69a-c19754718025", + "deploymentName": "7cdace98-537b-494a-b69a-c19754718025" + } + } + ] + } + } + } + ], + "Variables": { + "RandomSeed": "2124148127", + "TEXT_ANALYTICS_API_KEY": "Sanitized", + "TEXT_ANALYTICS_ENDPOINT": "https://cognitiveweppe.azure-api.net" + } +} \ No newline at end of file diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceWithStatisticsTest.json b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceWithStatisticsTest.json new file mode 100644 index 000000000000..88ad1f178fb8 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceWithStatisticsTest.json @@ -0,0 +1,176 @@ +{ + "Entries": [ + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Content-Length": "564", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-216a29552ed28c46b851957907f45c84-a846734f3babea40-00", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "99d32beb69c3b9825f9686a079fba41b", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "analysisInput": { + "documents": [ + { + "id": "0", + "text": "I need a reservation for an indoor restaurant in China. Please don\u0027t stop the music. Play music and add it to my playlist", + "language": "en" + }, + { + "id": "1", + "text": "David Schmidt, senior vice president--Food Safety, International Food Information Council (IFIC), Washington, D.C., discussed the physical activity component.", + "language": "en" + } + ] + }, + "tasks": { + "customMultiClassificationTasks": [ + { + "parameters": { + "project-name": "7cdace98-537b-494a-b69a-c19754718025", + "deployment-name": "7cdace98-537b-494a-b69a-c19754718025" + } + } + ] + } + }, + "StatusCode": 202, + "ResponseHeaders": { + "apim-request-id": "061b2964-6fd9-4cd9-8c99-3d77a79ab680", + "Date": "Thu, 23 Sep 2021 11:20:56 GMT", + "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/6d793c30-e79c-4f06-b75b-c94aaeb51f4c", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "210" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/6d793c30-e79c-4f06-b75b-c94aaeb51f4c?showStats=true", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "188861fb3d232c31c87810b60bc0b006", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "8eb987bf-ce92-42d9-a0a0-e8efb0a9fadd", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 23 Sep 2021 11:20:56 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "7" + }, + "ResponseBody": { + "jobId": "6d793c30-e79c-4f06-b75b-c94aaeb51f4c", + "lastUpdateDateTime": "2021-09-23T11:20:56Z", + "createdDateTime": "2021-09-23T11:20:56Z", + "expirationDateTime": "2021-09-24T11:20:56Z", + "status": "notStarted", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 0, + "failed": 0, + "inProgress": 1, + "total": 1 + } + } + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/6d793c30-e79c-4f06-b75b-c94aaeb51f4c?showStats=true", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "f4d09f0ac3b510dce0ac980580450cf0", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "e06b993c-9ba2-4cf0-ad80-78b40428e564", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 23 Sep 2021 11:20:58 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "66" + }, + "ResponseBody": { + "jobId": "6d793c30-e79c-4f06-b75b-c94aaeb51f4c", + "lastUpdateDateTime": "2021-09-23T11:20:57Z", + "createdDateTime": "2021-09-23T11:20:56Z", + "expirationDateTime": "2021-09-24T11:20:56Z", + "status": "succeeded", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 1, + "failed": 0, + "inProgress": 0, + "total": 1, + "customMultiClassificationTasks": [ + { + "lastUpdateDateTime": "2021-09-23T11:20:57.6945278Z", + "state": "succeeded", + "results": { + "statistics": { + "documentsCount": 2, + "validDocumentsCount": 2, + "erroneousDocumentsCount": 0, + "transactionsCount": 2 + }, + "documents": [ + { + "id": "0", + "classifications": [ + { + "category": "BookRestaurant", + "confidenceScore": 0.97 + } + ], + "statistics": { + "charactersCount": 121, + "transactionsCount": 1 + }, + "warnings": [] + }, + { + "id": "1", + "classifications": [], + "statistics": { + "charactersCount": 158, + "transactionsCount": 1 + }, + "warnings": [] + } + ], + "errors": [], + "projectName": "7cdace98-537b-494a-b69a-c19754718025", + "deploymentName": "7cdace98-537b-494a-b69a-c19754718025" + } + } + ] + } + } + } + ], + "Variables": { + "RandomSeed": "1653911505", + "TEXT_ANALYTICS_API_KEY": "Sanitized", + "TEXT_ANALYTICS_ENDPOINT": "https://cognitiveweppe.azure-api.net" + } +} \ No newline at end of file diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceWithStatisticsTestAsync.json b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceWithStatisticsTestAsync.json new file mode 100644 index 000000000000..437e524df829 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceWithStatisticsTestAsync.json @@ -0,0 +1,176 @@ +{ + "Entries": [ + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Content-Length": "564", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-b0c3b1b118c6d9438ced80fbe5515af6-714f1e0d1e2cda44-00", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "a0c0f2ee56754e2a26d7f628c9643a49", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "analysisInput": { + "documents": [ + { + "id": "0", + "text": "I need a reservation for an indoor restaurant in China. Please don\u0027t stop the music. Play music and add it to my playlist", + "language": "en" + }, + { + "id": "1", + "text": "David Schmidt, senior vice president--Food Safety, International Food Information Council (IFIC), Washington, D.C., discussed the physical activity component.", + "language": "en" + } + ] + }, + "tasks": { + "customMultiClassificationTasks": [ + { + "parameters": { + "project-name": "7cdace98-537b-494a-b69a-c19754718025", + "deployment-name": "7cdace98-537b-494a-b69a-c19754718025" + } + } + ] + } + }, + "StatusCode": 202, + "ResponseHeaders": { + "apim-request-id": "7f367e93-1986-4732-8311-75544eab6d73", + "Date": "Thu, 23 Sep 2021 11:20:59 GMT", + "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/b24330e1-1a6e-469f-a9f7-5d44bcd64106", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "165" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/b24330e1-1a6e-469f-a9f7-5d44bcd64106?showStats=true", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "6b6fa979d71d14af41eb863d3ecd3152", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "7dad27fe-a855-4d87-94dd-1a66d1e39003", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 23 Sep 2021 11:20:59 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "7" + }, + "ResponseBody": { + "jobId": "b24330e1-1a6e-469f-a9f7-5d44bcd64106", + "lastUpdateDateTime": "2021-09-23T11:20:59Z", + "createdDateTime": "2021-09-23T11:20:59Z", + "expirationDateTime": "2021-09-24T11:20:59Z", + "status": "notStarted", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 0, + "failed": 0, + "inProgress": 1, + "total": 1 + } + } + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/b24330e1-1a6e-469f-a9f7-5d44bcd64106?showStats=true", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "250107a830b633cfe1435fe579f14b6b", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "26fc17b0-e90b-424c-b70c-0ff9d9d19477", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 23 Sep 2021 11:21:00 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "75" + }, + "ResponseBody": { + "jobId": "b24330e1-1a6e-469f-a9f7-5d44bcd64106", + "lastUpdateDateTime": "2021-09-23T11:21:00Z", + "createdDateTime": "2021-09-23T11:20:59Z", + "expirationDateTime": "2021-09-24T11:20:59Z", + "status": "succeeded", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 1, + "failed": 0, + "inProgress": 0, + "total": 1, + "customMultiClassificationTasks": [ + { + "lastUpdateDateTime": "2021-09-23T11:21:00.7248412Z", + "state": "succeeded", + "results": { + "statistics": { + "documentsCount": 2, + "validDocumentsCount": 2, + "erroneousDocumentsCount": 0, + "transactionsCount": 2 + }, + "documents": [ + { + "id": "0", + "classifications": [ + { + "category": "BookRestaurant", + "confidenceScore": 0.97 + } + ], + "statistics": { + "charactersCount": 121, + "transactionsCount": 1 + }, + "warnings": [] + }, + { + "id": "1", + "classifications": [], + "statistics": { + "charactersCount": 158, + "transactionsCount": 1 + }, + "warnings": [] + } + ], + "errors": [], + "projectName": "7cdace98-537b-494a-b69a-c19754718025", + "deploymentName": "7cdace98-537b-494a-b69a-c19754718025" + } + } + ] + } + } + } + ], + "Variables": { + "RandomSeed": "712696846", + "TEXT_ANALYTICS_API_KEY": "Sanitized", + "TEXT_ANALYTICS_ENDPOINT": "https://cognitiveweppe.azure-api.net" + } +} \ No newline at end of file diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchTest.json b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchTest.json new file mode 100644 index 000000000000..e2e75c9a5223 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchTest.json @@ -0,0 +1,162 @@ +{ + "Entries": [ + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Content-Length": "564", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-4a64f91f623c7944b1d4d7ca38df2701-f9365667eef54343-00", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "467af06cabdf151393fc8b0b70c44cc6", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "analysisInput": { + "documents": [ + { + "id": "1", + "text": "I need a reservation for an indoor restaurant in China. Please don\u0027t stop the music. Play music and add it to my playlist", + "language": "en" + }, + { + "id": "2", + "text": "David Schmidt, senior vice president--Food Safety, International Food Information Council (IFIC), Washington, D.C., discussed the physical activity component.", + "language": "en" + } + ] + }, + "tasks": { + "customMultiClassificationTasks": [ + { + "parameters": { + "project-name": "7cdace98-537b-494a-b69a-c19754718025", + "deployment-name": "7cdace98-537b-494a-b69a-c19754718025" + } + } + ] + } + }, + "StatusCode": 202, + "ResponseHeaders": { + "apim-request-id": "0bb9a1c1-78ae-4135-a04d-69a922f2c3c3", + "Date": "Thu, 23 Sep 2021 11:21:22 GMT", + "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/9dc7476a-d713-472b-b4d3-efc4f99193c3", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "225" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/9dc7476a-d713-472b-b4d3-efc4f99193c3", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "b362614be61a7bf93ef4b6931ccce2df", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "b4bccc65-3408-4baa-b4ea-c6e28c818346", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 23 Sep 2021 11:21:22 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "21" + }, + "ResponseBody": { + "jobId": "9dc7476a-d713-472b-b4d3-efc4f99193c3", + "lastUpdateDateTime": "2021-09-23T11:21:22Z", + "createdDateTime": "2021-09-23T11:21:22Z", + "expirationDateTime": "2021-09-24T11:21:22Z", + "status": "running", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 0, + "failed": 0, + "inProgress": 1, + "total": 1 + } + } + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/9dc7476a-d713-472b-b4d3-efc4f99193c3", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "3cd0c2fc2706fe41529a3d59eaba6881", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "8b93c2ee-146f-4999-a7a5-856c1379a4a6", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 23 Sep 2021 11:21:24 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "90" + }, + "ResponseBody": { + "jobId": "9dc7476a-d713-472b-b4d3-efc4f99193c3", + "lastUpdateDateTime": "2021-09-23T11:21:22Z", + "createdDateTime": "2021-09-23T11:21:22Z", + "expirationDateTime": "2021-09-24T11:21:22Z", + "status": "succeeded", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 1, + "failed": 0, + "inProgress": 0, + "total": 1, + "customMultiClassificationTasks": [ + { + "lastUpdateDateTime": "2021-09-23T11:21:22.8877726Z", + "state": "succeeded", + "results": { + "documents": [ + { + "id": "1", + "classifications": [ + { + "category": "BookRestaurant", + "confidenceScore": 0.97 + } + ], + "warnings": [] + }, + { + "id": "2", + "classifications": [], + "warnings": [] + } + ], + "errors": [], + "projectName": "7cdace98-537b-494a-b69a-c19754718025", + "deploymentName": "7cdace98-537b-494a-b69a-c19754718025" + } + } + ] + } + } + } + ], + "Variables": { + "RandomSeed": "483838597", + "TEXT_ANALYTICS_API_KEY": "Sanitized", + "TEXT_ANALYTICS_ENDPOINT": "https://cognitiveweppe.azure-api.net" + } +} \ No newline at end of file diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchTestAsync.json b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchTestAsync.json new file mode 100644 index 000000000000..de8db7799863 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchTestAsync.json @@ -0,0 +1,162 @@ +{ + "Entries": [ + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Content-Length": "564", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-e0372db381eeba4ebbbcca17db2b5fb3-8bee75a134fca741-00", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "8120c6641f6ed90c9a0460d20d63ba4b", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "analysisInput": { + "documents": [ + { + "id": "1", + "text": "I need a reservation for an indoor restaurant in China. Please don\u0027t stop the music. Play music and add it to my playlist", + "language": "en" + }, + { + "id": "2", + "text": "David Schmidt, senior vice president--Food Safety, International Food Information Council (IFIC), Washington, D.C., discussed the physical activity component.", + "language": "en" + } + ] + }, + "tasks": { + "customMultiClassificationTasks": [ + { + "parameters": { + "project-name": "7cdace98-537b-494a-b69a-c19754718025", + "deployment-name": "7cdace98-537b-494a-b69a-c19754718025" + } + } + ] + } + }, + "StatusCode": 202, + "ResponseHeaders": { + "apim-request-id": "167171fe-c16d-4336-b562-ef9d0de0489f", + "Date": "Thu, 23 Sep 2021 11:21:24 GMT", + "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/a99eb920-f7a2-4ba4-95b8-73d369be7813", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "170" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/a99eb920-f7a2-4ba4-95b8-73d369be7813", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "66826a2828d115792013c91ec5834498", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "0e747844-38ee-4ff7-ad9a-738580d2758e", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 23 Sep 2021 11:21:25 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "9" + }, + "ResponseBody": { + "jobId": "a99eb920-f7a2-4ba4-95b8-73d369be7813", + "lastUpdateDateTime": "2021-09-23T11:21:25Z", + "createdDateTime": "2021-09-23T11:21:24Z", + "expirationDateTime": "2021-09-24T11:21:24Z", + "status": "notStarted", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 0, + "failed": 0, + "inProgress": 1, + "total": 1 + } + } + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/a99eb920-f7a2-4ba4-95b8-73d369be7813", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "c32b267537ab4075339e754ddcf643bb", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "21bce51b-c50d-4094-8c17-16e762e96ef2", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 23 Sep 2021 11:21:26 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "78" + }, + "ResponseBody": { + "jobId": "a99eb920-f7a2-4ba4-95b8-73d369be7813", + "lastUpdateDateTime": "2021-09-23T11:21:25Z", + "createdDateTime": "2021-09-23T11:21:24Z", + "expirationDateTime": "2021-09-24T11:21:24Z", + "status": "succeeded", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 1, + "failed": 0, + "inProgress": 0, + "total": 1, + "customMultiClassificationTasks": [ + { + "lastUpdateDateTime": "2021-09-23T11:21:25.9206799Z", + "state": "succeeded", + "results": { + "documents": [ + { + "id": "1", + "classifications": [ + { + "category": "BookRestaurant", + "confidenceScore": 0.97 + } + ], + "warnings": [] + }, + { + "id": "2", + "classifications": [], + "warnings": [] + } + ], + "errors": [], + "projectName": "7cdace98-537b-494a-b69a-c19754718025", + "deploymentName": "7cdace98-537b-494a-b69a-c19754718025" + } + } + ] + } + } + } + ], + "Variables": { + "RandomSeed": "1989776014", + "TEXT_ANALYTICS_API_KEY": "Sanitized", + "TEXT_ANALYTICS_ENDPOINT": "https://cognitiveweppe.azure-api.net" + } +} \ No newline at end of file diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithErrorTest.json b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithErrorTest.json new file mode 100644 index 000000000000..c31a965abbca --- /dev/null +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithErrorTest.json @@ -0,0 +1,164 @@ +{ + "Entries": [ + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Content-Length": "328", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-3295b1e1fe1a3847b13ed9a7e425747a-20c5e0bc0e06ee4c-00", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "dba8a64399876b7cf246e46bf1121ed2", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "analysisInput": { + "documents": [ + { + "id": "0", + "text": "Subject is taking 100mg of ibuprofen twice daily", + "language": "en" + }, + { + "id": "1", + "text": "", + "language": "en" + } + ] + }, + "tasks": { + "customMultiClassificationTasks": [ + { + "parameters": { + "project-name": "7cdace98-537b-494a-b69a-c19754718025", + "deployment-name": "7cdace98-537b-494a-b69a-c19754718025" + } + } + ] + } + }, + "StatusCode": 202, + "ResponseHeaders": { + "apim-request-id": "315cf819-6325-449d-93fc-7208981fd63a", + "Date": "Thu, 23 Sep 2021 11:20:14 GMT", + "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/00d95567-5a5a-4613-8ca3-3defeb9c35cb", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "337" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/00d95567-5a5a-4613-8ca3-3defeb9c35cb", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "b5b12043754771bfcc5badf19472986f", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "ba28fff5-a295-432c-8cc0-d131ba7c309d", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 23 Sep 2021 11:20:14 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "15" + }, + "ResponseBody": { + "jobId": "00d95567-5a5a-4613-8ca3-3defeb9c35cb", + "lastUpdateDateTime": "2021-09-23T11:20:15Z", + "createdDateTime": "2021-09-23T11:20:14Z", + "expirationDateTime": "2021-09-24T11:20:14Z", + "status": "running", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 0, + "failed": 0, + "inProgress": 1, + "total": 1 + } + } + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/00d95567-5a5a-4613-8ca3-3defeb9c35cb", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "7e4b8d2d6047048d3a60424b48a1f201", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "7023c37f-deb6-414c-b427-761cc29b14ef", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 23 Sep 2021 11:20:16 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "189" + }, + "ResponseBody": { + "jobId": "00d95567-5a5a-4613-8ca3-3defeb9c35cb", + "lastUpdateDateTime": "2021-09-23T11:20:15Z", + "createdDateTime": "2021-09-23T11:20:14Z", + "expirationDateTime": "2021-09-24T11:20:14Z", + "status": "succeeded", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 1, + "failed": 0, + "inProgress": 0, + "total": 1, + "customMultiClassificationTasks": [ + { + "lastUpdateDateTime": "2021-09-23T11:20:15.331449Z", + "state": "succeeded", + "results": { + "documents": [ + { + "id": "0", + "classifications": [], + "warnings": [] + } + ], + "errors": [ + { + "id": "1", + "error": { + "code": "InvalidArgument", + "message": "Invalid document in request.", + "innererror": { + "code": "InvalidDocument", + "message": "Document text is empty." + } + } + } + ], + "projectName": "7cdace98-537b-494a-b69a-c19754718025", + "deploymentName": "7cdace98-537b-494a-b69a-c19754718025" + } + } + ] + } + } + } + ], + "Variables": { + "RandomSeed": "345946910", + "TEXT_ANALYTICS_API_KEY": "Sanitized", + "TEXT_ANALYTICS_ENDPOINT": "https://cognitiveweppe.azure-api.net" + } +} \ No newline at end of file diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithErrorTestAsync.json b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithErrorTestAsync.json new file mode 100644 index 000000000000..7ca8385a2075 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithErrorTestAsync.json @@ -0,0 +1,164 @@ +{ + "Entries": [ + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Content-Length": "328", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-a07216e84f219944a376a18d396ed8a2-2a2a56f99cf2f14f-00", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "b0512329b82c40362331a3a24836f81b", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "analysisInput": { + "documents": [ + { + "id": "0", + "text": "Subject is taking 100mg of ibuprofen twice daily", + "language": "en" + }, + { + "id": "1", + "text": "", + "language": "en" + } + ] + }, + "tasks": { + "customMultiClassificationTasks": [ + { + "parameters": { + "project-name": "7cdace98-537b-494a-b69a-c19754718025", + "deployment-name": "7cdace98-537b-494a-b69a-c19754718025" + } + } + ] + } + }, + "StatusCode": 202, + "ResponseHeaders": { + "apim-request-id": "0ffe4658-389e-4161-a460-2d7f6a979b2c", + "Date": "Thu, 23 Sep 2021 11:20:16 GMT", + "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/cc6cdbe5-00b3-4277-9b85-9ff9adf07814", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "192" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/cc6cdbe5-00b3-4277-9b85-9ff9adf07814", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "dd09b342a9851d8000b8159dec98b1d3", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "3c9389c0-5621-46c3-abc1-2bda4a0f5c54", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 23 Sep 2021 11:20:16 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "7" + }, + "ResponseBody": { + "jobId": "cc6cdbe5-00b3-4277-9b85-9ff9adf07814", + "lastUpdateDateTime": "2021-09-23T11:20:17Z", + "createdDateTime": "2021-09-23T11:20:17Z", + "expirationDateTime": "2021-09-24T11:20:17Z", + "status": "notStarted", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 0, + "failed": 0, + "inProgress": 1, + "total": 1 + } + } + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/cc6cdbe5-00b3-4277-9b85-9ff9adf07814", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "04f82a3f1f2532fd83caa8f3ff57a53b", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "50c196e5-bb6d-474f-9465-5844bf61d912", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 23 Sep 2021 11:20:18 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "66" + }, + "ResponseBody": { + "jobId": "cc6cdbe5-00b3-4277-9b85-9ff9adf07814", + "lastUpdateDateTime": "2021-09-23T11:20:18Z", + "createdDateTime": "2021-09-23T11:20:17Z", + "expirationDateTime": "2021-09-24T11:20:17Z", + "status": "succeeded", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 1, + "failed": 0, + "inProgress": 0, + "total": 1, + "customMultiClassificationTasks": [ + { + "lastUpdateDateTime": "2021-09-23T11:20:18.3489203Z", + "state": "succeeded", + "results": { + "documents": [ + { + "id": "0", + "classifications": [], + "warnings": [] + } + ], + "errors": [ + { + "id": "1", + "error": { + "code": "InvalidArgument", + "message": "Invalid document in request.", + "innererror": { + "code": "InvalidDocument", + "message": "Document text is empty." + } + } + } + ], + "projectName": "7cdace98-537b-494a-b69a-c19754718025", + "deploymentName": "7cdace98-537b-494a-b69a-c19754718025" + } + } + ] + } + } + } + ], + "Variables": { + "RandomSeed": "1193753074", + "TEXT_ANALYTICS_API_KEY": "Sanitized", + "TEXT_ANALYTICS_ENDPOINT": "https://cognitiveweppe.azure-api.net" + } +} \ No newline at end of file diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithStatisticsTest.json b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithStatisticsTest.json new file mode 100644 index 000000000000..2f2aba484373 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithStatisticsTest.json @@ -0,0 +1,176 @@ +{ + "Entries": [ + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Content-Length": "564", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-b8e84a634192f84f917a47e88e403b3c-a1d9821e8a380145-00", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "12506dda78bf4d710659bcefd0f793f4", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "analysisInput": { + "documents": [ + { + "id": "1", + "text": "I need a reservation for an indoor restaurant in China. Please don\u0027t stop the music. Play music and add it to my playlist", + "language": "en" + }, + { + "id": "2", + "text": "David Schmidt, senior vice president--Food Safety, International Food Information Council (IFIC), Washington, D.C., discussed the physical activity component.", + "language": "en" + } + ] + }, + "tasks": { + "customMultiClassificationTasks": [ + { + "parameters": { + "project-name": "7cdace98-537b-494a-b69a-c19754718025", + "deployment-name": "7cdace98-537b-494a-b69a-c19754718025" + } + } + ] + } + }, + "StatusCode": 202, + "ResponseHeaders": { + "apim-request-id": "4786f470-b37f-4361-9c22-5e8123a0877d", + "Date": "Thu, 23 Sep 2021 11:21:41 GMT", + "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/1f45450f-224d-4781-bce7-d53e6b262f90", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "362" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/1f45450f-224d-4781-bce7-d53e6b262f90?showStats=true", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "f5f3bdc8b9e9821865502ab6d20203b4", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "a0f39ba8-69ec-45de-8773-e29da4fd8df1", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 23 Sep 2021 11:21:41 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "18" + }, + "ResponseBody": { + "jobId": "1f45450f-224d-4781-bce7-d53e6b262f90", + "lastUpdateDateTime": "2021-09-23T11:21:42Z", + "createdDateTime": "2021-09-23T11:21:41Z", + "expirationDateTime": "2021-09-24T11:21:41Z", + "status": "notStarted", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 0, + "failed": 0, + "inProgress": 1, + "total": 1 + } + } + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/1f45450f-224d-4781-bce7-d53e6b262f90?showStats=true", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "21f738c70fcc2ca2643726f760b9704a", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "3a53be58-e043-4179-97be-ada71a83d67d", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 23 Sep 2021 11:21:42 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "212" + }, + "ResponseBody": { + "jobId": "1f45450f-224d-4781-bce7-d53e6b262f90", + "lastUpdateDateTime": "2021-09-23T11:21:43Z", + "createdDateTime": "2021-09-23T11:21:41Z", + "expirationDateTime": "2021-09-24T11:21:41Z", + "status": "succeeded", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 1, + "failed": 0, + "inProgress": 0, + "total": 1, + "customMultiClassificationTasks": [ + { + "lastUpdateDateTime": "2021-09-23T11:21:43.0697024Z", + "state": "succeeded", + "results": { + "statistics": { + "documentsCount": 2, + "validDocumentsCount": 2, + "erroneousDocumentsCount": 0, + "transactionsCount": 2 + }, + "documents": [ + { + "id": "1", + "classifications": [ + { + "category": "BookRestaurant", + "confidenceScore": 0.97 + } + ], + "statistics": { + "charactersCount": 121, + "transactionsCount": 1 + }, + "warnings": [] + }, + { + "id": "2", + "classifications": [], + "statistics": { + "charactersCount": 158, + "transactionsCount": 1 + }, + "warnings": [] + } + ], + "errors": [], + "projectName": "7cdace98-537b-494a-b69a-c19754718025", + "deploymentName": "7cdace98-537b-494a-b69a-c19754718025" + } + } + ] + } + } + } + ], + "Variables": { + "RandomSeed": "463356788", + "TEXT_ANALYTICS_API_KEY": "Sanitized", + "TEXT_ANALYTICS_ENDPOINT": "https://cognitiveweppe.azure-api.net" + } +} \ No newline at end of file diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithStatisticsTestAsync.json b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithStatisticsTestAsync.json new file mode 100644 index 000000000000..faccb6d6af2f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithStatisticsTestAsync.json @@ -0,0 +1,176 @@ +{ + "Entries": [ + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Content-Length": "564", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-6e142811a0ef5848afb223ece6625277-df1789e59e84274e-00", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "0989596639103ef904a00a515f729506", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "analysisInput": { + "documents": [ + { + "id": "1", + "text": "I need a reservation for an indoor restaurant in China. Please don\u0027t stop the music. Play music and add it to my playlist", + "language": "en" + }, + { + "id": "2", + "text": "David Schmidt, senior vice president--Food Safety, International Food Information Council (IFIC), Washington, D.C., discussed the physical activity component.", + "language": "en" + } + ] + }, + "tasks": { + "customMultiClassificationTasks": [ + { + "parameters": { + "project-name": "7cdace98-537b-494a-b69a-c19754718025", + "deployment-name": "7cdace98-537b-494a-b69a-c19754718025" + } + } + ] + } + }, + "StatusCode": 202, + "ResponseHeaders": { + "apim-request-id": "2180a8fe-b522-4284-ae20-18cbe67a6977", + "Date": "Thu, 23 Sep 2021 11:21:43 GMT", + "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/5cbf4b66-68d0-4dbc-b3e6-207c0ae2ac07", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "213" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/5cbf4b66-68d0-4dbc-b3e6-207c0ae2ac07?showStats=true", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "45e51d0216f3aa82ac8d662f4ea84548", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "dc5e56c6-81ba-4f85-9d1a-ae459490f6c9", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 23 Sep 2021 11:21:43 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "7" + }, + "ResponseBody": { + "jobId": "5cbf4b66-68d0-4dbc-b3e6-207c0ae2ac07", + "lastUpdateDateTime": "2021-09-23T11:21:44Z", + "createdDateTime": "2021-09-23T11:21:44Z", + "expirationDateTime": "2021-09-24T11:21:44Z", + "status": "notStarted", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 0, + "failed": 0, + "inProgress": 1, + "total": 1 + } + } + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/5cbf4b66-68d0-4dbc-b3e6-207c0ae2ac07?showStats=true", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "17cdb58ba6256c4d4373b64dd5207a3d", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "8e6b48f0-2669-4b9d-84b8-202254376c77", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 23 Sep 2021 11:21:45 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "70" + }, + "ResponseBody": { + "jobId": "5cbf4b66-68d0-4dbc-b3e6-207c0ae2ac07", + "lastUpdateDateTime": "2021-09-23T11:21:45Z", + "createdDateTime": "2021-09-23T11:21:44Z", + "expirationDateTime": "2021-09-24T11:21:44Z", + "status": "succeeded", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 1, + "failed": 0, + "inProgress": 0, + "total": 1, + "customMultiClassificationTasks": [ + { + "lastUpdateDateTime": "2021-09-23T11:21:45.0964217Z", + "state": "succeeded", + "results": { + "statistics": { + "documentsCount": 2, + "validDocumentsCount": 2, + "erroneousDocumentsCount": 0, + "transactionsCount": 2 + }, + "documents": [ + { + "id": "1", + "classifications": [ + { + "category": "BookRestaurant", + "confidenceScore": 0.97 + } + ], + "statistics": { + "charactersCount": 121, + "transactionsCount": 1 + }, + "warnings": [] + }, + { + "id": "2", + "classifications": [], + "statistics": { + "charactersCount": 158, + "transactionsCount": 1 + }, + "warnings": [] + } + ], + "errors": [], + "projectName": "7cdace98-537b-494a-b69a-c19754718025", + "deploymentName": "7cdace98-537b-494a-b69a-c19754718025" + } + } + ] + } + } + } + ], + "Variables": { + "RandomSeed": "2081690880", + "TEXT_ANALYTICS_API_KEY": "Sanitized", + "TEXT_ANALYTICS_ENDPOINT": "https://cognitiveweppe.azure-api.net" + } +} \ No newline at end of file diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesWithDisableServiceLogs.json b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesWithDisableServiceLogs.json new file mode 100644 index 000000000000..df1dca578860 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesWithDisableServiceLogs.json @@ -0,0 +1,163 @@ +{ + "Entries": [ + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Content-Length": "585", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-633e81da0c481d43b3edc9b1f0f678a1-145be1c148087946-00", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "dd8512c408e3f98b7b13cd6a87bf57b4", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "analysisInput": { + "documents": [ + { + "id": "0", + "text": "I need a reservation for an indoor restaurant in China. Please don\u0027t stop the music. Play music and add it to my playlist", + "language": "en" + }, + { + "id": "1", + "text": "David Schmidt, senior vice president--Food Safety, International Food Information Council (IFIC), Washington, D.C., discussed the physical activity component.", + "language": "en" + } + ] + }, + "tasks": { + "customMultiClassificationTasks": [ + { + "parameters": { + "project-name": "7cdace98-537b-494a-b69a-c19754718025", + "deployment-name": "7cdace98-537b-494a-b69a-c19754718025", + "loggingOptOut": true + } + } + ] + } + }, + "StatusCode": 202, + "ResponseHeaders": { + "apim-request-id": "d946cbc6-8c0a-4770-b8fb-2bcb242f179a", + "Date": "Thu, 23 Sep 2021 11:19:50 GMT", + "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/3b5aec18-9081-4e9d-9c13-fcdd4f8d5269", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "258" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/3b5aec18-9081-4e9d-9c13-fcdd4f8d5269", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "9eb47ee3189f820516a7d87cb8e236f7", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "86f71569-601d-4d32-97d3-e66c2852ad5f", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 23 Sep 2021 11:19:50 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "18" + }, + "ResponseBody": { + "jobId": "3b5aec18-9081-4e9d-9c13-fcdd4f8d5269", + "lastUpdateDateTime": "2021-09-23T11:19:50Z", + "createdDateTime": "2021-09-23T11:19:50Z", + "expirationDateTime": "2021-09-24T11:19:50Z", + "status": "notStarted", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 0, + "failed": 0, + "inProgress": 1, + "total": 1 + } + } + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/3b5aec18-9081-4e9d-9c13-fcdd4f8d5269", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "b83c7c5de2b45343cf2a6a95da9f77bf", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "b07e85d9-02ad-4182-90b0-bda7da693d42", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 23 Sep 2021 11:19:51 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "94" + }, + "ResponseBody": { + "jobId": "3b5aec18-9081-4e9d-9c13-fcdd4f8d5269", + "lastUpdateDateTime": "2021-09-23T11:19:51Z", + "createdDateTime": "2021-09-23T11:19:50Z", + "expirationDateTime": "2021-09-24T11:19:50Z", + "status": "succeeded", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 1, + "failed": 0, + "inProgress": 0, + "total": 1, + "customMultiClassificationTasks": [ + { + "lastUpdateDateTime": "2021-09-23T11:19:51.1392783Z", + "state": "succeeded", + "results": { + "documents": [ + { + "id": "0", + "classifications": [ + { + "category": "BookRestaurant", + "confidenceScore": 0.97 + } + ], + "warnings": [] + }, + { + "id": "1", + "classifications": [], + "warnings": [] + } + ], + "errors": [], + "projectName": "7cdace98-537b-494a-b69a-c19754718025", + "deploymentName": "7cdace98-537b-494a-b69a-c19754718025" + } + } + ] + } + } + } + ], + "Variables": { + "RandomSeed": "1546450481", + "TEXT_ANALYTICS_API_KEY": "Sanitized", + "TEXT_ANALYTICS_ENDPOINT": "https://cognitiveweppe.azure-api.net" + } +} \ No newline at end of file diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesWithDisableServiceLogsAsync.json b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesWithDisableServiceLogsAsync.json new file mode 100644 index 000000000000..5ba82d761ef1 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesWithDisableServiceLogsAsync.json @@ -0,0 +1,163 @@ +{ + "Entries": [ + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Content-Length": "585", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-1dc4fc54d7b00445a833a9e7bf8853e4-da598f49234e4348-00", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "8289b281ef10f25210e42cf6bf093bf2", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "analysisInput": { + "documents": [ + { + "id": "0", + "text": "I need a reservation for an indoor restaurant in China. Please don\u0027t stop the music. Play music and add it to my playlist", + "language": "en" + }, + { + "id": "1", + "text": "David Schmidt, senior vice president--Food Safety, International Food Information Council (IFIC), Washington, D.C., discussed the physical activity component.", + "language": "en" + } + ] + }, + "tasks": { + "customMultiClassificationTasks": [ + { + "parameters": { + "project-name": "7cdace98-537b-494a-b69a-c19754718025", + "deployment-name": "7cdace98-537b-494a-b69a-c19754718025", + "loggingOptOut": true + } + } + ] + } + }, + "StatusCode": 202, + "ResponseHeaders": { + "apim-request-id": "c6ba4471-2eb4-4dbf-951a-94280babd66b", + "Date": "Thu, 23 Sep 2021 11:19:52 GMT", + "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/7f1096ac-1064-4c7b-b409-bcc85a14922c", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "183" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/7f1096ac-1064-4c7b-b409-bcc85a14922c", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "321195cd4c5a557ea80a36e79a8e2c17", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "49508c32-84c3-4c0e-beb6-10229b995ff7", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 23 Sep 2021 11:19:52 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "8" + }, + "ResponseBody": { + "jobId": "7f1096ac-1064-4c7b-b409-bcc85a14922c", + "lastUpdateDateTime": "2021-09-23T11:19:53Z", + "createdDateTime": "2021-09-23T11:19:52Z", + "expirationDateTime": "2021-09-24T11:19:52Z", + "status": "notStarted", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 0, + "failed": 0, + "inProgress": 1, + "total": 1 + } + } + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/7f1096ac-1064-4c7b-b409-bcc85a14922c", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "e00bbf98ed504d970060f48927b5d603", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "e1e750c3-3842-494a-b294-2760bfb4b8d5", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 23 Sep 2021 11:19:54 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "72" + }, + "ResponseBody": { + "jobId": "7f1096ac-1064-4c7b-b409-bcc85a14922c", + "lastUpdateDateTime": "2021-09-23T11:19:54Z", + "createdDateTime": "2021-09-23T11:19:52Z", + "expirationDateTime": "2021-09-24T11:19:52Z", + "status": "succeeded", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 1, + "failed": 0, + "inProgress": 0, + "total": 1, + "customMultiClassificationTasks": [ + { + "lastUpdateDateTime": "2021-09-23T11:19:54.1978299Z", + "state": "succeeded", + "results": { + "documents": [ + { + "id": "0", + "classifications": [ + { + "category": "BookRestaurant", + "confidenceScore": 0.97 + } + ], + "warnings": [] + }, + { + "id": "1", + "classifications": [], + "warnings": [] + } + ], + "errors": [], + "projectName": "7cdace98-537b-494a-b69a-c19754718025", + "deploymentName": "7cdace98-537b-494a-b69a-c19754718025" + } + } + ] + } + } + } + ], + "Variables": { + "RandomSeed": "2132109812", + "TEXT_ANALYTICS_API_KEY": "Sanitized", + "TEXT_ANALYTICS_ENDPOINT": "https://cognitiveweppe.azure-api.net" + } +} \ No newline at end of file From 03f7f6d9fe4f5e81668361b689852955d2141f80 Mon Sep 17 00:00:00 2001 From: Ahmed Leithy Date: Thu, 23 Sep 2021 15:15:36 +0200 Subject: [PATCH 12/22] Setting Parameters classes to internal --- .../CustomMultiClassificationTaskParameters.Serialization.cs | 2 +- .../Generated/Models/CustomMultiClassificationTaskParameters.cs | 2 +- .../CustomSingleClassificationTaskParameters.Serialization.cs | 2 +- .../Models/CustomSingleClassificationTaskParameters.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTaskParameters.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTaskParameters.Serialization.cs index 35bff98ae396..dfbffed0afae 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTaskParameters.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTaskParameters.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.AI.TextAnalytics.Models { - public partial class CustomMultiClassificationTaskParameters : IUtf8JsonSerializable + internal partial class CustomMultiClassificationTaskParameters : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTaskParameters.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTaskParameters.cs index 85ecf3c119e4..44090d6ec3cd 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTaskParameters.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTaskParameters.cs @@ -10,7 +10,7 @@ namespace Azure.AI.TextAnalytics.Models { /// The CustomMultiClassificationTaskParameters. - public partial class CustomMultiClassificationTaskParameters + internal partial class CustomMultiClassificationTaskParameters { /// Initializes a new instance of CustomMultiClassificationTaskParameters. /// diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTaskParameters.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTaskParameters.Serialization.cs index a7d76e298f46..5d96c7ef6108 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTaskParameters.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTaskParameters.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.AI.TextAnalytics.Models { - public partial class CustomSingleClassificationTaskParameters : IUtf8JsonSerializable + internal partial class CustomSingleClassificationTaskParameters : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTaskParameters.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTaskParameters.cs index 3e83dcf14785..078a10ae94ba 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTaskParameters.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTaskParameters.cs @@ -10,7 +10,7 @@ namespace Azure.AI.TextAnalytics.Models { /// The CustomSingleClassificationTaskParameters. - public partial class CustomSingleClassificationTaskParameters + internal partial class CustomSingleClassificationTaskParameters { /// Initializes a new instance of CustomSingleClassificationTaskParameters. /// From f12cd0ad5ba63cb1814fa6fb29642d39b19d6ddc Mon Sep 17 00:00:00 2001 From: Ahmed Leithy Date: Thu, 23 Sep 2021 15:34:38 +0200 Subject: [PATCH 13/22] Changed TestEnvironment variable name for consistency --- .../tests/Infrastructure/TextAnalyticsTestEnvironment.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/Infrastructure/TextAnalyticsTestEnvironment.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/Infrastructure/TextAnalyticsTestEnvironment.cs index c62e437d6a36..9404d52f6e81 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/Infrastructure/TextAnalyticsTestEnvironment.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/Infrastructure/TextAnalyticsTestEnvironment.cs @@ -11,7 +11,7 @@ public class TextAnalyticsTestEnvironment: TestEnvironment public string ApiKey => GetRecordedVariable("TEXT_ANALYTICS_API_KEY", options => options.IsSecret()); public string SingleClassificationProjectName = "659c1851-be0b-4142-b12a-087da9785926"; public string SingleClassificationDeploymentName = "659c1851-be0b-4142-b12a-087da9785926"; - public string MultiCategoriesProjectName = "7cdace98-537b-494a-b69a-c19754718025"; - public string MultiCategoriesDeploymentName = "7cdace98-537b-494a-b69a-c19754718025"; + public string MultiClassificationProjectName = "7cdace98-537b-494a-b69a-c19754718025"; + public string MultiClassificationDeploymentName = "7cdace98-537b-494a-b69a-c19754718025"; } } From d5d222f4fc67a9303b3967da54c9eec8a7d0b7b4 Mon Sep 17 00:00:00 2001 From: Ahmed Leithy Date: Sun, 26 Sep 2021 14:45:42 +0200 Subject: [PATCH 14/22] Added model Factory methods --- .../src/TextAnalyticsModelFactory.cs | 84 ++++++++++++++++++- 1 file changed, 82 insertions(+), 2 deletions(-) diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsModelFactory.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsModelFactory.cs index bd9d42ea1c13..480e65492c93 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsModelFactory.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsModelFactory.cs @@ -518,6 +518,55 @@ public static SummarySentenceCollection SummarySentenceCollection(IEnumerable + /// Initializes a new instance of for mocking purposes. + /// + /// Sets the property. + /// Sets the property. + /// Sets the of . + /// Sets the collection of . + /// A new instance of for mocking purposes. + public static ClassifyCustomCategoriesResult ClassifyCustomCategoriesResult(string id, TextDocumentStatistics statistics, DocumentClassificationCollection documentClassificationCollection, IEnumerable warnings = default) + { + return new ClassifyCustomCategoriesResult(id, statistics, documentClassificationCollection, warnings.ToList()); + } + + /// + /// Initializes a new instance of for mocking purposes. + /// + /// Sets the property. + /// Sets the property. + /// A new instance of for mocking purposes. + public static ClassifyCustomCategoriesResult ClassifyCustomCategoriesResult(string id, TextAnalyticsError error) + { + return new ClassifyCustomCategoriesResult(id, error); + } + /// + /// Initializes a new instance of for mocking purposes. + /// + /// Sets the collection of . + /// Sets the property. + /// Sets the property. + /// Sets the property. + /// A new instance of for mocking purposes. + public static ClassifyCustomCategoriesResultCollection ClassifyCustomCategoriesResultCollection(IEnumerable list, TextDocumentBatchStatistics statistics, string projectName, string deploymentName) + { + return new ClassifyCustomCategoriesResultCollection(list.ToList(), statistics, projectName, deploymentName); + } + + /// + /// Initializes a new instance of for mocking purposes. + /// + /// Sets the collection of . + /// Sets the property. + /// A new instance of for mocking purposes. + public static DocumentClassificationCollection DocumentClassificationCollection(IEnumerable classificationList, IEnumerable warnings) + { + return new DocumentClassificationCollection(classificationList.ToList(), warnings.ToList()); + } + #endregion + #region Single Category Classify /// /// Initializes a new instance of for mocking purposes. @@ -741,6 +790,7 @@ public static AnalyzeActionsResult AnalyzeActionsResult( /// Sets the collection of . /// Sets the collection of . /// Sets the collection of . + /// Sets the collection of . /// A new instance of for mocking purposes. public static AnalyzeActionsResult AnalyzeActionsResult( IEnumerable extractKeyPhrasesActionResults, @@ -749,7 +799,8 @@ public static AnalyzeActionsResult AnalyzeActionsResult( IEnumerable recognizeLinkedEntitiesActionResults, IEnumerable analyzeSentimentActionResults, IEnumerable extractSummaryActionResults, - IEnumerable singleCategoryClassifyActionResults + IEnumerable singleCategoryClassifyActionResults, + IEnumerable classifyCustomCategoriesActionResults ) { return new AnalyzeActionsResult( @@ -760,7 +811,7 @@ IEnumerable singleCategoryClassifyActionResu analyzeSentimentActionResults.ToList(), extractSummaryActionResults.ToList(), singleCategoryClassifyActionResults.ToList(), - new List() + classifyCustomCategoriesActionResults.ToList()); ); } @@ -819,6 +870,34 @@ public static ExtractSummaryActionResult ExtractSummaryActionResult( { return new ExtractSummaryActionResult(completedOn, new TextAnalyticsErrorInternal(code, message)); } + + /// + /// Initializes a new instance of for mocking purposes. + /// + /// Sets the property. + /// Sets the property. + /// A new instance of for mocking purposes. + public static ClassifyCustomCategoriesActionResult ClassifyCustomCategoriesActionResult( + ClassifyCustomCategoriesResultCollection result, + DateTimeOffset completedOn) + { + return new ClassifyCustomCategoriesActionResult(result, completedOn); + } + + /// + /// Initializes a new instance of for mocking purposes. + /// + /// Sets the property. + /// Sets the property. + /// Sets the property. + /// A new instance of for mocking purposes. + public static ClassifyCustomCategoriesActionResult ClassifyCustomCategoryActionResult( + DateTimeOffset completedOn, + string code, + string message) + { + return new ClassifyCustomCategoriesActionResult(completedOn, new TextAnalyticsErrorInternal(code, message)); + } /// /// Initializes a new instance of for mocking purposes. @@ -847,6 +926,7 @@ public static SingleCategoryClassifyActionResult SingleCategoryClassifyActionRes { return new SingleCategoryClassifyActionResult(completedOn, new TextAnalyticsErrorInternal(code, message)); } + /// /// Initializes a new instance of for mocking purposes. /// From 725636bcfc02f814c7c391dd4eea7ed70944d62d Mon Sep 17 00:00:00 2001 From: Ahmed Leithy Date: Sun, 26 Sep 2021 20:43:22 +0200 Subject: [PATCH 15/22] Renamed ClassifyCustomCategories --> MultiCategoryClassify, DocumentClassificationCollection --> ClassificationCategoryCollection --- .../Azure.AI.TextAnalytics/CHANGELOG.md | 2 +- .../Azure.AI.TextAnalytics.netstandard2.0.cs | 40 ++++++- .../Sample11_ClassifyCustomCategories.md | 47 +++++--- .../src/AnalyzeActionsResult.cs | 6 +- ...cs => ClassificationCategoryCollection.cs} | 20 ++-- .../src/ClassifyCustomCategoriesResult.cs | 46 ------- .../src/DocumentClassification.cs | 41 ------- ...tion.cs => MultiCategoryClassifyAction.cs} | 14 +-- ...s => MultiCategoryClassifyActionResult.cs} | 14 +-- .../src/MultiCategoryClassifyResult.cs | 46 +++++++ ... MultiCategoryClassifyResultCollection.cs} | 22 ++-- .../src/TextAnalyticsActions.cs | 6 +- .../src/TextAnalyticsClient.cs | 6 +- .../src/TextAnalyticsModelFactory.cs | 78 ++++++------ .../Azure.AI.TextAnalytics/src/Transforms.cs | 43 +++---- .../tests/AnalyzeOperationMockTests.cs | 24 ++-- .../tests/AnalyzeOperationTests.cs | 4 +- ...Tests.cs => MultiCategoryClassifyTests.cs} | 112 +++++++++--------- .../tests/TextAnalyticsModelFactoryTests.cs | 10 +- ...s.cs => Sample11_MultiCategoryClassify.cs} | 20 ++-- ...=> Sample11_MultiCategoryClassifyAsync.cs} | 20 ++-- ...ple11_MultiCategoryClassifyConvenience.cs} | 20 ++-- ..._MultiCategoryClassifyConvenienceAsync.cs} | 32 ++--- 23 files changed, 344 insertions(+), 329 deletions(-) rename sdk/textanalytics/Azure.AI.TextAnalytics/src/{DocumentClassificationCollection.cs => ClassificationCategoryCollection.cs} (61%) delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassifyCustomCategoriesResult.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/DocumentClassification.cs rename sdk/textanalytics/Azure.AI.TextAnalytics/src/{ClassifyCustomCategoriesAction.cs => MultiCategoryClassifyAction.cs} (78%) rename sdk/textanalytics/Azure.AI.TextAnalytics/src/{ClassifyCustomCategoriesActionResult.cs => MultiCategoryClassifyActionResult.cs} (59%) create mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/MultiCategoryClassifyResult.cs rename sdk/textanalytics/Azure.AI.TextAnalytics/src/{ClassifyCustomCategoriesResultCollection.cs => MultiCategoryClassifyResultCollection.cs} (73%) rename sdk/textanalytics/Azure.AI.TextAnalytics/tests/{ClassifyCustomCategoriesTests.cs => MultiCategoryClassifyTests.cs} (51%) rename sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/{Sample11_ClassifyCustomCategories.cs => Sample11_MultiCategoryClassify.cs} (79%) rename sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/{Sample11_ClassifyCustomCategoriesAsync.cs => Sample11_MultiCategoryClassifyAsync.cs} (77%) rename sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/{Sample11_ClassifyCustomCategoriesConvenience.cs => Sample11_MultiCategoryClassifyConvenience.cs} (78%) rename sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/{Sample11_ClassifyCustomCategoriesConvenienceAsync.cs => Sample11_MultiCategoryClassifyConvenienceAsync.cs} (69%) diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/CHANGELOG.md b/sdk/textanalytics/Azure.AI.TextAnalytics/CHANGELOG.md index 5653e521572d..d053fa2b5e2f 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/CHANGELOG.md +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/CHANGELOG.md @@ -5,7 +5,7 @@ ### Features Added - Added property `SingleCategoryClassifyAction` to `TextAnalyticsActions` to support the new 'Custom Single Classification' API. This action can be used to get a custom classification for an input document or batch of documents. -- Added property `ClassifyCustomCategoriesAction` to `TextAnalyticsActions` to support the new 'Custom Multiple Classification' API. This action can be used to get multiple custom classifications for an input document or batch of documents. +- Added property `MultiCategoryClassifyAction` to `TextAnalyticsActions` to support the new 'Custom Multiple Classification' API. This action can be used to get multiple custom classifications for an input document or batch of documents. ### Breaking Changes diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/api/Azure.AI.TextAnalytics.netstandard2.0.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/api/Azure.AI.TextAnalytics.netstandard2.0.cs index bbca9d7dbb6b..291bff876539 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/api/Azure.AI.TextAnalytics.netstandard2.0.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/api/Azure.AI.TextAnalytics.netstandard2.0.cs @@ -37,6 +37,7 @@ internal AnalyzeActionsResult() { } public System.Collections.Generic.IReadOnlyCollection AnalyzeSentimentResults { get { throw null; } } public System.Collections.Generic.IReadOnlyCollection ExtractKeyPhrasesResults { get { throw null; } } public System.Collections.Generic.IReadOnlyCollection ExtractSummaryResults { get { throw null; } } + public System.Collections.Generic.IReadOnlyCollection MultiCategoryClassifyResults { get { throw null; } } public System.Collections.Generic.IReadOnlyCollection RecognizeEntitiesResults { get { throw null; } } public System.Collections.Generic.IReadOnlyCollection RecognizeLinkedEntitiesResults { get { throw null; } } public System.Collections.Generic.IReadOnlyCollection RecognizePiiEntitiesResults { get { throw null; } } @@ -148,6 +149,11 @@ public readonly partial struct ClassificationCategory public string Category { get { throw null; } } public double ConfidenceScore { get { throw null; } } } + public partial class ClassificationCategoryCollection : System.Collections.ObjectModel.ReadOnlyCollection + { + internal ClassificationCategoryCollection() : base (default(System.Collections.Generic.IList)) { } + public System.Collections.Generic.IReadOnlyCollection Warnings { get { throw null; } } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct DetectedLanguage { @@ -429,6 +435,31 @@ public readonly partial struct LinkedEntityMatch public int Offset { get { throw null; } } public string Text { get { throw null; } } } + public partial class MultiCategoryClassifyAction + { + public MultiCategoryClassifyAction(string projectName, string deploymentName) { } + public string DeploymentName { get { throw null; } } + public bool? DisableServiceLogs { get { throw null; } set { } } + public string ProjectName { get { throw null; } } + } + public partial class MultiCategoryClassifyActionResult : Azure.AI.TextAnalytics.TextAnalyticsActionResult + { + internal MultiCategoryClassifyActionResult() { } + public Azure.AI.TextAnalytics.MultiCategoryClassifyResultCollection DocumentsResults { get { throw null; } } + } + public partial class MultiCategoryClassifyResult : Azure.AI.TextAnalytics.TextAnalyticsResult + { + internal MultiCategoryClassifyResult() { } + public Azure.AI.TextAnalytics.ClassificationCategoryCollection ClassificationCategories { get { throw null; } } + public System.Collections.Generic.IReadOnlyCollection Warnings { get { throw null; } } + } + public partial class MultiCategoryClassifyResultCollection : System.Collections.ObjectModel.ReadOnlyCollection + { + internal MultiCategoryClassifyResultCollection() : base (default(System.Collections.Generic.IList)) { } + public string DeploymentName { get { throw null; } } + public string ProjectName { get { throw null; } } + public Azure.AI.TextAnalytics.TextDocumentBatchStatistics Statistics { get { throw null; } } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct PiiEntity { @@ -815,6 +846,7 @@ public TextAnalyticsActions() { } public string DisplayName { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyCollection ExtractKeyPhrasesActions { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyCollection ExtractSummaryActions { get { throw null; } set { } } + public System.Collections.Generic.IReadOnlyCollection MultiCategoryClassifyActions { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyCollection RecognizeEntitiesActions { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyCollection RecognizeLinkedEntitiesActions { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyCollection RecognizePiiEntitiesActions { get { throw null; } set { } } @@ -951,7 +983,7 @@ public static partial class TextAnalyticsModelFactory { [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public static Azure.AI.TextAnalytics.AnalyzeActionsResult AnalyzeActionsResult(System.Collections.Generic.IEnumerable extractKeyPhrasesActionResult, System.Collections.Generic.IEnumerable recognizeEntitiesActionResults, System.Collections.Generic.IEnumerable recognizePiiEntitiesActionResults, System.Collections.Generic.IEnumerable recognizeLinkedEntitiesActionsResults, System.Collections.Generic.IEnumerable analyzeSentimentActionsResults) { throw null; } - public static Azure.AI.TextAnalytics.AnalyzeActionsResult AnalyzeActionsResult(System.Collections.Generic.IEnumerable extractKeyPhrasesActionResults, System.Collections.Generic.IEnumerable recognizeEntitiesActionResults, System.Collections.Generic.IEnumerable recognizePiiEntitiesActionResults, System.Collections.Generic.IEnumerable recognizeLinkedEntitiesActionResults, System.Collections.Generic.IEnumerable analyzeSentimentActionResults, System.Collections.Generic.IEnumerable extractSummaryActionResults, System.Collections.Generic.IEnumerable singleCategoryClassifyActionResults) { throw null; } + public static Azure.AI.TextAnalytics.AnalyzeActionsResult AnalyzeActionsResult(System.Collections.Generic.IEnumerable extractKeyPhrasesActionResults, System.Collections.Generic.IEnumerable recognizeEntitiesActionResults, System.Collections.Generic.IEnumerable recognizePiiEntitiesActionResults, System.Collections.Generic.IEnumerable recognizeLinkedEntitiesActionResults, System.Collections.Generic.IEnumerable analyzeSentimentActionResults, System.Collections.Generic.IEnumerable extractSummaryActionResults, System.Collections.Generic.IEnumerable singleCategoryClassifyActionResults, System.Collections.Generic.IEnumerable multiCategoryClassifyActionResults) { throw null; } public static Azure.AI.TextAnalytics.AnalyzeHealthcareEntitiesResult AnalyzeHealthcareEntitiesResult(string id, Azure.AI.TextAnalytics.TextDocumentStatistics statistics, System.Collections.Generic.IEnumerable healthcareEntities, System.Collections.Generic.IEnumerable entityRelations, System.Collections.Generic.IEnumerable warnings) { throw null; } public static Azure.AI.TextAnalytics.AnalyzeHealthcareEntitiesResult AnalyzeHealthcareEntitiesResult(string id, string code, string message) { throw null; } public static Azure.AI.TextAnalytics.AnalyzeHealthcareEntitiesResultCollection AnalyzeHealthcareEntitiesResultCollection(System.Collections.Generic.IEnumerable list, Azure.AI.TextAnalytics.TextDocumentBatchStatistics statistics, string modelVersion) { throw null; } @@ -966,6 +998,7 @@ public static partial class TextAnalyticsModelFactory public static Azure.AI.TextAnalytics.CategorizedEntity CategorizedEntity(string text, string category, string subCategory, double score, int offset, int length) { throw null; } public static Azure.AI.TextAnalytics.CategorizedEntityCollection CategorizedEntityCollection(System.Collections.Generic.IList entities, System.Collections.Generic.IList warnings = null) { throw null; } public static Azure.AI.TextAnalytics.ClassificationCategory ClassificationCategory(string category, double confidenceScore) { throw null; } + public static Azure.AI.TextAnalytics.ClassificationCategoryCollection ClassificationCategoryCollection(System.Collections.Generic.IEnumerable classificationList, System.Collections.Generic.IEnumerable warnings) { throw null; } public static Azure.AI.TextAnalytics.DetectedLanguage DetectedLanguage(string name, string iso6391Name, double confidenceScore, System.Collections.Generic.IList warnings = null) { throw null; } public static Azure.AI.TextAnalytics.DetectLanguageResult DetectLanguageResult(string id, Azure.AI.TextAnalytics.TextAnalyticsError error) { throw null; } public static Azure.AI.TextAnalytics.DetectLanguageResult DetectLanguageResult(string id, Azure.AI.TextAnalytics.TextDocumentStatistics statistics, Azure.AI.TextAnalytics.DetectedLanguage detectedLanguage) { throw null; } @@ -994,6 +1027,11 @@ public static partial class TextAnalyticsModelFactory [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public static Azure.AI.TextAnalytics.LinkedEntityMatch LinkedEntityMatch(string text, double score) { throw null; } public static Azure.AI.TextAnalytics.LinkedEntityMatch LinkedEntityMatch(string text, double score, int offset, int length) { throw null; } + public static Azure.AI.TextAnalytics.MultiCategoryClassifyActionResult MultiCategoryClassifyActionResult(Azure.AI.TextAnalytics.MultiCategoryClassifyResultCollection result, System.DateTimeOffset completedOn) { throw null; } + public static Azure.AI.TextAnalytics.MultiCategoryClassifyActionResult MultiCategoryClassifyActionResult(System.DateTimeOffset completedOn, string code, string message) { throw null; } + public static Azure.AI.TextAnalytics.MultiCategoryClassifyResult MultiCategoryClassifyResult(string id, Azure.AI.TextAnalytics.TextAnalyticsError error) { throw null; } + public static Azure.AI.TextAnalytics.MultiCategoryClassifyResult MultiCategoryClassifyResult(string id, Azure.AI.TextAnalytics.TextDocumentStatistics statistics, Azure.AI.TextAnalytics.ClassificationCategoryCollection documentClassificationCollection, System.Collections.Generic.IEnumerable warnings = null) { throw null; } + public static Azure.AI.TextAnalytics.MultiCategoryClassifyResultCollection MultiCategoryClassifyResultCollection(System.Collections.Generic.IEnumerable list, Azure.AI.TextAnalytics.TextDocumentBatchStatistics statistics, string projectName, string deploymentName) { throw null; } public static Azure.AI.TextAnalytics.PiiEntity PiiEntity(string text, string category, string subCategory, double score, int offset, int length) { throw null; } public static Azure.AI.TextAnalytics.PiiEntityCollection PiiEntityCollection(System.Collections.Generic.IEnumerable entities, string redactedText, System.Collections.Generic.IEnumerable warnings = null) { throw null; } public static Azure.AI.TextAnalytics.RecognizeEntitiesActionResult RecognizeEntitiesActionResult(Azure.AI.TextAnalytics.RecognizeEntitiesResultCollection result, System.DateTimeOffset completedOn) { throw null; } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample11_ClassifyCustomCategories.md b/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample11_ClassifyCustomCategories.md index 7f31dfd1ad09..a1e5aaebab69 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample11_ClassifyCustomCategories.md +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample11_ClassifyCustomCategories.md @@ -1,9 +1,9 @@ -# Perform Custom Multiple Categories Classification in Documents -This sample demonstrates how to run a Classify Custom Multiple Categories action in one or more documents. To get started you will need a Text Analytics endpoint and credentials. See [README][README] for links and instructions. +# Perform Custom Multiple Category Classification in Documents +This sample demonstrates how to run a Multi Category Classify action in one or more documents. To get started you will need a Text Analytics endpoint and credentials. See [README][README] for links and instructions. ## Creating a `TextAnalyticsClient` -To create a new `TextAnalyticsClient` to perform a custom category classification on a document, you need a Text Analytics endpoint and credentials. You can use the [DefaultAzureCredential][DefaultAzureCredential] to try a number of common authentication methods optimized for both running as a service and development. In the sample below, however, you'll use a Text Analytics API key credential by creating an `AzureKeyCredential` object, that if needed, will allow you to update the API key without creating a new client. +To create a new `TextAnalyticsClient` to perform a custom multi category classification on a document, you need a Text Analytics endpoint and credentials. You can use the [DefaultAzureCredential][DefaultAzureCredential] to try a number of common authentication methods optimized for both running as a service and development. In the sample below, however, you'll use a Text Analytics API key credential by creating an `AzureKeyCredential` object, that if needed, will allow you to update the API key without creating a new client. You can set `endpoint` and `apiKey` based on an environment variable, a configuration setting, or any way that works for your application. @@ -13,11 +13,11 @@ string apiKey = ""; var client = new TextAnalyticsClient(new Uri(endpoint), new AzureKeyCredential(apiKey)); ``` -## Performing Custom Multiple Categories Classification in one or multiple documents +## Performing Custom Multiple Category Classification in one or multiple documents -To perform Custom Multiple Categories Classification in one or multiple documents, set up an `ClassifyCustomCategoriesAction` and call `StartAnalyzeActionsAsync` on the documents. The result is a Long Running operation of type `AnalyzeActionsOperation` which polls for the results from the API. +To perform Multiple Category Classification in one or multiple documents, set up an `MultiCategoryClassifyAction` and call `StartAnalyzeActionsAsync` on the documents. The result is a Long Running operation of type `AnalyzeActionsOperation` which polls for the results from the API. -```C# Snippet:TextAnalyticsClassifyCustomCategoriesAsync +```C# Snippet:TextAnalyticsMultiCategoryClassifyAsync // Get input document. string document = @"I need a reservation for an indoor restaurant in China. Please don't stop the music. Play music and add it to my playlist."; @@ -28,11 +28,11 @@ var batchInput = new List document }; -var classifyCustomCategoryAction = new ClassifyCustomCategoryAction(TestEnvironment.ProjectName, TestEnvironment.DeploymentName); +var multiCategoryClassifyAction = new MultiCategoryClassifyAction(projectName, deploymentName); TextAnalyticsActions actions = new TextAnalyticsActions() { - ClassifyCustomCategoryActions = new List() { classifyCustomCategoryAction } + MultiCategoryClassifyActions = new List() { multiCategoryClassifyAction } }; // Start analysis process. @@ -43,7 +43,7 @@ await operation.WaitForCompletionAsync(); The returned `AnalyzeActionsOperation` contains general information about the status of the operation. It can be requested while the operation is running or when it has completed. For example: -```C# Snippet:TextAnalyticsClassifyCustomCategoriesOperationStatus +```C# Snippet:TextAnalyticsMultiCategoryClassifyOperationStatus // View operation status. Console.WriteLine($"AnalyzeActions operation has completed"); Console.WriteLine(); @@ -58,13 +58,13 @@ Console.WriteLine(); To view the final results of the long-running operation: -```C# Snippet:TextAnalyticsClassifyCustomCategoriesAsyncViewResults +```C# Snippet:TextAnalyticsMultiCategoryClassifyAsyncViewResults // View operation results. await foreach (AnalyzeActionsResult documentsInPage in operation.Value) { - IReadOnlyCollection classificationResultsCollection = documentsInPage.ClassifyCustomCategoryResults; + IReadOnlyCollection classificationResultsCollection = documentsInPage.MultiCategoryClassifyResults; - foreach (ClassifyCustomCategoryActionResult classificationActionResults in classificationResultsCollection) + foreach (MultiCategoryClassifyActionResult classificationActionResults in classificationResultsCollection) { if (classificationActionResults.HasError) { @@ -74,7 +74,7 @@ await foreach (AnalyzeActionsResult documentsInPage in operation.Value) continue; } - foreach (ClassifyCustomCategoryResult documentResults in classificationActionResults.DocumentsResults) + foreach (MultiCategoryClassifyResult documentResults in classificationActionResults.DocumentsResults) { if (documentResults.HasError) { @@ -84,8 +84,17 @@ await foreach (AnalyzeActionsResult documentsInPage in operation.Value) continue; } - Console.WriteLine($" Class category \"{documentResults.DocumentClassification.Category}\" predicted with a confidence score of {documentResults.DocumentClassification.ConfidenceScore}."); - Console.WriteLine(); + if (documentResults.ClassificationCategories.Count > 0) + { + Console.WriteLine($" The following classes were predicted for this document:"); + + foreach (ClassificationCategory classification in documentResults.ClassificationCategories) + { + Console.WriteLine($" Class category \"{classification.Category}\" predicted with a confidence score of {classification.ConfidenceScore}."); + } + + Console.WriteLine(); + } } } } @@ -93,10 +102,10 @@ await foreach (AnalyzeActionsResult documentsInPage in operation.Value) To see the full example source files, see: -* [Synchronously Classify Custom Multiple Categories](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategories.cs) -* [Asynchronously Classify Custom Multiple Categories](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategoriesAsync.cs) -* [Synchronously Classify Custom Multiple Categories Convenience](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategoriesConvenience.cs) -* [Asynchronously Classify Custom Multiple Categories Convenience](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategoriesConvenienceAsync.cs) +* [Synchronously Multi Category Classify](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassify.cs) +* [Asynchronously Multi Category Classify](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyAsync.cs) +* [Synchronously Multi Category Classify Convenience](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyConvenience.cs) +* [Asynchronously Multi Category Classify Convenience](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyConvenienceAsync.cs) [DefaultAzureCredential]: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/README.md [README]: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/textanalytics/Azure.AI.TextAnalytics/README.md diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/AnalyzeActionsResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/AnalyzeActionsResult.cs index 69084b0ce3e0..92de445064a8 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/AnalyzeActionsResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/AnalyzeActionsResult.cs @@ -18,7 +18,7 @@ internal AnalyzeActionsResult( IReadOnlyCollection analyzeSentimentActionResults, IReadOnlyCollection extractSummaryActionResults, IReadOnlyCollection singleCategoryClassifyActionResults - IReadOnlyCollection classifyCustomCategoriesActionResults + IReadOnlyCollection multiCategoryClassifyActionResults ) { ExtractKeyPhrasesResults = extractKeyPhrasesActionResults; @@ -28,7 +28,7 @@ IReadOnlyCollection classifyCustomCategori AnalyzeSentimentResults = analyzeSentimentActionResults; ExtractSummaryResults = extractSummaryActionResults; SingleCategoryClassifyResults = singleCategoryClassifyActionResults; - ClassifyCustomCategoriesResults = classifyCustomCategoriesActionResults; + MultiCategoryClassifyResults = multiCategoryClassifyActionResults; } /// @@ -69,6 +69,6 @@ IReadOnlyCollection classifyCustomCategori /// /// Determines the collection of . /// - public IReadOnlyCollection ClassifyCustomCategoriesResults { get; } + public IReadOnlyCollection MultiCategoryClassifyResults { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/DocumentClassificationCollection.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassificationCategoryCollection.cs similarity index 61% rename from sdk/textanalytics/Azure.AI.TextAnalytics/src/DocumentClassificationCollection.cs rename to sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassificationCategoryCollection.cs index 53244d33bebd..6789abae4880 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/DocumentClassificationCollection.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassificationCategoryCollection.cs @@ -9,14 +9,14 @@ namespace Azure.AI.TextAnalytics { /// - /// Collection of objects in a document, + /// Collection of objects in a document, /// and warnings encountered while processing the document. /// - [DebuggerTypeProxy(typeof(DocumentClassificationCollectionDebugView))] - public class DocumentClassificationCollection : ReadOnlyCollection + [DebuggerTypeProxy(typeof(ClassificationCategoryCollectionDebugView))] + public class ClassificationCategoryCollection : ReadOnlyCollection { - internal DocumentClassificationCollection(IList documentClassifications, IList warnings) - : base(documentClassifications) + internal ClassificationCategoryCollection(IList classificationCategories, IList warnings) + : base(classificationCategories) { Warnings = new ReadOnlyCollection(warnings); } @@ -27,19 +27,19 @@ internal DocumentClassificationCollection(IList document public IReadOnlyCollection Warnings { get; } /// - /// Debugger Proxy class for . + /// Debugger Proxy class for . /// - internal class DocumentClassificationCollectionDebugView + internal class ClassificationCategoryCollectionDebugView { - private DocumentClassificationCollection BaseCollection { get; } + private ClassificationCategoryCollection BaseCollection { get; } - public DocumentClassificationCollectionDebugView(DocumentClassificationCollection collection) + public ClassificationCategoryCollectionDebugView(ClassificationCategoryCollection collection) { BaseCollection = collection; } [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] - public List Items + public List Items { get { diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassifyCustomCategoriesResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassifyCustomCategoriesResult.cs deleted file mode 100644 index b8d37ec72ce3..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassifyCustomCategoriesResult.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; - -namespace Azure.AI.TextAnalytics -{ - /// - /// The result of the classify custom categories operation on a document, - /// containing the collection of objects - /// predicted for that document. - /// - public class ClassifyCustomCategoriesResult : TextAnalyticsResult - { - private readonly DocumentClassificationCollection _documentClassifications; - internal ClassifyCustomCategoriesResult(string id, TextDocumentStatistics statistics, DocumentClassificationCollection documentClassifications, IReadOnlyCollection warnings) - : base(id, statistics) - { - _documentClassifications = documentClassifications; - Warnings = warnings; - } - - internal ClassifyCustomCategoriesResult(string id, TextAnalyticsError error) : base(id, error) { } - - /// - /// Warnings encountered while processing the document. - /// - public IReadOnlyCollection Warnings { get; } - - /// - /// Gets the collection of objects predicted for the corresponding document. - /// - public DocumentClassificationCollection DocumentClassifications - { - get - { - if (HasError) - { - throw new InvalidOperationException($"Cannot access result for document {Id}, due to error {Error.ErrorCode}: {Error.Message}"); - } - return _documentClassifications; - } - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/DocumentClassification.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/DocumentClassification.cs deleted file mode 100644 index 794cbb90509e..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/DocumentClassification.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.AI.TextAnalytics.Models; - -namespace Azure.AI.TextAnalytics -{ - /// - /// A classification of an input document extracted by the classify custom category - /// operation. The service attributes a confidence score to the predicted category - /// for measuring how confident the model is in the returned prediction. - /// - public readonly struct DocumentClassification - { - internal DocumentClassification(SingleClassificationDocument classification) - { - Category = classification.Classification.Category; - ConfidenceScore = classification.Classification.ConfidenceScore; - } - - internal DocumentClassification(ClassificationResult classification) - { - Category = classification.Category; - ConfidenceScore = classification.ConfidenceScore; - } - - /// - /// Gets the predicted category for the respective document. The possible values - /// of the category string depends on the custom categories set in the Text Analytics - /// service for the targetted project. - /// - public string Category { get; } - - /// - /// Gets the confidence score of the predictive category. This is a value - /// between 0 and 1 that represents the model's confidence in the predicted - /// class, which can be used as an indicator of the probability of correctness. - /// - public double ConfidenceScore { get; } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassifyCustomCategoriesAction.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/MultiCategoryClassifyAction.cs similarity index 78% rename from sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassifyCustomCategoriesAction.cs rename to sdk/textanalytics/Azure.AI.TextAnalytics/src/MultiCategoryClassifyAction.cs index 17cc11922d0f..6801acedef05 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassifyCustomCategoriesAction.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/MultiCategoryClassifyAction.cs @@ -5,20 +5,20 @@ namespace Azure.AI.TextAnalytics { /// /// Configurations that allow callers to specify details about how to execute - /// a Classify Custom Categories action on a set of documents. This corresponds + /// a Multi Category Classify action on a set of documents. This corresponds /// to a Multi Classification task in the text analytics service. /// For example, the target project and deployment names are required /// for a successful custom classification action. /// - public class ClassifyCustomCategoriesAction + public class MultiCategoryClassifyAction { /// - /// Initializes a new instance of the + /// Initializes a new instance of the /// class which allows callers to specify details about how to execute - /// a Classify Custom Categories action on a set of documents. + /// a Multi Category Classify action on a set of documents. /// Sets the and properties. /// - public ClassifyCustomCategoriesAction(string projectName, string deploymentName) + public MultiCategoryClassifyAction(string projectName, string deploymentName) { DeploymentName = deploymentName; ProjectName = projectName; @@ -27,14 +27,14 @@ public ClassifyCustomCategoriesAction(string projectName, string deploymentName) /// /// Gets the value of the property corresponding to the name of the /// target project for this action. This property is set when calling - /// the constructor. + /// the constructor. /// public string ProjectName { get; } /// /// Gets the value of the property corresponding to the name of the /// deployment for this action. This property is set when calling - /// the constructor. + /// the constructor. /// public string DeploymentName { get; } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassifyCustomCategoriesActionResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/MultiCategoryClassifyActionResult.cs similarity index 59% rename from sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassifyCustomCategoriesActionResult.cs rename to sdk/textanalytics/Azure.AI.TextAnalytics/src/MultiCategoryClassifyActionResult.cs index 9c60c601288d..b63a9d20d796 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassifyCustomCategoriesActionResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/MultiCategoryClassifyActionResult.cs @@ -7,16 +7,16 @@ namespace Azure.AI.TextAnalytics { /// - /// The result of the execution of an on the input documents. + /// The result of the execution of an on the input documents. /// - public class ClassifyCustomCategoriesActionResult : TextAnalyticsActionResult + public class MultiCategoryClassifyActionResult : TextAnalyticsActionResult { - private readonly ClassifyCustomCategoriesResultCollection _documentsResults; + private readonly MultiCategoryClassifyResultCollection _documentsResults; /// /// Successful action. /// - internal ClassifyCustomCategoriesActionResult(ClassifyCustomCategoriesResultCollection result, DateTimeOffset completedOn) + internal MultiCategoryClassifyActionResult(MultiCategoryClassifyResultCollection result, DateTimeOffset completedOn) : base(completedOn) { _documentsResults = result; @@ -25,13 +25,13 @@ internal ClassifyCustomCategoriesActionResult(ClassifyCustomCategoriesResultColl /// /// Action with an error. /// - internal ClassifyCustomCategoriesActionResult(DateTimeOffset completedOn, TextAnalyticsErrorInternal error) + internal MultiCategoryClassifyActionResult(DateTimeOffset completedOn, TextAnalyticsErrorInternal error) : base(completedOn, error) { } /// - /// Gets the result of the execution of an per each input document. + /// Gets the result of the execution of an per each input document. /// - public ClassifyCustomCategoriesResultCollection DocumentsResults + public MultiCategoryClassifyResultCollection DocumentsResults { get { diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/MultiCategoryClassifyResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/MultiCategoryClassifyResult.cs new file mode 100644 index 000000000000..566e26ec4ad8 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/MultiCategoryClassifyResult.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; + +namespace Azure.AI.TextAnalytics +{ + /// + /// The result of the Multi Category Classify operation on a document, + /// containing the collection of objects + /// predicted for that document. + /// + public class MultiCategoryClassifyResult : TextAnalyticsResult + { + private readonly ClassificationCategoryCollection _classificationCategories; + internal MultiCategoryClassifyResult(string id, TextDocumentStatistics statistics, ClassificationCategoryCollection classificationCategories, IReadOnlyCollection warnings) + : base(id, statistics) + { + _classificationCategories = classificationCategories; + Warnings = warnings; + } + + internal MultiCategoryClassifyResult(string id, TextAnalyticsError error) : base(id, error) { } + + /// + /// Warnings encountered while processing the document. + /// + public IReadOnlyCollection Warnings { get; } + + /// + /// Gets the collection of objects predicted for the corresponding document. + /// + public ClassificationCategoryCollection ClassificationCategories + { + get + { + if (HasError) + { + throw new InvalidOperationException($"Cannot access result for document {Id}, due to error {Error.ErrorCode}: {Error.Message}"); + } + return _classificationCategories; + } + } + } +} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassifyCustomCategoriesResultCollection.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/MultiCategoryClassifyResultCollection.cs similarity index 73% rename from sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassifyCustomCategoriesResultCollection.cs rename to sdk/textanalytics/Azure.AI.TextAnalytics/src/MultiCategoryClassifyResultCollection.cs index 04ff297fce07..ccfa0718f423 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/ClassifyCustomCategoriesResultCollection.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/MultiCategoryClassifyResultCollection.cs @@ -9,13 +9,13 @@ namespace Azure.AI.TextAnalytics { /// - /// Collection of objects corresponding + /// Collection of objects corresponding /// to a batch of documents, and information about the batch operation. /// - [DebuggerTypeProxy(typeof(ClassifyCustomCategoriesResultCollectionDebugView))] - public class ClassifyCustomCategoriesResultCollection : ReadOnlyCollection + [DebuggerTypeProxy(typeof(MultiCategoryClassifyResultCollectionDebugView))] + public class MultiCategoryClassifyResultCollection : ReadOnlyCollection { - internal ClassifyCustomCategoriesResultCollection(IList list, TextDocumentBatchStatistics statistics, + internal MultiCategoryClassifyResultCollection(IList list, TextDocumentBatchStatistics statistics, string projectName, string deploymentName) : base(list) { Statistics = statistics; @@ -33,7 +33,7 @@ internal ClassifyCustomCategoriesResultCollection(IList /// Gets the value of the property corresponding to the name of the /// target project that produced these results. This should be the same - /// as the project name set when creating the + /// as the project name set when creating the /// object used to start the operation. /// public string ProjectName { get; } @@ -41,25 +41,25 @@ internal ClassifyCustomCategoriesResultCollection(IList /// Gets the value of the property corresponding to the deployment name /// of the project that produced these results. This should be the same - /// as the deployment name set when creating the + /// as the deployment name set when creating the /// object used to start the operation. /// public string DeploymentName { get; } /// - /// Debugger Proxy class for . + /// Debugger Proxy class for . /// - internal class ClassifyCustomCategoriesResultCollectionDebugView + internal class MultiCategoryClassifyResultCollectionDebugView { - private ClassifyCustomCategoriesResultCollection BaseCollection { get; } + private MultiCategoryClassifyResultCollection BaseCollection { get; } - public ClassifyCustomCategoriesResultCollectionDebugView(ClassifyCustomCategoriesResultCollection collection) + public MultiCategoryClassifyResultCollectionDebugView(MultiCategoryClassifyResultCollection collection) { BaseCollection = collection; } [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] - public List Items + public List Items { get { diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsActions.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsActions.cs index c1ae4fb5a95f..7d8bb0863c6c 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsActions.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsActions.cs @@ -71,12 +71,12 @@ public TextAnalyticsActions() public IReadOnlyCollection SingleCategoryClassifyActions { get; set; } /// - /// The set of that will get executed on the input documents. - /// Note that currently only one is supported. + /// The set of that will get executed on the input documents. + /// Note that currently only one is supported. /// /// /// This property only applies for and up. /// - public IReadOnlyCollection ClassifyCustomCategoriesActions { get; set; } + public IReadOnlyCollection MultiCategoryClassifyActions { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsClient.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsClient.cs index 9e06636f98ed..7dd19a6f1c62 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsClient.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsClient.cs @@ -2478,9 +2478,9 @@ private static JobManifestTasks CreateTasks(TextAnalyticsActions actions) { tasks.CustomSingleClassificationTasks = Transforms.ConvertFromSingleCategoryClassifyActionsToTasks(actions.SingleCategoryClassifyActions); } - if (actions.ClassifyCustomCategoriesActions != null) + if (actions.MultiCategoryClassifyActions != null) { - tasks.CustomMultiClassificationTasks = Transforms.ConvertFromClassifyCustomCategoriesActionsToTasks(actions.ClassifyCustomCategoriesActions); + tasks.CustomMultiClassificationTasks = Transforms.ConvertFromMultiCategoryClassifyActionsToTasks(actions.MultiCategoryClassifyActions); } return tasks; } @@ -2494,7 +2494,7 @@ private static void ValidateActions(TextAnalyticsActions actions) actions.AnalyzeSentimentActions?.Count > 1 || actions.ExtractSummaryActions?.Count > 1 || actions.SingleCategoryClassifyActions?.Count > 1 || - actions.ClassifyCustomCategoriesActions?.Count > 1 + actions.MultiCategoryClassifyActions?.Count > 1 ) { throw new ArgumentException("Multiple of the same action is not currently supported."); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsModelFactory.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsModelFactory.cs index 480e65492c93..d74e3a6718c1 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsModelFactory.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsModelFactory.cs @@ -518,52 +518,52 @@ public static SummarySentenceCollection SummarySentenceCollection(IEnumerable - /// Initializes a new instance of for mocking purposes. + /// Initializes a new instance of for mocking purposes. /// /// Sets the property. /// Sets the property. - /// Sets the of . - /// Sets the collection of . - /// A new instance of for mocking purposes. - public static ClassifyCustomCategoriesResult ClassifyCustomCategoriesResult(string id, TextDocumentStatistics statistics, DocumentClassificationCollection documentClassificationCollection, IEnumerable warnings = default) + /// Sets the of . + /// Sets the collection of . + /// A new instance of for mocking purposes. + public static MultiCategoryClassifyResult MultiCategoryClassifyResult(string id, TextDocumentStatistics statistics, ClassificationCategoryCollection documentClassificationCollection, IEnumerable warnings = default) { - return new ClassifyCustomCategoriesResult(id, statistics, documentClassificationCollection, warnings.ToList()); + return new MultiCategoryClassifyResult(id, statistics, documentClassificationCollection, warnings.ToList()); } /// - /// Initializes a new instance of for mocking purposes. + /// Initializes a new instance of for mocking purposes. /// /// Sets the property. /// Sets the property. /// A new instance of for mocking purposes. - public static ClassifyCustomCategoriesResult ClassifyCustomCategoriesResult(string id, TextAnalyticsError error) + public static MultiCategoryClassifyResult MultiCategoryClassifyResult(string id, TextAnalyticsError error) { - return new ClassifyCustomCategoriesResult(id, error); + return new MultiCategoryClassifyResult(id, error); } /// - /// Initializes a new instance of for mocking purposes. + /// Initializes a new instance of for mocking purposes. /// - /// Sets the collection of . - /// Sets the property. - /// Sets the property. - /// Sets the property. - /// A new instance of for mocking purposes. - public static ClassifyCustomCategoriesResultCollection ClassifyCustomCategoriesResultCollection(IEnumerable list, TextDocumentBatchStatistics statistics, string projectName, string deploymentName) + /// Sets the collection of . + /// Sets the property. + /// Sets the property. + /// Sets the property. + /// A new instance of for mocking purposes. + public static MultiCategoryClassifyResultCollection MultiCategoryClassifyResultCollection(IEnumerable list, TextDocumentBatchStatistics statistics, string projectName, string deploymentName) { - return new ClassifyCustomCategoriesResultCollection(list.ToList(), statistics, projectName, deploymentName); + return new MultiCategoryClassifyResultCollection(list.ToList(), statistics, projectName, deploymentName); } /// - /// Initializes a new instance of for mocking purposes. + /// Initializes a new instance of for mocking purposes. /// - /// Sets the collection of . - /// Sets the property. - /// A new instance of for mocking purposes. - public static DocumentClassificationCollection DocumentClassificationCollection(IEnumerable classificationList, IEnumerable warnings) + /// Sets the collection of . + /// Sets the property. + /// A new instance of for mocking purposes. + public static ClassificationCategoryCollection ClassificationCategoryCollection(IEnumerable classificationList, IEnumerable warnings) { - return new DocumentClassificationCollection(classificationList.ToList(), warnings.ToList()); + return new ClassificationCategoryCollection(classificationList.ToList(), warnings.ToList()); } #endregion @@ -776,7 +776,7 @@ public static AnalyzeActionsResult AnalyzeActionsResult( analyzeSentimentActionsResults.ToList(), new List(), new List(), - new List() + new List() ); } @@ -790,7 +790,7 @@ public static AnalyzeActionsResult AnalyzeActionsResult( /// Sets the collection of . /// Sets the collection of . /// Sets the collection of . - /// Sets the collection of . + /// Sets the collection of . /// A new instance of for mocking purposes. public static AnalyzeActionsResult AnalyzeActionsResult( IEnumerable extractKeyPhrasesActionResults, @@ -800,7 +800,7 @@ public static AnalyzeActionsResult AnalyzeActionsResult( IEnumerable analyzeSentimentActionResults, IEnumerable extractSummaryActionResults, IEnumerable singleCategoryClassifyActionResults, - IEnumerable classifyCustomCategoriesActionResults + IEnumerable multiCategoryClassifyActionResults ) { return new AnalyzeActionsResult( @@ -811,7 +811,7 @@ IEnumerable classifyCustomCategoriesAction analyzeSentimentActionResults.ToList(), extractSummaryActionResults.ToList(), singleCategoryClassifyActionResults.ToList(), - classifyCustomCategoriesActionResults.ToList()); + multiCategoryClassifyActionResults.ToList() ); } @@ -872,31 +872,31 @@ public static ExtractSummaryActionResult ExtractSummaryActionResult( } /// - /// Initializes a new instance of for mocking purposes. + /// Initializes a new instance of for mocking purposes. /// - /// Sets the property. + /// Sets the property. /// Sets the property. - /// A new instance of for mocking purposes. - public static ClassifyCustomCategoriesActionResult ClassifyCustomCategoriesActionResult( - ClassifyCustomCategoriesResultCollection result, + /// A new instance of for mocking purposes. + public static MultiCategoryClassifyActionResult MultiCategoryClassifyActionResult( + MultiCategoryClassifyResultCollection result, DateTimeOffset completedOn) { - return new ClassifyCustomCategoriesActionResult(result, completedOn); + return new MultiCategoryClassifyActionResult(result, completedOn); } /// - /// Initializes a new instance of for mocking purposes. + /// Initializes a new instance of for mocking purposes. /// /// Sets the property. /// Sets the property. /// Sets the property. - /// A new instance of for mocking purposes. - public static ClassifyCustomCategoriesActionResult ClassifyCustomCategoryActionResult( + /// A new instance of for mocking purposes. + public static MultiCategoryClassifyActionResult MultiCategoryClassifyActionResult( DateTimeOffset completedOn, string code, string message) { - return new ClassifyCustomCategoriesActionResult(completedOn, new TextAnalyticsErrorInternal(code, message)); + return new MultiCategoryClassifyActionResult(completedOn, new TextAnalyticsErrorInternal(code, message)); } /// @@ -926,7 +926,7 @@ public static SingleCategoryClassifyActionResult SingleCategoryClassifyActionRes { return new SingleCategoryClassifyActionResult(completedOn, new TextAnalyticsErrorInternal(code, message)); } - + /// /// Initializes a new instance of for mocking purposes. /// diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Transforms.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Transforms.cs index 5b29aaf43a59..4e483fb27a4a 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Transforms.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Transforms.cs @@ -350,35 +350,35 @@ internal static ExtractSummaryResultCollection ConvertToExtractSummaryResultColl } #endregion - - #region Classify Custom Categories - internal static List ConvertToDocumentClassificationList(List classifications) - => classifications.Select((classification) => new DocumentClassification(classification)).ToList(); - internal static DocumentClassificationCollection ConvertToDocumentClassificationCollection(MultiClassificationDocument extractedClassificationsDocuments) + #region Multi Category Classify + internal static List ConvertToClassificationCategoryList(List classifications) + => classifications.Select((classification) => new ClassificationCategory(classification)).ToList(); + + internal static ClassificationCategoryCollection ConvertToClassificationCategoryCollection(MultiClassificationDocument extractedClassificationsDocuments) { - return new DocumentClassificationCollection(ConvertToDocumentClassificationList(extractedClassificationsDocuments.Classifications.ToList()), ConvertToWarnings(extractedClassificationsDocuments.Warnings)); + return new ClassificationCategoryCollection(ConvertToClassificationCategoryList(extractedClassificationsDocuments.Classifications.ToList()), ConvertToWarnings(extractedClassificationsDocuments.Warnings)); } - internal static ClassifyCustomCategoriesResultCollection ConvertToClassifyCustomCategoryResultCollection(CustomMultiClassificationResult results, IDictionary idToIndexMap) + internal static MultiCategoryClassifyResultCollection ConvertToMultiCategoryClassifyResultCollection(CustomMultiClassificationResult results, IDictionary idToIndexMap) { - var classifiedCustomCategoryResults = new List(); + var classifiedCustomCategoryResults = new List(); //Read errors foreach (DocumentError error in results.Errors) { - classifiedCustomCategoryResults.Add(new ClassifyCustomCategoriesResult(error.Id, ConvertToError(error.Error))); + classifiedCustomCategoryResults.Add(new MultiCategoryClassifyResult(error.Id, ConvertToError(error.Error))); } //Read sentiments foreach (MultiClassificationDocument classificationsDocument in results.Documents) { - classifiedCustomCategoryResults.Add(new ClassifyCustomCategoriesResult(classificationsDocument.Id, classificationsDocument.Statistics ?? default, ConvertToDocumentClassificationCollection(classificationsDocument), ConvertToWarnings(classificationsDocument.Warnings))); + classifiedCustomCategoryResults.Add(new MultiCategoryClassifyResult(classificationsDocument.Id, classificationsDocument.Statistics ?? default, ConvertToClassificationCategoryCollection(classificationsDocument), ConvertToWarnings(classificationsDocument.Warnings))); } classifiedCustomCategoryResults = SortHeterogeneousCollection(classifiedCustomCategoryResults, idToIndexMap); - return new ClassifyCustomCategoriesResultCollection(classifiedCustomCategoryResults, results.Statistics, results.ProjectName, results.DeploymentName); + return new MultiCategoryClassifyResultCollection(classifiedCustomCategoryResults, results.Statistics, results.ProjectName, results.DeploymentName); } #endregion @@ -494,6 +494,7 @@ internal static ExtractiveSummarizationTask ConvertToExtractiveSummarizationTask } }; } + internal static CustomSingleClassificationTask ConvertToCustomSingleClassificationTask(SingleCategoryClassifyAction action) { return new CustomSingleClassificationTask() @@ -505,7 +506,7 @@ internal static CustomSingleClassificationTask ConvertToCustomSingleClassificati }; } - internal static CustomMultiClassificationTask ConvertToCustomMultiClassificationTask(ClassifyCustomCategoriesAction action) + internal static CustomMultiClassificationTask ConvertToCustomMultiClassificationTask(MultiCategoryClassifyAction action) { return new CustomMultiClassificationTask() { @@ -587,11 +588,11 @@ internal static IList ConvertFromExtractSummaryActi return list; } - internal static IList ConvertFromClassifyCustomCategoriesActionsToTasks(IReadOnlyCollection ClassifyCustomCategoriesActions) + internal static IList ConvertFromMultiCategoryClassifyActionsToTasks(IReadOnlyCollection MultiCategoryClassifyActions) { List list = new List(); - foreach (ClassifyCustomCategoriesAction action in ClassifyCustomCategoriesActions) + foreach (MultiCategoryClassifyAction action in MultiCategoryClassifyActions) { list.Add(ConvertToCustomMultiClassificationTask(action)); } @@ -641,7 +642,7 @@ internal static AnalyzeActionsResult ConvertToAnalyzeActionsResult(AnalyzeJobSta IDictionary analyzeSentimentErrors = new Dictionary(); IDictionary extractSummaryErrors = new Dictionary(); IDictionary singleCategoryClassifyErrors = new Dictionary(); - IDictionary classifyCustomCategoriesErrors = new Dictionary(); + IDictionary multiCategoryClassifyErrors = new Dictionary(); if (jobState.Errors.Any()) { @@ -684,7 +685,7 @@ internal static AnalyzeActionsResult ConvertToAnalyzeActionsResult(AnalyzeJobSta } else if ("customMultiClassificationTasks".Equals(taskName)) { - classifyCustomCategoriesErrors.Add(taskIndex, error); + multiCategoryClassifyErrors.Add(taskIndex, error); } else { @@ -701,13 +702,13 @@ internal static AnalyzeActionsResult ConvertToAnalyzeActionsResult(AnalyzeJobSta ConvertToAnalyzeSentimentActionsResults(jobState, map, analyzeSentimentErrors), ConvertToExtractSummaryActionsResults(jobState, map, extractSummaryErrors), ConvertToSingleCategoryClassifyResults(jobState, map, singleCategoryClassifyErrors) - ConvertToClassifyCustomCategoriesActionsResults(jobState, map, extractSummaryErrors) + ConvertToMultiCategoryClassifyActionsResults(jobState, map, multiCategoryClassifyErrors)); ); } - private static IReadOnlyCollection ConvertToClassifyCustomCategoriesActionsResults(AnalyzeJobState jobState, IDictionary idToIndexMap, IDictionary tasksErrors) + private static IReadOnlyCollection ConvertToMultiCategoryClassifyActionsResults(AnalyzeJobState jobState, IDictionary idToIndexMap, IDictionary tasksErrors) { - var collection = new List(); + var collection = new List(); int index = 0; foreach (CustomMultiClassificationTasksItem task in jobState.Tasks.CustomMultiClassificationTasks) { @@ -715,11 +716,11 @@ private static IReadOnlyCollection Convert if (taskError != null) { - collection.Add(new ClassifyCustomCategoriesActionResult(task.LastUpdateDateTime, taskError)); + collection.Add(new MultiCategoryClassifyActionResult(task.LastUpdateDateTime, taskError)); } else { - collection.Add(new ClassifyCustomCategoriesActionResult(ConvertToClassifyCustomCategoryResultCollection(task.Results, idToIndexMap), task.LastUpdateDateTime)); + collection.Add(new MultiCategoryClassifyActionResult(ConvertToMultiCategoryClassifyResultCollection(task.Results, idToIndexMap), task.LastUpdateDateTime)); } index++; } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/AnalyzeOperationMockTests.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/AnalyzeOperationMockTests.cs index 4bcc32145d4f..c0fd21c9e6c0 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/AnalyzeOperationMockTests.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/AnalyzeOperationMockTests.cs @@ -776,10 +776,10 @@ public void AnalyzeOperationExtractSummaryWithTwoActions() #endregion Extract summary - #region Classify Custom Categories + #region Multi Category Classify [Test] - public async Task AnalyzeOperationClassifyCustomCategoriesWithDisableServiceLogs() + public async Task AnalyzeOperationMultiCategoryClassifyWithDisableServiceLogs() { var mockResponse = new MockResponse(202); mockResponse.AddHeader(new HttpHeader("Operation-Location", "something/jobs/2a96a91f-7edf-4931-a880-3fdee1d56f15")); @@ -792,14 +792,14 @@ public async Task AnalyzeOperationClassifyCustomCategoriesWithDisableServiceLogs "Elon Musk is the CEO of SpaceX and Tesla." }; - var actions = new ClassifyCustomCategoriesAction(FakeProjectName, FakeDeploymentName) + var actions = new MultiCategoryClassifyAction(FakeProjectName, FakeDeploymentName) { DisableServiceLogs = true }; TextAnalyticsActions batchActions = new TextAnalyticsActions() { - ClassifyCustomCategoriesActions = new List() { actions }, + MultiCategoryClassifyActions = new List() { actions }, }; await client.StartAnalyzeActionsAsync(documents, batchActions); @@ -812,7 +812,7 @@ public async Task AnalyzeOperationClassifyCustomCategoriesWithDisableServiceLogs } [Test] - public void AnalyzeOperationClassifyCustomCategoryWithTwoActions() + public void AnalyzeOperationMultiCategoryClassifyWithTwoActions() { var mockResponse = new MockResponse(202); mockResponse.AddHeader(new HttpHeader("Operation-Location", "something/jobs/2a96a91f-7edf-4931-a880-3fdee1d56f15")); @@ -827,10 +827,10 @@ public void AnalyzeOperationClassifyCustomCategoryWithTwoActions() TextAnalyticsActions batchActions = new() { - ClassifyCustomCategoriesActions = new List() + MultiCategoryClassifyActions = new List() { - new ClassifyCustomCategoriesAction(FakeProjectName, FakeDeploymentName), - new ClassifyCustomCategoriesAction(FakeProjectName, FakeDeploymentName) + new MultiCategoryClassifyAction(FakeProjectName, FakeDeploymentName), + new MultiCategoryClassifyAction(FakeProjectName, FakeDeploymentName) { DisableServiceLogs = true } @@ -1049,7 +1049,7 @@ public async Task AnalyzeOperationWithActionsError() AnalyzeSentimentActions = new List() { new AnalyzeSentimentAction() }, ExtractSummaryActions = new List() { new ExtractSummaryAction() }, SingleCategoryClassifyActions = new List { new SingleCategoryClassifyAction(FakeProjectName, FakeDeploymentName)}, - ClassifyCustomCategoriesActions = new List() { new ClassifyCustomCategoriesAction(FakeProjectName, FakeDeploymentName) }, + MultiCategoryClassifyActions = new List() { new MultiCategoryClassifyAction(FakeProjectName, FakeDeploymentName) }, DisplayName = "AnalyzeOperationBatchWithErrorTest" }; @@ -1071,7 +1071,7 @@ public async Task AnalyzeOperationWithActionsError() AnalyzeSentimentActionResult analyzeSentimentActionsResults = resultCollection.AnalyzeSentimentResults.FirstOrDefault(); ExtractSummaryActionResult extractSummaryActionsResults = resultCollection.ExtractSummaryResults.FirstOrDefault(); SingleCategoryClassifyActionResult singleCategoryClassifyActionResult = resultCollection.SingleCategoryClassifyResults.FirstOrDefault(); - ClassifyCustomCategoriesActionResult classifyCustomCategoriesActionResult = resultCollection.ClassifyCustomCategoriesResults.FirstOrDefault(); + MultiCategoryClassifyActionResult multiCategoryClassifyActionResult = resultCollection.MultiCategoryClassifyResults.FirstOrDefault(); Assert.IsTrue(entitiesActionsResults.HasError); Assert.Throws(() => entitiesActionsResults.DocumentsResults.GetType()); @@ -1094,8 +1094,8 @@ public async Task AnalyzeOperationWithActionsError() Assert.IsTrue(singleCategoryClassifyActionResult.HasError); Assert.Throws(() => singleCategoryClassifyActionResult.DocumentsResults.GetType()); - Assert.IsTrue(classifyCustomCategoriesActionResult.HasError); - Assert.Throws(() => classifyCustomCategoriesActionResult.DocumentsResults.GetType()); + Assert.IsTrue(multiCategoryClassifyActionResult.HasError); + Assert.Throws(() => multiCategoryClassifyActionResult.DocumentsResults.GetType()); } [Test] diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/AnalyzeOperationTests.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/AnalyzeOperationTests.cs index 134a0e9dc6b2..3ec5a33cd82c 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/AnalyzeOperationTests.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/AnalyzeOperationTests.cs @@ -84,7 +84,7 @@ public async Task AnalyzeOperationTest() IReadOnlyCollection analyzeSentimentActionsResults = resultCollection.AnalyzeSentimentResults; IReadOnlyCollection extractSummaryActionsResults = resultCollection.ExtractSummaryResults; IReadOnlyCollection singleCategoryClassifyResults = resultCollection.SingleCategoryClassifyResults; - IReadOnlyCollection classifyCustomCategoriesResults = resultCollection.ClassifyCustomCategoriesResults; + IReadOnlyCollection multiCategoryClassifyResults = resultCollection.MultiCategoryClassifyResults; Assert.IsNotNull(keyPhrasesActionsResults); Assert.IsNotNull(entitiesActionsResults); @@ -93,7 +93,7 @@ public async Task AnalyzeOperationTest() Assert.IsNotNull(analyzeSentimentActionsResults); Assert.IsNotNull(extractSummaryActionsResults); Assert.IsNotNull(singleCategoryClassifyResults); - Assert.IsNotNull(classifyCustomCategoriesResults); + Assert.IsNotNull(multiCategoryClassifyResults); var keyPhrasesListId1 = new List { "CEO", "SpaceX", "Elon Musk", "Tesla" }; var keyPhrasesListId2 = new List { "Tesla stock" }; diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/ClassifyCustomCategoriesTests.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/MultiCategoryClassifyTests.cs similarity index 51% rename from sdk/textanalytics/Azure.AI.TextAnalytics/tests/ClassifyCustomCategoriesTests.cs rename to sdk/textanalytics/Azure.AI.TextAnalytics/tests/MultiCategoryClassifyTests.cs index 393dc182b43d..d4f4acae5e69 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/ClassifyCustomCategoriesTests.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/MultiCategoryClassifyTests.cs @@ -10,62 +10,62 @@ namespace Azure.AI.TextAnalytics.Tests { [ServiceVersion(Min = TextAnalyticsClientOptions.ServiceVersion.V3_2_Preview_2)] - public class ClassifyCustomCategoriesTests : TextAnalyticsClientLiveTestBase + public class MultiCategoryClassifyTests : TextAnalyticsClientLiveTestBase { - public ClassifyCustomCategoriesTests(bool isAsync, TextAnalyticsClientOptions.ServiceVersion serviceVersion) + public MultiCategoryClassifyTests(bool isAsync, TextAnalyticsClientOptions.ServiceVersion serviceVersion) : base(isAsync, serviceVersion) { } - private const string ClassifyCustomCategoriesDocument1 = + private const string MultiCategoryClassifyDocument1 = "I need a reservation for an indoor restaurant in China. Please don't stop the music. Play music and add it to my playlist"; - private const string ClassifyCustomCategoriesDocument2 = + private const string MultiCategoryClassifyDocument2 = "David Schmidt, senior vice president--Food Safety, International Food Information Council (IFIC), Washington, D.C., discussed the physical activity component."; - private static readonly List s_classifyCustomCategoriesBatchConvenienceDocuments = new List + private static readonly List s_multiCategoryClassifyBatchConvenienceDocuments = new List { - ClassifyCustomCategoriesDocument1, - ClassifyCustomCategoriesDocument2 + MultiCategoryClassifyDocument1, + MultiCategoryClassifyDocument2 }; - private static List s_classifyCustomCategoriesBatchDocuments = new List + private static List s_multiCategoryClassifyBatchDocuments = new List { - new TextDocumentInput("1", ClassifyCustomCategoriesDocument1) + new TextDocumentInput("1", MultiCategoryClassifyDocument1) { Language = "en", }, - new TextDocumentInput("2", ClassifyCustomCategoriesDocument2) + new TextDocumentInput("2", MultiCategoryClassifyDocument2) { Language = "en", } }; [RecordedTest] - public async Task ClassifyCustomCategoriesWithDisableServiceLogs() + public async Task MultiCategoryClassifyWithDisableServiceLogs() { TextAnalyticsClient client = GetClient(); TextAnalyticsActions batchActions = new TextAnalyticsActions() { - ClassifyCustomCategoriesActions = new List() { new ClassifyCustomCategoriesAction(TestEnvironment.MultiCategoriesProjectName, TestEnvironment.MultiCategoriesDeploymentName) { DisableServiceLogs = true } } + MultiCategoryClassifyActions = new List() { new MultiCategoryClassifyAction(TestEnvironment.MultiClassificationProjectName, TestEnvironment.MultiClassificationDeploymentName) { DisableServiceLogs = true } } }; - AnalyzeActionsOperation operation = await client.StartAnalyzeActionsAsync(s_classifyCustomCategoriesBatchConvenienceDocuments, batchActions); + AnalyzeActionsOperation operation = await client.StartAnalyzeActionsAsync(s_multiCategoryClassifyBatchConvenienceDocuments, batchActions); await operation.WaitForCompletionAsync(); // Take the first page AnalyzeActionsResult resultCollection = operation.Value.ToEnumerableAsync().Result.FirstOrDefault(); - IReadOnlyCollection classifyCustomCategoriesActionsResults = resultCollection.ClassifyCustomCategoriesResults; + IReadOnlyCollection multiCategoryClassifyActionsResults = resultCollection.MultiCategoryClassifyResults; - Assert.IsNotNull(classifyCustomCategoriesActionsResults); - Assert.AreEqual(2, classifyCustomCategoriesActionsResults.FirstOrDefault().DocumentsResults.Count); + Assert.IsNotNull(multiCategoryClassifyActionsResults); + Assert.AreEqual(2, multiCategoryClassifyActionsResults.FirstOrDefault().DocumentsResults.Count); } [RecordedTest] - public async Task ClassifyCustomCategoriesBatchWithErrorTest() + public async Task MultiCategoryClassifyBatchWithErrorTest() { TextAnalyticsClient client = GetClient(); @@ -76,9 +76,9 @@ public async Task ClassifyCustomCategoriesBatchWithErrorTest() }; TextAnalyticsActions batchActions = new TextAnalyticsActions() { - ClassifyCustomCategoriesActions = new List() + MultiCategoryClassifyActions = new List() { - new ClassifyCustomCategoriesAction(TestEnvironment.MultiCategoriesProjectName, TestEnvironment.MultiCategoriesDeploymentName) + new MultiCategoryClassifyAction(TestEnvironment.MultiClassificationProjectName, TestEnvironment.MultiClassificationDeploymentName) } }; @@ -88,52 +88,52 @@ public async Task ClassifyCustomCategoriesBatchWithErrorTest() // Take the first page AnalyzeActionsResult resultCollection = operation.Value.ToEnumerableAsync().Result.FirstOrDefault(); - List classifyCustomCategoriesActions = resultCollection.ClassifyCustomCategoriesResults.ToList(); + List multiCategoryClassifyActions = resultCollection.MultiCategoryClassifyResults.ToList(); - Assert.AreEqual(1, classifyCustomCategoriesActions.Count); + Assert.AreEqual(1, multiCategoryClassifyActions.Count); - ClassifyCustomCategoriesResultCollection documentsResults = classifyCustomCategoriesActions[0].DocumentsResults; + MultiCategoryClassifyResultCollection documentsResults = multiCategoryClassifyActions[0].DocumentsResults; Assert.IsFalse(documentsResults[0].HasError); Assert.IsTrue(documentsResults[1].HasError); Assert.AreEqual(TextAnalyticsErrorCode.InvalidDocument, documentsResults[1].Error.ErrorCode.ToString()); } [RecordedTest] - public async Task ClassifyCustomCategoriesBatchConvenienceTest() + public async Task MultiCategoryClassifyBatchConvenienceTest() { TextAnalyticsClient client = GetClient(); TextAnalyticsActions batchActions = new TextAnalyticsActions() { - ClassifyCustomCategoriesActions = new List() + MultiCategoryClassifyActions = new List() { - new ClassifyCustomCategoriesAction(TestEnvironment.MultiCategoriesProjectName, TestEnvironment.MultiCategoriesDeploymentName) + new MultiCategoryClassifyAction(TestEnvironment.MultiClassificationProjectName, TestEnvironment.MultiClassificationDeploymentName) } }; - AnalyzeActionsOperation operation = await client.StartAnalyzeActionsAsync(s_classifyCustomCategoriesBatchConvenienceDocuments, batchActions); + AnalyzeActionsOperation operation = await client.StartAnalyzeActionsAsync(s_multiCategoryClassifyBatchConvenienceDocuments, batchActions); await operation.WaitForCompletionAsync(); // Take the first page AnalyzeActionsResult resultCollection = operation.Value.ToEnumerableAsync().Result.FirstOrDefault(); - IReadOnlyCollection classifyCustomCategoriesActionsResults = resultCollection.ClassifyCustomCategoriesResults; - ClassifyCustomCategoriesResultCollection classifyCustomCategoriesResults = classifyCustomCategoriesActionsResults.FirstOrDefault().DocumentsResults; + IReadOnlyCollection multiCategoryClassifyActionsResults = resultCollection.MultiCategoryClassifyResults; + MultiCategoryClassifyResultCollection multiCategoryClassifyResults = multiCategoryClassifyActionsResults.FirstOrDefault().DocumentsResults; - ValidateSummaryBatchResult(classifyCustomCategoriesResults); + ValidateSummaryBatchResult(multiCategoryClassifyResults); } [RecordedTest] - public async Task ClassifyCustomCategoriesBatchConvenienceWithStatisticsTest() + public async Task MultiCategoryClassifyBatchConvenienceWithStatisticsTest() { TextAnalyticsClient client = GetClient(); TextAnalyticsActions batchActions = new TextAnalyticsActions() { - ClassifyCustomCategoriesActions = new List() + MultiCategoryClassifyActions = new List() { - new ClassifyCustomCategoriesAction(TestEnvironment.MultiCategoriesProjectName, TestEnvironment.MultiCategoriesDeploymentName) + new MultiCategoryClassifyAction(TestEnvironment.MultiClassificationProjectName, TestEnvironment.MultiClassificationDeploymentName) } }; @@ -142,55 +142,55 @@ public async Task ClassifyCustomCategoriesBatchConvenienceWithStatisticsTest() IncludeStatistics = true }; - AnalyzeActionsOperation operation = await client.StartAnalyzeActionsAsync(s_classifyCustomCategoriesBatchConvenienceDocuments, batchActions, "en", options); + AnalyzeActionsOperation operation = await client.StartAnalyzeActionsAsync(s_multiCategoryClassifyBatchConvenienceDocuments, batchActions, "en", options); await operation.WaitForCompletionAsync(); // Take the first page AnalyzeActionsResult resultCollection = operation.Value.ToEnumerableAsync().Result.FirstOrDefault(); - IReadOnlyCollection classifyCustomCategoriesActionsResults = resultCollection.ClassifyCustomCategoriesResults; - ClassifyCustomCategoriesResultCollection classifyCustomCategoriesResults = classifyCustomCategoriesActionsResults.FirstOrDefault().DocumentsResults; + IReadOnlyCollection multiCategoryClassifyActionsResults = resultCollection.MultiCategoryClassifyResults; + MultiCategoryClassifyResultCollection multiCategoryClassifyResults = multiCategoryClassifyActionsResults.FirstOrDefault().DocumentsResults; - ValidateSummaryBatchResult(classifyCustomCategoriesResults, includeStatistics: true); + ValidateSummaryBatchResult(multiCategoryClassifyResults, includeStatistics: true); } [RecordedTest] - public async Task ClassifyCustomCategoriesBatchTest() + public async Task MultiCategoryClassifyBatchTest() { TextAnalyticsClient client = GetClient(); TextAnalyticsActions batchActions = new TextAnalyticsActions() { - ClassifyCustomCategoriesActions = new List() + MultiCategoryClassifyActions = new List() { - new ClassifyCustomCategoriesAction(TestEnvironment.MultiCategoriesProjectName, TestEnvironment.MultiCategoriesDeploymentName) + new MultiCategoryClassifyAction(TestEnvironment.MultiClassificationProjectName, TestEnvironment.MultiClassificationDeploymentName) } }; - AnalyzeActionsOperation operation = await client.StartAnalyzeActionsAsync(s_classifyCustomCategoriesBatchDocuments, batchActions); + AnalyzeActionsOperation operation = await client.StartAnalyzeActionsAsync(s_multiCategoryClassifyBatchDocuments, batchActions); await operation.WaitForCompletionAsync(); // Take the first page AnalyzeActionsResult resultCollection = operation.Value.ToEnumerableAsync().Result.FirstOrDefault(); - IReadOnlyCollection classifyCustomCategoriesActionsResults = resultCollection.ClassifyCustomCategoriesResults; - ClassifyCustomCategoriesResultCollection classifyCustomCategoriesResults = classifyCustomCategoriesActionsResults.FirstOrDefault().DocumentsResults; + IReadOnlyCollection multiCategoryClassifyActionsResults = resultCollection.MultiCategoryClassifyResults; + MultiCategoryClassifyResultCollection multiCategoryClassifyResults = multiCategoryClassifyActionsResults.FirstOrDefault().DocumentsResults; - ValidateSummaryBatchResult(classifyCustomCategoriesResults); + ValidateSummaryBatchResult(multiCategoryClassifyResults); } [RecordedTest] - public async Task ClassifyCustomCategoriesBatchWithStatisticsTest() + public async Task MultiCategoryClassifyBatchWithStatisticsTest() { TextAnalyticsClient client = GetClient(); TextAnalyticsActions batchActions = new TextAnalyticsActions() { - ClassifyCustomCategoriesActions = new List() + MultiCategoryClassifyActions = new List() { - new ClassifyCustomCategoriesAction(TestEnvironment.MultiCategoriesProjectName, TestEnvironment.MultiCategoriesDeploymentName) + new MultiCategoryClassifyAction(TestEnvironment.MultiClassificationProjectName, TestEnvironment.MultiClassificationDeploymentName) } }; @@ -199,20 +199,20 @@ public async Task ClassifyCustomCategoriesBatchWithStatisticsTest() IncludeStatistics = true }; - AnalyzeActionsOperation operation = await client.StartAnalyzeActionsAsync(s_classifyCustomCategoriesBatchDocuments, batchActions, options); + AnalyzeActionsOperation operation = await client.StartAnalyzeActionsAsync(s_multiCategoryClassifyBatchDocuments, batchActions, options); await operation.WaitForCompletionAsync(); // Take the first page AnalyzeActionsResult resultCollection = operation.Value.ToEnumerableAsync().Result.FirstOrDefault(); - IReadOnlyCollection classifyCustomCategoriesActionsResults = resultCollection.ClassifyCustomCategoriesResults; - ClassifyCustomCategoriesResultCollection classifyCustomCategoriesResults = classifyCustomCategoriesActionsResults.FirstOrDefault().DocumentsResults; + IReadOnlyCollection multiCategoryClassifyActionsResults = resultCollection.MultiCategoryClassifyResults; + MultiCategoryClassifyResultCollection multiCategoryClassifyResults = multiCategoryClassifyActionsResults.FirstOrDefault().DocumentsResults; - ValidateSummaryBatchResult(classifyCustomCategoriesResults, includeStatistics: true); + ValidateSummaryBatchResult(multiCategoryClassifyResults, includeStatistics: true); } - private void ValidateSummaryDocumentResult(DocumentClassificationCollection classificationCollection) + private void ValidateSummaryDocumentResult(ClassificationCategoryCollection classificationCollection) { Assert.IsNotNull(classificationCollection.Warnings); @@ -224,10 +224,10 @@ private void ValidateSummaryDocumentResult(DocumentClassificationCollection clas } } - private void ValidateSummaryBatchResult(ClassifyCustomCategoriesResultCollection results, bool includeStatistics = false) + private void ValidateSummaryBatchResult(MultiCategoryClassifyResultCollection results, bool includeStatistics = false) { - Assert.AreEqual(results.ProjectName, TestEnvironment.MultiCategoriesProjectName); - Assert.AreEqual(results.DeploymentName, TestEnvironment.MultiCategoriesDeploymentName); + Assert.AreEqual(results.ProjectName, TestEnvironment.MultiClassificationProjectName); + Assert.AreEqual(results.DeploymentName, TestEnvironment.MultiClassificationDeploymentName); if (includeStatistics) { @@ -242,7 +242,7 @@ private void ValidateSummaryBatchResult(ClassifyCustomCategoriesResultCollection Assert.IsNull(results.Statistics); } - foreach (ClassifyCustomCategoriesResult result in results) + foreach (MultiCategoryClassifyResult result in results) { Assert.That(result.Id, Is.Not.Null.And.Not.Empty); Assert.False(result.HasError); @@ -259,7 +259,7 @@ private void ValidateSummaryBatchResult(ClassifyCustomCategoriesResultCollection Assert.AreEqual(0, result.Statistics.TransactionCount); } - ValidateSummaryDocumentResult(result.DocumentClassifications); + ValidateSummaryDocumentResult(result.ClassificationCategories); } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/TextAnalyticsModelFactoryTests.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/TextAnalyticsModelFactoryTests.cs index 54a064ca12aa..220d24d7e21b 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/TextAnalyticsModelFactoryTests.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/TextAnalyticsModelFactoryTests.cs @@ -142,6 +142,12 @@ public void AnalyzeActionsResult() TextAnalyticsModelFactory.SingleCategoryClassifyActionResult(default, default) }; + var multiCategoryClassifyActionResults = new List() + { + TextAnalyticsModelFactory.MultiCategoryClassifyActionResult(default, default), + TextAnalyticsModelFactory.MultiCategoryClassifyActionResult(default, default) + }; + var actionsResult = TextAnalyticsModelFactory.AnalyzeActionsResult( extractKeyPhrasesActionResults, recognizeEntitiesActionResults, @@ -169,7 +175,8 @@ public void AnalyzeActionsResult() recognizeLinkedEntitiesActionResults, analyzeSentimentActionResults, extractSummaryActionResults, - singleCategoryClassifyActionResults); + singleCategoryClassifyActionResults, + multiCategoryClassifyActionResults); CollectionAssert.AreEquivalent(extractKeyPhrasesActionResults, actionsResult.ExtractKeyPhrasesResults); CollectionAssert.AreEquivalent(recognizeEntitiesActionResults, actionsResult.RecognizeEntitiesResults); @@ -178,6 +185,7 @@ public void AnalyzeActionsResult() CollectionAssert.AreEquivalent(analyzeSentimentActionResults, actionsResult.AnalyzeSentimentResults); CollectionAssert.AreEquivalent(extractSummaryActionResults, actionsResult.ExtractSummaryResults); CollectionAssert.AreEquivalent(singleCategoryClassifyActionResults, actionsResult.SingleCategoryClassifyResults); + CollectionAssert.AreEquivalent(multiCategoryClassifyActionResults, actionsResult.MultiCategoryClassifyResults); } [Test] diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategories.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassify.cs similarity index 79% rename from sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategories.cs rename to sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassify.cs index 986501c70279..313d5a8095af 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategories.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassify.cs @@ -13,13 +13,13 @@ namespace Azure.AI.TextAnalytics.Samples public partial class TextAnalyticsSamples : SamplesBase { [Test] - public void ClassifyCustomCategories() + public void MultiCategoryClassify() { // Create a text analytics client. string endpoint = TestEnvironment.Endpoint; string apiKey = TestEnvironment.ApiKey; - string projectName = TestEnvironment.MultiCategoriesProjectName; - string deploymentName = TestEnvironment.MultiCategoriesDeploymentName; + string projectName = TestEnvironment.MultiClassificationProjectName; + string deploymentName = TestEnvironment.MultiClassificationDeploymentName; var client = new TextAnalyticsClient(new Uri(endpoint), new AzureKeyCredential(apiKey)); @@ -36,11 +36,11 @@ public void ClassifyCustomCategories() } }; - var classifyCustomCategoriesAction = new ClassifyCustomCategoriesAction(projectName, deploymentName); + var multiCategoryClassifyAction = new MultiCategoryClassifyAction(projectName, deploymentName); TextAnalyticsActions actions = new TextAnalyticsActions() { - ClassifyCustomCategoriesActions = new List() { classifyCustomCategoriesAction } + MultiCategoryClassifyActions = new List() { multiCategoryClassifyAction } }; // Start analysis process. @@ -75,9 +75,9 @@ public void ClassifyCustomCategories() // View operation results. foreach (AnalyzeActionsResult documentsInPage in operation.GetValues()) { - IReadOnlyCollection classificationResultsCollection = documentsInPage.ClassifyCustomCategoriesResults; + IReadOnlyCollection classificationResultsCollection = documentsInPage.MultiCategoryClassifyResults; - foreach (ClassifyCustomCategoriesActionResult classificationActionResults in classificationResultsCollection) + foreach (MultiCategoryClassifyActionResult classificationActionResults in classificationResultsCollection) { if (classificationActionResults.HasError) { @@ -87,7 +87,7 @@ public void ClassifyCustomCategories() continue; } - foreach (ClassifyCustomCategoriesResult documentResults in classificationActionResults.DocumentsResults) + foreach (MultiCategoryClassifyResult documentResults in classificationActionResults.DocumentsResults) { if (documentResults.HasError) { @@ -97,11 +97,11 @@ public void ClassifyCustomCategories() continue; } - if (documentResults.DocumentClassifications.Count > 0) + if (documentResults.ClassificationCategories.Count > 0) { Console.WriteLine($" The following classes were predicted for this document:"); - foreach (DocumentClassification classification in documentResults.DocumentClassifications) + foreach (ClassificationCategory classification in documentResults.ClassificationCategories) { Console.WriteLine($" Class category \"{classification.Category}\" predicted with a confidence score of {classification.ConfidenceScore}."); } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategoriesAsync.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyAsync.cs similarity index 77% rename from sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategoriesAsync.cs rename to sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyAsync.cs index bf5118c34a29..0e07ba699742 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategoriesAsync.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyAsync.cs @@ -13,13 +13,13 @@ namespace Azure.AI.TextAnalytics.Samples public partial class TextAnalyticsSamples : SamplesBase { [Test] - public async Task ClassifyCustomCategoriesAsync() + public async Task MultiCategoryClassifyAsync() { // Create a text analytics client. string endpoint = TestEnvironment.Endpoint; string apiKey = TestEnvironment.ApiKey; - string projectName = TestEnvironment.MultiCategoriesProjectName; - string deploymentName = TestEnvironment.MultiCategoriesDeploymentName; + string projectName = TestEnvironment.MultiClassificationProjectName; + string deploymentName = TestEnvironment.MultiClassificationDeploymentName; var client = new TextAnalyticsClient(new Uri(endpoint), new AzureKeyCredential(apiKey)); @@ -36,11 +36,11 @@ public async Task ClassifyCustomCategoriesAsync() } }; - var classifyCustomCategoriesAction = new ClassifyCustomCategoriesAction(projectName, deploymentName); + var multiCategoryClassifyAction = new MultiCategoryClassifyAction(projectName, deploymentName); TextAnalyticsActions actions = new TextAnalyticsActions() { - ClassifyCustomCategoriesActions = new List() { classifyCustomCategoriesAction } + MultiCategoryClassifyActions = new List() { multiCategoryClassifyAction } }; // Start analysis process. @@ -62,9 +62,9 @@ public async Task ClassifyCustomCategoriesAsync() // View operation results. await foreach (AnalyzeActionsResult documentsInPage in operation.Value) { - IReadOnlyCollection classificationResultsCollection = documentsInPage.ClassifyCustomCategoriesResults; + IReadOnlyCollection classificationResultsCollection = documentsInPage.MultiCategoryClassifyResults; - foreach (ClassifyCustomCategoriesActionResult classificationActionResults in classificationResultsCollection) + foreach (MultiCategoryClassifyActionResult classificationActionResults in classificationResultsCollection) { if (classificationActionResults.HasError) { @@ -74,7 +74,7 @@ public async Task ClassifyCustomCategoriesAsync() continue; } - foreach (ClassifyCustomCategoriesResult documentResults in classificationActionResults.DocumentsResults) + foreach (MultiCategoryClassifyResult documentResults in classificationActionResults.DocumentsResults) { if (documentResults.HasError) { @@ -84,11 +84,11 @@ public async Task ClassifyCustomCategoriesAsync() continue; } - if (documentResults.DocumentClassifications.Count > 0) + if (documentResults.ClassificationCategories.Count > 0) { Console.WriteLine($" The following classes were predicted for this document:"); - foreach (DocumentClassification classification in documentResults.DocumentClassifications) + foreach (ClassificationCategory classification in documentResults.ClassificationCategories) { Console.WriteLine($" Class category \"{classification.Category}\" predicted with a confidence score of {classification.ConfidenceScore}."); } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategoriesConvenience.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyConvenience.cs similarity index 78% rename from sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategoriesConvenience.cs rename to sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyConvenience.cs index 79f9990ea213..1d88b0169f09 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategoriesConvenience.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyConvenience.cs @@ -13,13 +13,13 @@ namespace Azure.AI.TextAnalytics.Samples public partial class TextAnalyticsSamples : SamplesBase { [Test] - public void ClassifyCustomCategoriesConvenience() + public void MultiCategoryClassifyConvenience() { // Create a text analytics client. string endpoint = TestEnvironment.Endpoint; string apiKey = TestEnvironment.ApiKey; - string projectName = TestEnvironment.MultiCategoriesProjectName; - string deploymentName = TestEnvironment.MultiCategoriesDeploymentName; + string projectName = TestEnvironment.MultiClassificationProjectName; + string deploymentName = TestEnvironment.MultiClassificationDeploymentName; var client = new TextAnalyticsClient(new Uri(endpoint), new AzureKeyCredential(apiKey)); @@ -33,11 +33,11 @@ public void ClassifyCustomCategoriesConvenience() document }; - var classifyCustomCategoriesAction = new ClassifyCustomCategoriesAction(projectName, deploymentName); + var multiCategoryClassifyAction = new MultiCategoryClassifyAction(projectName, deploymentName); TextAnalyticsActions actions = new TextAnalyticsActions() { - ClassifyCustomCategoriesActions = new List() { classifyCustomCategoriesAction } + MultiCategoryClassifyActions = new List() { multiCategoryClassifyAction } }; // Start analysis process. @@ -72,9 +72,9 @@ public void ClassifyCustomCategoriesConvenience() // View operation results. foreach (AnalyzeActionsResult documentsInPage in operation.GetValues()) { - IReadOnlyCollection classificationResultsCollection = documentsInPage.ClassifyCustomCategoriesResults; + IReadOnlyCollection classificationResultsCollection = documentsInPage.MultiCategoryClassifyResults; - foreach (ClassifyCustomCategoriesActionResult classificationActionResults in classificationResultsCollection) + foreach (MultiCategoryClassifyActionResult classificationActionResults in classificationResultsCollection) { if (classificationActionResults.HasError) { @@ -84,7 +84,7 @@ public void ClassifyCustomCategoriesConvenience() continue; } - foreach (ClassifyCustomCategoriesResult documentResults in classificationActionResults.DocumentsResults) + foreach (MultiCategoryClassifyResult documentResults in classificationActionResults.DocumentsResults) { if (documentResults.HasError) { @@ -94,11 +94,11 @@ public void ClassifyCustomCategoriesConvenience() continue; } - if (documentResults.DocumentClassifications.Count > 0) + if (documentResults.ClassificationCategories.Count > 0) { Console.WriteLine($" The following classes were predicted for this document:"); - foreach (DocumentClassification classification in documentResults.DocumentClassifications) + foreach (ClassificationCategory classification in documentResults.ClassificationCategories) { Console.WriteLine($" Class category \"{classification.Category}\" predicted with a confidence score of {classification.ConfidenceScore}."); } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategoriesConvenienceAsync.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyConvenienceAsync.cs similarity index 69% rename from sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategoriesConvenienceAsync.cs rename to sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyConvenienceAsync.cs index ad7fa6adc74b..c15c74bdd288 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_ClassifyCustomCategoriesConvenienceAsync.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyConvenienceAsync.cs @@ -13,17 +13,17 @@ namespace Azure.AI.TextAnalytics.Samples public partial class TextAnalyticsSamples : SamplesBase { [Test] - public async Task ClassifyCustomCategoriesConvenienceAsync() + public async Task MultiCategoryClassifyConvenienceAsync() { // Create a text analytics client. string endpoint = TestEnvironment.Endpoint; string apiKey = TestEnvironment.ApiKey; - string projectName = TestEnvironment.MultiCategoriesProjectName; - string deploymentName = TestEnvironment.MultiCategoriesDeploymentName; + string projectName = TestEnvironment.MultiClassificationProjectName; + string deploymentName = TestEnvironment.MultiClassificationDeploymentName; var client = new TextAnalyticsClient(new Uri(endpoint), new AzureKeyCredential(apiKey)); - #region Snippet:TextAnalyticsClassifyCustomCategoriesAsync + #region Snippet:TextAnalyticsMultiCategoryClassifyAsync // Get input document. string document = @"I need a reservation for an indoor restaurant in China. Please don't stop the music. Play music and add it to my playlist."; @@ -34,20 +34,20 @@ public async Task ClassifyCustomCategoriesConvenienceAsync() document }; - var classifyCustomCategoriesAction = new ClassifyCustomCategoriesAction(projectName, deploymentName); + var multiCategoryClassifyAction = new MultiCategoryClassifyAction(projectName, deploymentName); TextAnalyticsActions actions = new TextAnalyticsActions() { - ClassifyCustomCategoriesActions = new List() { classifyCustomCategoriesAction } + MultiCategoryClassifyActions = new List() { multiCategoryClassifyAction } }; // Start analysis process. AnalyzeActionsOperation operation = await client.StartAnalyzeActionsAsync(batchInput, actions); await operation.WaitForCompletionAsync(); - #endregion Snippet:TextAnalyticsClassifyCustomCategoriesAsync + #endregion Snippet:TextAnalyticsMultiCategoryClassifyAsync - #region Snippet:TextAnalyticsClassifyCustomCategoriesOperationStatus + #region Snippet:TextAnalyticsMultiCategoryClassifyOperationStatus // View operation status. Console.WriteLine($"AnalyzeActions operation has completed"); Console.WriteLine(); @@ -58,15 +58,15 @@ public async Task ClassifyCustomCategoriesConvenienceAsync() Console.WriteLine($"Status : {operation.Status}"); Console.WriteLine($"Last Modified: {operation.LastModified}"); Console.WriteLine(); - #endregion Snippet:TextAnalyticsClassifyCustomCategoriesOperationStatus + #endregion Snippet:TextAnalyticsMultiCategoryClassifyOperationStatus - #region Snippet:TextAnalyticsClassifyCustomCategoriesAsyncViewResults + #region Snippet:TextAnalyticsMultiCategoryClassifyAsyncViewResults // View operation results. await foreach (AnalyzeActionsResult documentsInPage in operation.Value) { - IReadOnlyCollection classificationResultsCollection = documentsInPage.ClassifyCustomCategoriesResults; + IReadOnlyCollection classificationResultsCollection = documentsInPage.MultiCategoryClassifyResults; - foreach (ClassifyCustomCategoriesActionResult classificationActionResults in classificationResultsCollection) + foreach (MultiCategoryClassifyActionResult classificationActionResults in classificationResultsCollection) { if (classificationActionResults.HasError) { @@ -76,7 +76,7 @@ public async Task ClassifyCustomCategoriesConvenienceAsync() continue; } - foreach (ClassifyCustomCategoriesResult documentResults in classificationActionResults.DocumentsResults) + foreach (MultiCategoryClassifyResult documentResults in classificationActionResults.DocumentsResults) { if (documentResults.HasError) { @@ -86,11 +86,11 @@ public async Task ClassifyCustomCategoriesConvenienceAsync() continue; } - if (documentResults.DocumentClassifications.Count > 0) + if (documentResults.ClassificationCategories.Count > 0) { Console.WriteLine($" The following classes were predicted for this document:"); - foreach (DocumentClassification classification in documentResults.DocumentClassifications) + foreach (ClassificationCategory classification in documentResults.ClassificationCategories) { Console.WriteLine($" Class category \"{classification.Category}\" predicted with a confidence score of {classification.ConfidenceScore}."); } @@ -100,7 +100,7 @@ public async Task ClassifyCustomCategoriesConvenienceAsync() } } } - #endregion Snippet:TextAnalyticsClassifyCustomCategoriesAsyncViewResults + #endregion Snippet:TextAnalyticsMultiCategoryClassifyAsyncViewResults } } } From 52e1850542c19d47e83b9b2e74b7f2702e07d78b Mon Sep 17 00:00:00 2001 From: Ahmed Leithy Date: Sun, 26 Sep 2021 20:43:58 +0200 Subject: [PATCH 16/22] ReRecorded Tests --- .../ClassifyCustomCategoriesBatchTest.json | 162 --------- ...stomCategoriesBatchWithErrorTestAsync.json | 164 --------- ...iCategoryClassifyBatchConvenienceTest.json | 266 +++++++++++++++ ...oryClassifyBatchConvenienceTestAsync.json} | 88 +++-- ...fyBatchConvenienceWithStatisticsTest.json} | 98 +++--- ...chConvenienceWithStatisticsTestAsync.json} | 88 +++-- .../MultiCategoryClassifyBatchTest.json} | 92 +++--- .../MultiCategoryClassifyBatchTestAsync.json} | 88 +++-- ...ltiCategoryClassifyBatchWithErrorTest.json | 311 ++++++++++++++++++ ...egoryClassifyBatchWithErrorTestAsync.json} | 88 +++-- ...egoryClassifyBatchWithStatisticsTest.json} | 90 +++-- ...ClassifyBatchWithStatisticsTestAsync.json} | 94 +++--- ...tegoryClassifyWithDisableServiceLogs.json} | 86 +++-- ...yClassifyWithDisableServiceLogsAsync.json} | 88 +++-- 14 files changed, 1117 insertions(+), 686 deletions(-) delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchTest.json delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithErrorTestAsync.json create mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchConvenienceTest.json rename sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/{ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceTestAsync.json => MultiCategoryClassifyTests/MultiCategoryClassifyBatchConvenienceTestAsync.json} (63%) rename sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/{ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithStatisticsTest.json => MultiCategoryClassifyTests/MultiCategoryClassifyBatchConvenienceWithStatisticsTest.json} (64%) rename sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/{ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceWithStatisticsTest.json => MultiCategoryClassifyTests/MultiCategoryClassifyBatchConvenienceWithStatisticsTestAsync.json} (65%) rename sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/{ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceTest.json => MultiCategoryClassifyTests/MultiCategoryClassifyBatchTest.json} (63%) rename sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/{ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchTestAsync.json => MultiCategoryClassifyTests/MultiCategoryClassifyBatchTestAsync.json} (63%) create mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchWithErrorTest.json rename sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/{ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithErrorTest.json => MultiCategoryClassifyTests/MultiCategoryClassifyBatchWithErrorTestAsync.json} (62%) rename sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/{ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithStatisticsTestAsync.json => MultiCategoryClassifyTests/MultiCategoryClassifyBatchWithStatisticsTest.json} (65%) rename sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/{ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceWithStatisticsTestAsync.json => MultiCategoryClassifyTests/MultiCategoryClassifyBatchWithStatisticsTestAsync.json} (66%) rename sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/{ClassifyCustomCategoriesTests/ClassifyCustomCategoriesWithDisableServiceLogsAsync.json => MultiCategoryClassifyTests/MultiCategoryClassifyWithDisableServiceLogs.json} (63%) rename sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/{ClassifyCustomCategoriesTests/ClassifyCustomCategoriesWithDisableServiceLogs.json => MultiCategoryClassifyTests/MultiCategoryClassifyWithDisableServiceLogsAsync.json} (63%) diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchTest.json b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchTest.json deleted file mode 100644 index e2e75c9a5223..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchTest.json +++ /dev/null @@ -1,162 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json, text/json", - "Content-Length": "564", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-4a64f91f623c7944b1d4d7ca38df2701-f9365667eef54343-00", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "467af06cabdf151393fc8b0b70c44cc6", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "analysisInput": { - "documents": [ - { - "id": "1", - "text": "I need a reservation for an indoor restaurant in China. Please don\u0027t stop the music. Play music and add it to my playlist", - "language": "en" - }, - { - "id": "2", - "text": "David Schmidt, senior vice president--Food Safety, International Food Information Council (IFIC), Washington, D.C., discussed the physical activity component.", - "language": "en" - } - ] - }, - "tasks": { - "customMultiClassificationTasks": [ - { - "parameters": { - "project-name": "7cdace98-537b-494a-b69a-c19754718025", - "deployment-name": "7cdace98-537b-494a-b69a-c19754718025" - } - } - ] - } - }, - "StatusCode": 202, - "ResponseHeaders": { - "apim-request-id": "0bb9a1c1-78ae-4135-a04d-69a922f2c3c3", - "Date": "Thu, 23 Sep 2021 11:21:22 GMT", - "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/9dc7476a-d713-472b-b4d3-efc4f99193c3", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "225" - }, - "ResponseBody": [] - }, - { - "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/9dc7476a-d713-472b-b4d3-efc4f99193c3", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json, text/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "b362614be61a7bf93ef4b6931ccce2df", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "apim-request-id": "b4bccc65-3408-4baa-b4ea-c6e28c818346", - "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 23 Sep 2021 11:21:22 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "21" - }, - "ResponseBody": { - "jobId": "9dc7476a-d713-472b-b4d3-efc4f99193c3", - "lastUpdateDateTime": "2021-09-23T11:21:22Z", - "createdDateTime": "2021-09-23T11:21:22Z", - "expirationDateTime": "2021-09-24T11:21:22Z", - "status": "running", - "errors": [], - "displayName": "NA", - "tasks": { - "completed": 0, - "failed": 0, - "inProgress": 1, - "total": 1 - } - } - }, - { - "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/9dc7476a-d713-472b-b4d3-efc4f99193c3", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json, text/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "3cd0c2fc2706fe41529a3d59eaba6881", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "apim-request-id": "8b93c2ee-146f-4999-a7a5-856c1379a4a6", - "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 23 Sep 2021 11:21:24 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "90" - }, - "ResponseBody": { - "jobId": "9dc7476a-d713-472b-b4d3-efc4f99193c3", - "lastUpdateDateTime": "2021-09-23T11:21:22Z", - "createdDateTime": "2021-09-23T11:21:22Z", - "expirationDateTime": "2021-09-24T11:21:22Z", - "status": "succeeded", - "errors": [], - "displayName": "NA", - "tasks": { - "completed": 1, - "failed": 0, - "inProgress": 0, - "total": 1, - "customMultiClassificationTasks": [ - { - "lastUpdateDateTime": "2021-09-23T11:21:22.8877726Z", - "state": "succeeded", - "results": { - "documents": [ - { - "id": "1", - "classifications": [ - { - "category": "BookRestaurant", - "confidenceScore": 0.97 - } - ], - "warnings": [] - }, - { - "id": "2", - "classifications": [], - "warnings": [] - } - ], - "errors": [], - "projectName": "7cdace98-537b-494a-b69a-c19754718025", - "deploymentName": "7cdace98-537b-494a-b69a-c19754718025" - } - } - ] - } - } - } - ], - "Variables": { - "RandomSeed": "483838597", - "TEXT_ANALYTICS_API_KEY": "Sanitized", - "TEXT_ANALYTICS_ENDPOINT": "https://cognitiveweppe.azure-api.net" - } -} \ No newline at end of file diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithErrorTestAsync.json b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithErrorTestAsync.json deleted file mode 100644 index 7ca8385a2075..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithErrorTestAsync.json +++ /dev/null @@ -1,164 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json, text/json", - "Content-Length": "328", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-a07216e84f219944a376a18d396ed8a2-2a2a56f99cf2f14f-00", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "b0512329b82c40362331a3a24836f81b", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "analysisInput": { - "documents": [ - { - "id": "0", - "text": "Subject is taking 100mg of ibuprofen twice daily", - "language": "en" - }, - { - "id": "1", - "text": "", - "language": "en" - } - ] - }, - "tasks": { - "customMultiClassificationTasks": [ - { - "parameters": { - "project-name": "7cdace98-537b-494a-b69a-c19754718025", - "deployment-name": "7cdace98-537b-494a-b69a-c19754718025" - } - } - ] - } - }, - "StatusCode": 202, - "ResponseHeaders": { - "apim-request-id": "0ffe4658-389e-4161-a460-2d7f6a979b2c", - "Date": "Thu, 23 Sep 2021 11:20:16 GMT", - "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/cc6cdbe5-00b3-4277-9b85-9ff9adf07814", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "192" - }, - "ResponseBody": [] - }, - { - "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/cc6cdbe5-00b3-4277-9b85-9ff9adf07814", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json, text/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "dd09b342a9851d8000b8159dec98b1d3", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "apim-request-id": "3c9389c0-5621-46c3-abc1-2bda4a0f5c54", - "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 23 Sep 2021 11:20:16 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "7" - }, - "ResponseBody": { - "jobId": "cc6cdbe5-00b3-4277-9b85-9ff9adf07814", - "lastUpdateDateTime": "2021-09-23T11:20:17Z", - "createdDateTime": "2021-09-23T11:20:17Z", - "expirationDateTime": "2021-09-24T11:20:17Z", - "status": "notStarted", - "errors": [], - "displayName": "NA", - "tasks": { - "completed": 0, - "failed": 0, - "inProgress": 1, - "total": 1 - } - } - }, - { - "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/cc6cdbe5-00b3-4277-9b85-9ff9adf07814", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json, text/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "04f82a3f1f2532fd83caa8f3ff57a53b", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "apim-request-id": "50c196e5-bb6d-474f-9465-5844bf61d912", - "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 23 Sep 2021 11:20:18 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "66" - }, - "ResponseBody": { - "jobId": "cc6cdbe5-00b3-4277-9b85-9ff9adf07814", - "lastUpdateDateTime": "2021-09-23T11:20:18Z", - "createdDateTime": "2021-09-23T11:20:17Z", - "expirationDateTime": "2021-09-24T11:20:17Z", - "status": "succeeded", - "errors": [], - "displayName": "NA", - "tasks": { - "completed": 1, - "failed": 0, - "inProgress": 0, - "total": 1, - "customMultiClassificationTasks": [ - { - "lastUpdateDateTime": "2021-09-23T11:20:18.3489203Z", - "state": "succeeded", - "results": { - "documents": [ - { - "id": "0", - "classifications": [], - "warnings": [] - } - ], - "errors": [ - { - "id": "1", - "error": { - "code": "InvalidArgument", - "message": "Invalid document in request.", - "innererror": { - "code": "InvalidDocument", - "message": "Document text is empty." - } - } - } - ], - "projectName": "7cdace98-537b-494a-b69a-c19754718025", - "deploymentName": "7cdace98-537b-494a-b69a-c19754718025" - } - } - ] - } - } - } - ], - "Variables": { - "RandomSeed": "1193753074", - "TEXT_ANALYTICS_API_KEY": "Sanitized", - "TEXT_ANALYTICS_ENDPOINT": "https://cognitiveweppe.azure-api.net" - } -} \ No newline at end of file diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchConvenienceTest.json b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchConvenienceTest.json new file mode 100644 index 000000000000..3e97be1218ea --- /dev/null +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchConvenienceTest.json @@ -0,0 +1,266 @@ +{ + "Entries": [ + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": [ + "application/json", + "text/json" + ], + "Content-Length": "564", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-02d73dabfeb1c24eb4b415c279c5000a-fabdf2988567034a-00", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "f239d83ee3161157ec92517fefbbda7e", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "analysisInput": { + "documents": [ + { + "id": "0", + "text": "I need a reservation for an indoor restaurant in China. Please don\u0027t stop the music. Play music and add it to my playlist", + "language": "en" + }, + { + "id": "1", + "text": "David Schmidt, senior vice president--Food Safety, International Food Information Council (IFIC), Washington, D.C., discussed the physical activity component.", + "language": "en" + } + ] + }, + "tasks": { + "customMultiClassificationTasks": [ + { + "parameters": { + "project-name": "7cdace98-537b-494a-b69a-c19754718025", + "deployment-name": "7cdace98-537b-494a-b69a-c19754718025" + } + } + ] + } + }, + "StatusCode": 202, + "ResponseHeaders": { + "apim-request-id": "ad99d7d4-90ed-4e2f-a4c9-a116eb5ab489", + "Date": "Sun, 26 Sep 2021 18:37:39 GMT", + "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/e457ede2-ebd1-47ed-88b1-79e2dd68bde2", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "773" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/e457ede2-ebd1-47ed-88b1-79e2dd68bde2", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": [ + "application/json", + "text/json" + ], + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "7ec04fe460fa3eef35d0d229a390e245", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "f9ed40ae-1c75-481e-aee2-56fb5e35c9f1", + "Content-Type": "application/json; charset=utf-8", + "Date": "Sun, 26 Sep 2021 18:37:39 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "174" + }, + "ResponseBody": { + "jobId": "e457ede2-ebd1-47ed-88b1-79e2dd68bde2", + "lastUpdateDateTime": "2021-09-26T18:37:39Z", + "createdDateTime": "2021-09-26T18:37:38Z", + "expirationDateTime": "2021-09-27T18:37:38Z", + "status": "notStarted", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 0, + "failed": 0, + "inProgress": 1, + "total": 1 + } + } + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/e457ede2-ebd1-47ed-88b1-79e2dd68bde2", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": [ + "application/json", + "text/json" + ], + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "86a67303a3d1040789a52cdc11e926a2", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "3e116eb0-a066-48d0-a0fc-301101585aba", + "Content-Type": "application/json; charset=utf-8", + "Date": "Sun, 26 Sep 2021 18:37:40 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "62" + }, + "ResponseBody": { + "jobId": "e457ede2-ebd1-47ed-88b1-79e2dd68bde2", + "lastUpdateDateTime": "2021-09-26T18:37:39Z", + "createdDateTime": "2021-09-26T18:37:38Z", + "expirationDateTime": "2021-09-27T18:37:38Z", + "status": "running", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 0, + "failed": 0, + "inProgress": 1, + "total": 1 + } + } + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/e457ede2-ebd1-47ed-88b1-79e2dd68bde2", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": [ + "application/json", + "text/json" + ], + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "7116e4bdc810de38e9fbbd46102d6d5c", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "e661af9e-998e-47fc-8228-bdb11a26fb49", + "Content-Type": "application/json; charset=utf-8", + "Date": "Sun, 26 Sep 2021 18:37:41 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "8" + }, + "ResponseBody": { + "jobId": "e457ede2-ebd1-47ed-88b1-79e2dd68bde2", + "lastUpdateDateTime": "2021-09-26T18:37:39Z", + "createdDateTime": "2021-09-26T18:37:38Z", + "expirationDateTime": "2021-09-27T18:37:38Z", + "status": "running", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 0, + "failed": 0, + "inProgress": 1, + "total": 1 + } + } + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/e457ede2-ebd1-47ed-88b1-79e2dd68bde2", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": [ + "application/json", + "text/json" + ], + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "7c7c0caf531441ad47bcf55533122c4c", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "19fd3fe8-3e7a-449e-b3ef-9fe44b472ab7", + "Content-Type": "application/json; charset=utf-8", + "Date": "Sun, 26 Sep 2021 18:37:43 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "220" + }, + "ResponseBody": { + "jobId": "e457ede2-ebd1-47ed-88b1-79e2dd68bde2", + "lastUpdateDateTime": "2021-09-26T18:37:42Z", + "createdDateTime": "2021-09-26T18:37:38Z", + "expirationDateTime": "2021-09-27T18:37:38Z", + "status": "succeeded", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 1, + "failed": 0, + "inProgress": 0, + "total": 1, + "customMultiClassificationTasks": [ + { + "lastUpdateDateTime": "2021-09-26T18:37:42.9616602Z", + "state": "succeeded", + "results": { + "documents": [ + { + "id": "0", + "classifications": [ + { + "category": "BookRestaurant", + "confidenceScore": 0.97 + } + ], + "warnings": [] + }, + { + "id": "1", + "classifications": [], + "warnings": [] + } + ], + "errors": [], + "projectName": "7cdace98-537b-494a-b69a-c19754718025", + "deploymentName": "7cdace98-537b-494a-b69a-c19754718025" + } + } + ] + } + } + } + ], + "Variables": { + "RandomSeed": "306457240", + "TEXT_ANALYTICS_API_KEY": "Sanitized", + "TEXT_ANALYTICS_ENDPOINT": "https://cognitiveweppe.azure-api.net" + } +} \ No newline at end of file diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceTestAsync.json b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchConvenienceTestAsync.json similarity index 63% rename from sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceTestAsync.json rename to sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchConvenienceTestAsync.json index 9822999964c5..a2128f0d75e7 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceTestAsync.json +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchConvenienceTestAsync.json @@ -4,13 +4,19 @@ "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze", "RequestMethod": "POST", "RequestHeaders": { - "Accept": "application/json, text/json", + "Accept": [ + "application/json", + "text/json" + ], "Content-Length": "564", "Content-Type": "application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-ad31ffbf0e361643ae22f8e7e44b29d1-801b629e5e44524f-00", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "0ddc88a07756fef0bc14cf4b9b6ebc78", + "traceparent": "00-9263bc8b9cfa464fa16f6fdb1b007b15-0754cd64ae803e41-00", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "718a5a8721a7c47b28a6d6f40fa42e90", "x-ms-return-client-request-id": "true" }, "RequestBody": { @@ -41,42 +47,48 @@ }, "StatusCode": 202, "ResponseHeaders": { - "apim-request-id": "a03b1ecd-5282-435c-b992-4f9e91a6ed90", - "Date": "Thu, 23 Sep 2021 11:20:38 GMT", - "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/6dc152d1-b31b-49be-81ae-6ef3dc7c6742", + "apim-request-id": "2b272e35-5f6a-4852-b14e-615f562e06c4", + "Date": "Sun, 26 Sep 2021 18:37:55 GMT", + "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/16eb16dd-9c06-4486-8b5b-68d092b59469", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "225" + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "261" }, "ResponseBody": [] }, { - "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/6dc152d1-b31b-49be-81ae-6ef3dc7c6742", + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/16eb16dd-9c06-4486-8b5b-68d092b59469", "RequestMethod": "GET", "RequestHeaders": { - "Accept": "application/json, text/json", + "Accept": [ + "application/json", + "text/json" + ], "Ocp-Apim-Subscription-Key": "Sanitized", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "521fd6a6b5fc70fa268cfca6cde8683e", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "52d011f3b82af3f309e064b1bf001af7", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "4330a4ff-528f-42c2-abe1-6de399a37e12", + "apim-request-id": "96a8b076-7014-4e8f-9cd1-ea47b30b3c4d", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 23 Sep 2021 11:20:38 GMT", + "Date": "Sun, 26 Sep 2021 18:37:55 GMT", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "6" + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "51" }, "ResponseBody": { - "jobId": "6dc152d1-b31b-49be-81ae-6ef3dc7c6742", - "lastUpdateDateTime": "2021-09-23T11:20:38Z", - "createdDateTime": "2021-09-23T11:20:38Z", - "expirationDateTime": "2021-09-24T11:20:38Z", + "jobId": "16eb16dd-9c06-4486-8b5b-68d092b59469", + "lastUpdateDateTime": "2021-09-26T18:37:55Z", + "createdDateTime": "2021-09-26T18:37:55Z", + "expirationDateTime": "2021-09-27T18:37:55Z", "status": "notStarted", "errors": [], "displayName": "NA", @@ -89,31 +101,37 @@ } }, { - "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/6dc152d1-b31b-49be-81ae-6ef3dc7c6742", + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/16eb16dd-9c06-4486-8b5b-68d092b59469", "RequestMethod": "GET", "RequestHeaders": { - "Accept": "application/json, text/json", + "Accept": [ + "application/json", + "text/json" + ], "Ocp-Apim-Subscription-Key": "Sanitized", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "4200402e3b3f954fda62759441954f7b", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "2e9ba3ef2af0771918680395314e3c1c", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "0202d370-94f3-49ed-bd26-6c42dddc022f", + "apim-request-id": "b8ece7e7-21f2-4004-8c08-8678d3307cd0", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 23 Sep 2021 11:20:39 GMT", + "Date": "Sun, 26 Sep 2021 18:37:56 GMT", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "78" + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "73" }, "ResponseBody": { - "jobId": "6dc152d1-b31b-49be-81ae-6ef3dc7c6742", - "lastUpdateDateTime": "2021-09-23T11:20:39Z", - "createdDateTime": "2021-09-23T11:20:38Z", - "expirationDateTime": "2021-09-24T11:20:38Z", + "jobId": "16eb16dd-9c06-4486-8b5b-68d092b59469", + "lastUpdateDateTime": "2021-09-26T18:37:56Z", + "createdDateTime": "2021-09-26T18:37:55Z", + "expirationDateTime": "2021-09-27T18:37:55Z", "status": "succeeded", "errors": [], "displayName": "NA", @@ -124,7 +142,7 @@ "total": 1, "customMultiClassificationTasks": [ { - "lastUpdateDateTime": "2021-09-23T11:20:39.0944392Z", + "lastUpdateDateTime": "2021-09-26T18:37:56.2504231Z", "state": "succeeded", "results": { "documents": [ @@ -155,7 +173,7 @@ } ], "Variables": { - "RandomSeed": "2124148127", + "RandomSeed": "243582775", "TEXT_ANALYTICS_API_KEY": "Sanitized", "TEXT_ANALYTICS_ENDPOINT": "https://cognitiveweppe.azure-api.net" } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithStatisticsTest.json b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchConvenienceWithStatisticsTest.json similarity index 64% rename from sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithStatisticsTest.json rename to sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchConvenienceWithStatisticsTest.json index 2f2aba484373..baea9443251c 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithStatisticsTest.json +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchConvenienceWithStatisticsTest.json @@ -4,25 +4,31 @@ "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze", "RequestMethod": "POST", "RequestHeaders": { - "Accept": "application/json, text/json", + "Accept": [ + "application/json", + "text/json" + ], "Content-Length": "564", "Content-Type": "application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-b8e84a634192f84f917a47e88e403b3c-a1d9821e8a380145-00", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "12506dda78bf4d710659bcefd0f793f4", + "traceparent": "00-d9dad020148efc4696fec3f209283eed-f1f8f7fc5f37ed42-00", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "d058597bceb0808d39f520df873cc702", "x-ms-return-client-request-id": "true" }, "RequestBody": { "analysisInput": { "documents": [ { - "id": "1", + "id": "0", "text": "I need a reservation for an indoor restaurant in China. Please don\u0027t stop the music. Play music and add it to my playlist", "language": "en" }, { - "id": "2", + "id": "1", "text": "David Schmidt, senior vice president--Food Safety, International Food Information Council (IFIC), Washington, D.C., discussed the physical activity component.", "language": "en" } @@ -41,43 +47,49 @@ }, "StatusCode": 202, "ResponseHeaders": { - "apim-request-id": "4786f470-b37f-4361-9c22-5e8123a0877d", - "Date": "Thu, 23 Sep 2021 11:21:41 GMT", - "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/1f45450f-224d-4781-bce7-d53e6b262f90", + "apim-request-id": "dfac3045-3219-4f1a-9a74-63818e55c1ef", + "Date": "Sun, 26 Sep 2021 18:37:43 GMT", + "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/0e9780de-de39-44a6-9f2b-b02a5dc30ccf", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "362" + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "534" }, "ResponseBody": [] }, { - "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/1f45450f-224d-4781-bce7-d53e6b262f90?showStats=true", + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/0e9780de-de39-44a6-9f2b-b02a5dc30ccf?showStats=true", "RequestMethod": "GET", "RequestHeaders": { - "Accept": "application/json, text/json", + "Accept": [ + "application/json", + "text/json" + ], "Ocp-Apim-Subscription-Key": "Sanitized", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "f5f3bdc8b9e9821865502ab6d20203b4", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "9053fcdd622640c445116a104b8599b8", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "a0f39ba8-69ec-45de-8773-e29da4fd8df1", + "apim-request-id": "f20765e5-6d54-4707-89ae-4e1644a9f489", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 23 Sep 2021 11:21:41 GMT", + "Date": "Sun, 26 Sep 2021 18:37:43 GMT", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "18" + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "9" }, "ResponseBody": { - "jobId": "1f45450f-224d-4781-bce7-d53e6b262f90", - "lastUpdateDateTime": "2021-09-23T11:21:42Z", - "createdDateTime": "2021-09-23T11:21:41Z", - "expirationDateTime": "2021-09-24T11:21:41Z", - "status": "notStarted", + "jobId": "0e9780de-de39-44a6-9f2b-b02a5dc30ccf", + "lastUpdateDateTime": "2021-09-26T18:37:43Z", + "createdDateTime": "2021-09-26T18:37:43Z", + "expirationDateTime": "2021-09-27T18:37:43Z", + "status": "running", "errors": [], "displayName": "NA", "tasks": { @@ -89,31 +101,37 @@ } }, { - "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/1f45450f-224d-4781-bce7-d53e6b262f90?showStats=true", + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/0e9780de-de39-44a6-9f2b-b02a5dc30ccf?showStats=true", "RequestMethod": "GET", "RequestHeaders": { - "Accept": "application/json, text/json", + "Accept": [ + "application/json", + "text/json" + ], "Ocp-Apim-Subscription-Key": "Sanitized", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "21f738c70fcc2ca2643726f760b9704a", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "5bbdb49dd997808e5a9132fc5dcad991", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "3a53be58-e043-4179-97be-ada71a83d67d", + "apim-request-id": "00fcf02e-6a8b-4fb7-9e11-f55128c20eea", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 23 Sep 2021 11:21:42 GMT", + "Date": "Sun, 26 Sep 2021 18:37:44 GMT", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "212" + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "79" }, "ResponseBody": { - "jobId": "1f45450f-224d-4781-bce7-d53e6b262f90", - "lastUpdateDateTime": "2021-09-23T11:21:43Z", - "createdDateTime": "2021-09-23T11:21:41Z", - "expirationDateTime": "2021-09-24T11:21:41Z", + "jobId": "0e9780de-de39-44a6-9f2b-b02a5dc30ccf", + "lastUpdateDateTime": "2021-09-26T18:37:44Z", + "createdDateTime": "2021-09-26T18:37:43Z", + "expirationDateTime": "2021-09-27T18:37:43Z", "status": "succeeded", "errors": [], "displayName": "NA", @@ -124,7 +142,7 @@ "total": 1, "customMultiClassificationTasks": [ { - "lastUpdateDateTime": "2021-09-23T11:21:43.0697024Z", + "lastUpdateDateTime": "2021-09-26T18:37:44.1350634Z", "state": "succeeded", "results": { "statistics": { @@ -135,7 +153,7 @@ }, "documents": [ { - "id": "1", + "id": "0", "classifications": [ { "category": "BookRestaurant", @@ -149,7 +167,7 @@ "warnings": [] }, { - "id": "2", + "id": "1", "classifications": [], "statistics": { "charactersCount": 158, @@ -169,7 +187,7 @@ } ], "Variables": { - "RandomSeed": "463356788", + "RandomSeed": "1030528731", "TEXT_ANALYTICS_API_KEY": "Sanitized", "TEXT_ANALYTICS_ENDPOINT": "https://cognitiveweppe.azure-api.net" } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceWithStatisticsTest.json b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchConvenienceWithStatisticsTestAsync.json similarity index 65% rename from sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceWithStatisticsTest.json rename to sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchConvenienceWithStatisticsTestAsync.json index 88ad1f178fb8..a716eeb3b8e1 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceWithStatisticsTest.json +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchConvenienceWithStatisticsTestAsync.json @@ -4,13 +4,19 @@ "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze", "RequestMethod": "POST", "RequestHeaders": { - "Accept": "application/json, text/json", + "Accept": [ + "application/json", + "text/json" + ], "Content-Length": "564", "Content-Type": "application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-216a29552ed28c46b851957907f45c84-a846734f3babea40-00", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "99d32beb69c3b9825f9686a079fba41b", + "traceparent": "00-69a6a68e02741a4eab4537b054bbb732-497e0ccf34119345-00", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "d3acc983e1836ddde491f31a2c505a60", "x-ms-return-client-request-id": "true" }, "RequestBody": { @@ -41,42 +47,48 @@ }, "StatusCode": 202, "ResponseHeaders": { - "apim-request-id": "061b2964-6fd9-4cd9-8c99-3d77a79ab680", - "Date": "Thu, 23 Sep 2021 11:20:56 GMT", - "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/6d793c30-e79c-4f06-b75b-c94aaeb51f4c", + "apim-request-id": "a6db4736-71ee-4e05-a204-b73c532edc7f", + "Date": "Sun, 26 Sep 2021 18:37:58 GMT", + "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/84084a9e-ef7d-4060-b1c0-98a382e1d444", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "210" + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "2233" }, "ResponseBody": [] }, { - "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/6d793c30-e79c-4f06-b75b-c94aaeb51f4c?showStats=true", + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/84084a9e-ef7d-4060-b1c0-98a382e1d444?showStats=true", "RequestMethod": "GET", "RequestHeaders": { - "Accept": "application/json, text/json", + "Accept": [ + "application/json", + "text/json" + ], "Ocp-Apim-Subscription-Key": "Sanitized", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "188861fb3d232c31c87810b60bc0b006", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "05165df81797b263847ae86c0bea97b4", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "8eb987bf-ce92-42d9-a0a0-e8efb0a9fadd", + "apim-request-id": "b7eb1e97-024f-4421-8fbb-2ff038727151", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 23 Sep 2021 11:20:56 GMT", + "Date": "Sun, 26 Sep 2021 18:37:58 GMT", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "7" + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "9" }, "ResponseBody": { - "jobId": "6d793c30-e79c-4f06-b75b-c94aaeb51f4c", - "lastUpdateDateTime": "2021-09-23T11:20:56Z", - "createdDateTime": "2021-09-23T11:20:56Z", - "expirationDateTime": "2021-09-24T11:20:56Z", + "jobId": "84084a9e-ef7d-4060-b1c0-98a382e1d444", + "lastUpdateDateTime": "2021-09-26T18:37:59Z", + "createdDateTime": "2021-09-26T18:37:56Z", + "expirationDateTime": "2021-09-27T18:37:56Z", "status": "notStarted", "errors": [], "displayName": "NA", @@ -89,31 +101,37 @@ } }, { - "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/6d793c30-e79c-4f06-b75b-c94aaeb51f4c?showStats=true", + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/84084a9e-ef7d-4060-b1c0-98a382e1d444?showStats=true", "RequestMethod": "GET", "RequestHeaders": { - "Accept": "application/json, text/json", + "Accept": [ + "application/json", + "text/json" + ], "Ocp-Apim-Subscription-Key": "Sanitized", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "f4d09f0ac3b510dce0ac980580450cf0", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "d84eaa6132a7c9bbf0e418f64a0495e9", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "e06b993c-9ba2-4cf0-ad80-78b40428e564", + "apim-request-id": "dac0d2b9-45f7-485f-8ff8-cc720f8d716b", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 23 Sep 2021 11:20:58 GMT", + "Date": "Sun, 26 Sep 2021 18:38:00 GMT", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "66" + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "73" }, "ResponseBody": { - "jobId": "6d793c30-e79c-4f06-b75b-c94aaeb51f4c", - "lastUpdateDateTime": "2021-09-23T11:20:57Z", - "createdDateTime": "2021-09-23T11:20:56Z", - "expirationDateTime": "2021-09-24T11:20:56Z", + "jobId": "84084a9e-ef7d-4060-b1c0-98a382e1d444", + "lastUpdateDateTime": "2021-09-26T18:37:59Z", + "createdDateTime": "2021-09-26T18:37:56Z", + "expirationDateTime": "2021-09-27T18:37:56Z", "status": "succeeded", "errors": [], "displayName": "NA", @@ -124,7 +142,7 @@ "total": 1, "customMultiClassificationTasks": [ { - "lastUpdateDateTime": "2021-09-23T11:20:57.6945278Z", + "lastUpdateDateTime": "2021-09-26T18:37:59.5109722Z", "state": "succeeded", "results": { "statistics": { @@ -169,7 +187,7 @@ } ], "Variables": { - "RandomSeed": "1653911505", + "RandomSeed": "249617768", "TEXT_ANALYTICS_API_KEY": "Sanitized", "TEXT_ANALYTICS_ENDPOINT": "https://cognitiveweppe.azure-api.net" } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceTest.json b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchTest.json similarity index 63% rename from sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceTest.json rename to sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchTest.json index 535930950f14..e58299ab5a73 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceTest.json +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchTest.json @@ -4,25 +4,31 @@ "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze", "RequestMethod": "POST", "RequestHeaders": { - "Accept": "application/json, text/json", + "Accept": [ + "application/json", + "text/json" + ], "Content-Length": "564", "Content-Type": "application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-f112de12dc92cb4ab9c8dec7c08e57b5-710f5a0e7e980e47-00", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "8f6f8a55883a7457986c0480f2d6e14e", + "traceparent": "00-884e725b7c34b64d9d44875d8b56cfe2-51f7c2bf82e7fb41-00", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "f9a445d1945350412d315d0677481a7f", "x-ms-return-client-request-id": "true" }, "RequestBody": { "analysisInput": { "documents": [ { - "id": "0", + "id": "1", "text": "I need a reservation for an indoor restaurant in China. Please don\u0027t stop the music. Play music and add it to my playlist", "language": "en" }, { - "id": "1", + "id": "2", "text": "David Schmidt, senior vice president--Food Safety, International Food Information Council (IFIC), Washington, D.C., discussed the physical activity component.", "language": "en" } @@ -41,42 +47,48 @@ }, "StatusCode": 202, "ResponseHeaders": { - "apim-request-id": "7f7b56a5-f86c-44f4-983f-1fb2ceb75c3c", - "Date": "Thu, 23 Sep 2021 11:20:34 GMT", - "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/b2c1e7af-6698-4357-8e14-5fabbba5501f", + "apim-request-id": "8823e990-51ae-47fd-beb4-0c505ee6584a", + "Date": "Sun, 26 Sep 2021 18:37:44 GMT", + "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/bcc19ef9-c122-4f6c-8bae-f77f71a3830f", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", + "X-Content-Type-Options": "nosniff", "x-envoy-upstream-service-time": "169" }, "ResponseBody": [] }, { - "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/b2c1e7af-6698-4357-8e14-5fabbba5501f", + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/bcc19ef9-c122-4f6c-8bae-f77f71a3830f", "RequestMethod": "GET", "RequestHeaders": { - "Accept": "application/json, text/json", + "Accept": [ + "application/json", + "text/json" + ], "Ocp-Apim-Subscription-Key": "Sanitized", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "0197d076524904e36ebb2ecd0fe85877", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "65613fb5afe0d6dda7bcc933fe40034b", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "a358ddf3-481a-473a-a7bb-cbe420099d61", + "apim-request-id": "bab72ea3-c266-46c1-99cf-f5cd3bf52efd", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 23 Sep 2021 11:20:36 GMT", + "Date": "Sun, 26 Sep 2021 18:37:44 GMT", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", + "X-Content-Type-Options": "nosniff", "x-envoy-upstream-service-time": "8" }, "ResponseBody": { - "jobId": "b2c1e7af-6698-4357-8e14-5fabbba5501f", - "lastUpdateDateTime": "2021-09-23T11:20:35Z", - "createdDateTime": "2021-09-23T11:20:35Z", - "expirationDateTime": "2021-09-24T11:20:35Z", + "jobId": "bcc19ef9-c122-4f6c-8bae-f77f71a3830f", + "lastUpdateDateTime": "2021-09-26T18:37:45Z", + "createdDateTime": "2021-09-26T18:37:45Z", + "expirationDateTime": "2021-09-27T18:37:45Z", "status": "notStarted", "errors": [], "displayName": "NA", @@ -89,31 +101,37 @@ } }, { - "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/b2c1e7af-6698-4357-8e14-5fabbba5501f", + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/bcc19ef9-c122-4f6c-8bae-f77f71a3830f", "RequestMethod": "GET", "RequestHeaders": { - "Accept": "application/json, text/json", + "Accept": [ + "application/json", + "text/json" + ], "Ocp-Apim-Subscription-Key": "Sanitized", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "82a65baaf78c925bb637ab8d4021698a", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "90f7abee75aa105484220d8a1c28422b", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "425f7f5a-6e6a-497a-ba85-275c076893e6", + "apim-request-id": "91a44607-a742-462c-a94f-31619aa5d8c5", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 23 Sep 2021 11:20:37 GMT", + "Date": "Sun, 26 Sep 2021 18:37:46 GMT", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "71" + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "79" }, "ResponseBody": { - "jobId": "b2c1e7af-6698-4357-8e14-5fabbba5501f", - "lastUpdateDateTime": "2021-09-23T11:20:36Z", - "createdDateTime": "2021-09-23T11:20:35Z", - "expirationDateTime": "2021-09-24T11:20:35Z", + "jobId": "bcc19ef9-c122-4f6c-8bae-f77f71a3830f", + "lastUpdateDateTime": "2021-09-26T18:37:46Z", + "createdDateTime": "2021-09-26T18:37:45Z", + "expirationDateTime": "2021-09-27T18:37:45Z", "status": "succeeded", "errors": [], "displayName": "NA", @@ -124,12 +142,12 @@ "total": 1, "customMultiClassificationTasks": [ { - "lastUpdateDateTime": "2021-09-23T11:20:36.5283021Z", + "lastUpdateDateTime": "2021-09-26T18:37:46.1831369Z", "state": "succeeded", "results": { "documents": [ { - "id": "0", + "id": "1", "classifications": [ { "category": "BookRestaurant", @@ -139,7 +157,7 @@ "warnings": [] }, { - "id": "1", + "id": "2", "classifications": [], "warnings": [] } @@ -155,7 +173,7 @@ } ], "Variables": { - "RandomSeed": "199054673", + "RandomSeed": "1987453593", "TEXT_ANALYTICS_API_KEY": "Sanitized", "TEXT_ANALYTICS_ENDPOINT": "https://cognitiveweppe.azure-api.net" } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchTestAsync.json b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchTestAsync.json similarity index 63% rename from sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchTestAsync.json rename to sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchTestAsync.json index de8db7799863..c9d1723d37bf 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchTestAsync.json +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchTestAsync.json @@ -4,13 +4,19 @@ "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze", "RequestMethod": "POST", "RequestHeaders": { - "Accept": "application/json, text/json", + "Accept": [ + "application/json", + "text/json" + ], "Content-Length": "564", "Content-Type": "application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-e0372db381eeba4ebbbcca17db2b5fb3-8bee75a134fca741-00", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "8120c6641f6ed90c9a0460d20d63ba4b", + "traceparent": "00-d83ce7d210e16846a1f3d3bc96945df4-b6c0d583a4f2964c-00", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "a6386bfba6299a3233a2dfd0f0d681ac", "x-ms-return-client-request-id": "true" }, "RequestBody": { @@ -41,42 +47,48 @@ }, "StatusCode": 202, "ResponseHeaders": { - "apim-request-id": "167171fe-c16d-4336-b562-ef9d0de0489f", - "Date": "Thu, 23 Sep 2021 11:21:24 GMT", - "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/a99eb920-f7a2-4ba4-95b8-73d369be7813", + "apim-request-id": "623a527a-e13d-4254-953c-c0688c208f4b", + "Date": "Sun, 26 Sep 2021 18:38:00 GMT", + "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/22393095-ec98-4a21-9a05-4695868d3bb7", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "170" + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "154" }, "ResponseBody": [] }, { - "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/a99eb920-f7a2-4ba4-95b8-73d369be7813", + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/22393095-ec98-4a21-9a05-4695868d3bb7", "RequestMethod": "GET", "RequestHeaders": { - "Accept": "application/json, text/json", + "Accept": [ + "application/json", + "text/json" + ], "Ocp-Apim-Subscription-Key": "Sanitized", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "66826a2828d115792013c91ec5834498", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "99df5d7a9160810d2c4cc6a396618219", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "0e747844-38ee-4ff7-ad9a-738580d2758e", + "apim-request-id": "657f11ff-891e-41bd-97e8-42dbe18b87be", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 23 Sep 2021 11:21:25 GMT", + "Date": "Sun, 26 Sep 2021 18:38:00 GMT", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "9" + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "8" }, "ResponseBody": { - "jobId": "a99eb920-f7a2-4ba4-95b8-73d369be7813", - "lastUpdateDateTime": "2021-09-23T11:21:25Z", - "createdDateTime": "2021-09-23T11:21:24Z", - "expirationDateTime": "2021-09-24T11:21:24Z", + "jobId": "22393095-ec98-4a21-9a05-4695868d3bb7", + "lastUpdateDateTime": "2021-09-26T18:38:00Z", + "createdDateTime": "2021-09-26T18:38:00Z", + "expirationDateTime": "2021-09-27T18:38:00Z", "status": "notStarted", "errors": [], "displayName": "NA", @@ -89,31 +101,37 @@ } }, { - "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/a99eb920-f7a2-4ba4-95b8-73d369be7813", + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/22393095-ec98-4a21-9a05-4695868d3bb7", "RequestMethod": "GET", "RequestHeaders": { - "Accept": "application/json, text/json", + "Accept": [ + "application/json", + "text/json" + ], "Ocp-Apim-Subscription-Key": "Sanitized", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "c32b267537ab4075339e754ddcf643bb", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "bee2f736dbdadf841f035712b1c9634d", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "21bce51b-c50d-4094-8c17-16e762e96ef2", + "apim-request-id": "040bc84b-b16d-4648-905b-9583d24d8f2c", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 23 Sep 2021 11:21:26 GMT", + "Date": "Sun, 26 Sep 2021 18:38:01 GMT", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "78" + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "68" }, "ResponseBody": { - "jobId": "a99eb920-f7a2-4ba4-95b8-73d369be7813", - "lastUpdateDateTime": "2021-09-23T11:21:25Z", - "createdDateTime": "2021-09-23T11:21:24Z", - "expirationDateTime": "2021-09-24T11:21:24Z", + "jobId": "22393095-ec98-4a21-9a05-4695868d3bb7", + "lastUpdateDateTime": "2021-09-26T18:38:01Z", + "createdDateTime": "2021-09-26T18:38:00Z", + "expirationDateTime": "2021-09-27T18:38:00Z", "status": "succeeded", "errors": [], "displayName": "NA", @@ -124,7 +142,7 @@ "total": 1, "customMultiClassificationTasks": [ { - "lastUpdateDateTime": "2021-09-23T11:21:25.9206799Z", + "lastUpdateDateTime": "2021-09-26T18:38:01.3413113Z", "state": "succeeded", "results": { "documents": [ @@ -155,7 +173,7 @@ } ], "Variables": { - "RandomSeed": "1989776014", + "RandomSeed": "542519583", "TEXT_ANALYTICS_API_KEY": "Sanitized", "TEXT_ANALYTICS_ENDPOINT": "https://cognitiveweppe.azure-api.net" } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchWithErrorTest.json b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchWithErrorTest.json new file mode 100644 index 000000000000..909953656e2f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchWithErrorTest.json @@ -0,0 +1,311 @@ +{ + "Entries": [ + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": [ + "application/json", + "text/json" + ], + "Content-Length": "328", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-13a06e1deedf2148b8b798a6251cc0c3-7ab3734356fc9542-00", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "b3f00d59ecdaec71d23ecfd808fcaa3b", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "analysisInput": { + "documents": [ + { + "id": "0", + "text": "Subject is taking 100mg of ibuprofen twice daily", + "language": "en" + }, + { + "id": "1", + "text": "", + "language": "en" + } + ] + }, + "tasks": { + "customMultiClassificationTasks": [ + { + "parameters": { + "project-name": "7cdace98-537b-494a-b69a-c19754718025", + "deployment-name": "7cdace98-537b-494a-b69a-c19754718025" + } + } + ] + } + }, + "StatusCode": 202, + "ResponseHeaders": { + "apim-request-id": "61a6a2f0-77a8-4241-a585-0734872b315a", + "Date": "Sun, 26 Sep 2021 18:37:46 GMT", + "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/9580a26d-74d0-4c56-b4c8-57432b6d8da3", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "230" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/9580a26d-74d0-4c56-b4c8-57432b6d8da3", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": [ + "application/json", + "text/json" + ], + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "dea2929332df74905c54c3965e08e957", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "53e0ff42-b9d2-4e52-ae6a-238d099f9b8c", + "Content-Type": "application/json; charset=utf-8", + "Date": "Sun, 26 Sep 2021 18:37:46 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "9" + }, + "ResponseBody": { + "jobId": "9580a26d-74d0-4c56-b4c8-57432b6d8da3", + "lastUpdateDateTime": "2021-09-26T18:37:47Z", + "createdDateTime": "2021-09-26T18:37:46Z", + "expirationDateTime": "2021-09-27T18:37:46Z", + "status": "notStarted", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 0, + "failed": 0, + "inProgress": 1, + "total": 1 + } + } + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/9580a26d-74d0-4c56-b4c8-57432b6d8da3", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": [ + "application/json", + "text/json" + ], + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "0c7a0cb56d21b31947ac409a90ebc30d", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "4ee221ba-b525-4de3-9b44-cd1c7d97c269", + "Content-Type": "application/json; charset=utf-8", + "Date": "Sun, 26 Sep 2021 18:37:48 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "10" + }, + "ResponseBody": { + "jobId": "9580a26d-74d0-4c56-b4c8-57432b6d8da3", + "lastUpdateDateTime": "2021-09-26T18:37:47Z", + "createdDateTime": "2021-09-26T18:37:46Z", + "expirationDateTime": "2021-09-27T18:37:46Z", + "status": "running", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 0, + "failed": 0, + "inProgress": 1, + "total": 1 + } + } + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/9580a26d-74d0-4c56-b4c8-57432b6d8da3", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": [ + "application/json", + "text/json" + ], + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "bdf42c59a9ff26547d7c578529da8dc9", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "34c627a9-f5a5-4f93-80d2-20bcee1f798a", + "Content-Type": "application/json; charset=utf-8", + "Date": "Sun, 26 Sep 2021 18:37:49 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "7" + }, + "ResponseBody": { + "jobId": "9580a26d-74d0-4c56-b4c8-57432b6d8da3", + "lastUpdateDateTime": "2021-09-26T18:37:47Z", + "createdDateTime": "2021-09-26T18:37:46Z", + "expirationDateTime": "2021-09-27T18:37:46Z", + "status": "running", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 0, + "failed": 0, + "inProgress": 1, + "total": 1 + } + } + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/9580a26d-74d0-4c56-b4c8-57432b6d8da3", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": [ + "application/json", + "text/json" + ], + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "fc2277549d81251978ee9733f2f5e370", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "31a00c55-ee67-4a29-b9f2-64ecc5b42893", + "Content-Type": "application/json; charset=utf-8", + "Date": "Sun, 26 Sep 2021 18:37:50 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "8" + }, + "ResponseBody": { + "jobId": "9580a26d-74d0-4c56-b4c8-57432b6d8da3", + "lastUpdateDateTime": "2021-09-26T18:37:47Z", + "createdDateTime": "2021-09-26T18:37:46Z", + "expirationDateTime": "2021-09-27T18:37:46Z", + "status": "running", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 0, + "failed": 0, + "inProgress": 1, + "total": 1 + } + } + }, + { + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/9580a26d-74d0-4c56-b4c8-57432b6d8da3", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": [ + "application/json", + "text/json" + ], + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "323db5902c140b58b8548ea515938a6c", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "da7b36a3-0312-4129-9368-eb2cf1ac5801", + "Content-Type": "application/json; charset=utf-8", + "Date": "Sun, 26 Sep 2021 18:37:51 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "86" + }, + "ResponseBody": { + "jobId": "9580a26d-74d0-4c56-b4c8-57432b6d8da3", + "lastUpdateDateTime": "2021-09-26T18:37:50Z", + "createdDateTime": "2021-09-26T18:37:46Z", + "expirationDateTime": "2021-09-27T18:37:46Z", + "status": "succeeded", + "errors": [], + "displayName": "NA", + "tasks": { + "completed": 1, + "failed": 0, + "inProgress": 0, + "total": 1, + "customMultiClassificationTasks": [ + { + "lastUpdateDateTime": "2021-09-26T18:37:50.7704268Z", + "state": "succeeded", + "results": { + "documents": [ + { + "id": "0", + "classifications": [], + "warnings": [] + } + ], + "errors": [ + { + "id": "1", + "error": { + "code": "InvalidArgument", + "message": "Invalid document in request.", + "innererror": { + "code": "InvalidDocument", + "message": "Document text is empty." + } + } + } + ], + "projectName": "7cdace98-537b-494a-b69a-c19754718025", + "deploymentName": "7cdace98-537b-494a-b69a-c19754718025" + } + } + ] + } + } + } + ], + "Variables": { + "RandomSeed": "651258290", + "TEXT_ANALYTICS_API_KEY": "Sanitized", + "TEXT_ANALYTICS_ENDPOINT": "https://cognitiveweppe.azure-api.net" + } +} \ No newline at end of file diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithErrorTest.json b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchWithErrorTestAsync.json similarity index 62% rename from sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithErrorTest.json rename to sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchWithErrorTestAsync.json index c31a965abbca..49fdbe12b527 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithErrorTest.json +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchWithErrorTestAsync.json @@ -4,13 +4,19 @@ "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze", "RequestMethod": "POST", "RequestHeaders": { - "Accept": "application/json, text/json", + "Accept": [ + "application/json", + "text/json" + ], "Content-Length": "328", "Content-Type": "application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-3295b1e1fe1a3847b13ed9a7e425747a-20c5e0bc0e06ee4c-00", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "dba8a64399876b7cf246e46bf1121ed2", + "traceparent": "00-9af02393cc01c544a01af7f480b0768d-2f536da3f9a2cc4b-00", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "30f3d0aaed959b158d1c03a1c38ed196", "x-ms-return-client-request-id": "true" }, "RequestBody": { @@ -41,42 +47,48 @@ }, "StatusCode": 202, "ResponseHeaders": { - "apim-request-id": "315cf819-6325-449d-93fc-7208981fd63a", - "Date": "Thu, 23 Sep 2021 11:20:14 GMT", - "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/00d95567-5a5a-4613-8ca3-3defeb9c35cb", + "apim-request-id": "465345ff-5570-48d1-90fd-b999dc732c45", + "Date": "Sun, 26 Sep 2021 18:38:01 GMT", + "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/dc370ca0-347e-4326-85a4-343ebd44f701", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "337" + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "151" }, "ResponseBody": [] }, { - "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/00d95567-5a5a-4613-8ca3-3defeb9c35cb", + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/dc370ca0-347e-4326-85a4-343ebd44f701", "RequestMethod": "GET", "RequestHeaders": { - "Accept": "application/json, text/json", + "Accept": [ + "application/json", + "text/json" + ], "Ocp-Apim-Subscription-Key": "Sanitized", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "b5b12043754771bfcc5badf19472986f", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "c825cb4a1b45c0a38d00c26413634bd4", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "ba28fff5-a295-432c-8cc0-d131ba7c309d", + "apim-request-id": "ca2baa62-eb40-49e4-8b79-a1181b25ef46", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 23 Sep 2021 11:20:14 GMT", + "Date": "Sun, 26 Sep 2021 18:38:01 GMT", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "15" + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "8" }, "ResponseBody": { - "jobId": "00d95567-5a5a-4613-8ca3-3defeb9c35cb", - "lastUpdateDateTime": "2021-09-23T11:20:15Z", - "createdDateTime": "2021-09-23T11:20:14Z", - "expirationDateTime": "2021-09-24T11:20:14Z", + "jobId": "dc370ca0-347e-4326-85a4-343ebd44f701", + "lastUpdateDateTime": "2021-09-26T18:38:02Z", + "createdDateTime": "2021-09-26T18:38:02Z", + "expirationDateTime": "2021-09-27T18:38:02Z", "status": "running", "errors": [], "displayName": "NA", @@ -89,31 +101,37 @@ } }, { - "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/00d95567-5a5a-4613-8ca3-3defeb9c35cb", + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/dc370ca0-347e-4326-85a4-343ebd44f701", "RequestMethod": "GET", "RequestHeaders": { - "Accept": "application/json, text/json", + "Accept": [ + "application/json", + "text/json" + ], "Ocp-Apim-Subscription-Key": "Sanitized", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "7e4b8d2d6047048d3a60424b48a1f201", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "cbdf5eda5e441b482047cd1f76afb55d", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "7023c37f-deb6-414c-b427-761cc29b14ef", + "apim-request-id": "ec3df33f-724a-47c7-b09e-d55444b9a2a5", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 23 Sep 2021 11:20:16 GMT", + "Date": "Sun, 26 Sep 2021 18:38:03 GMT", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "189" + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "77" }, "ResponseBody": { - "jobId": "00d95567-5a5a-4613-8ca3-3defeb9c35cb", - "lastUpdateDateTime": "2021-09-23T11:20:15Z", - "createdDateTime": "2021-09-23T11:20:14Z", - "expirationDateTime": "2021-09-24T11:20:14Z", + "jobId": "dc370ca0-347e-4326-85a4-343ebd44f701", + "lastUpdateDateTime": "2021-09-26T18:38:02Z", + "createdDateTime": "2021-09-26T18:38:02Z", + "expirationDateTime": "2021-09-27T18:38:02Z", "status": "succeeded", "errors": [], "displayName": "NA", @@ -124,7 +142,7 @@ "total": 1, "customMultiClassificationTasks": [ { - "lastUpdateDateTime": "2021-09-23T11:20:15.331449Z", + "lastUpdateDateTime": "2021-09-26T18:38:02.4139547Z", "state": "succeeded", "results": { "documents": [ @@ -157,7 +175,7 @@ } ], "Variables": { - "RandomSeed": "345946910", + "RandomSeed": "1364887234", "TEXT_ANALYTICS_API_KEY": "Sanitized", "TEXT_ANALYTICS_ENDPOINT": "https://cognitiveweppe.azure-api.net" } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithStatisticsTestAsync.json b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchWithStatisticsTest.json similarity index 65% rename from sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithStatisticsTestAsync.json rename to sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchWithStatisticsTest.json index faccb6d6af2f..69b46076d79f 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchWithStatisticsTestAsync.json +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchWithStatisticsTest.json @@ -4,13 +4,19 @@ "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze", "RequestMethod": "POST", "RequestHeaders": { - "Accept": "application/json, text/json", + "Accept": [ + "application/json", + "text/json" + ], "Content-Length": "564", "Content-Type": "application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-6e142811a0ef5848afb223ece6625277-df1789e59e84274e-00", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "0989596639103ef904a00a515f729506", + "traceparent": "00-a734d594c9d9da4ca366b06a19dcddb1-7216aa4d97934b40-00", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "1d267b1dc6373f818e2ae2b8b6729718", "x-ms-return-client-request-id": "true" }, "RequestBody": { @@ -41,43 +47,49 @@ }, "StatusCode": 202, "ResponseHeaders": { - "apim-request-id": "2180a8fe-b522-4284-ae20-18cbe67a6977", - "Date": "Thu, 23 Sep 2021 11:21:43 GMT", - "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/5cbf4b66-68d0-4dbc-b3e6-207c0ae2ac07", + "apim-request-id": "619c4219-f366-4c4a-850a-8a40fb12eaf3", + "Date": "Sun, 26 Sep 2021 18:37:51 GMT", + "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/9d17ec2c-7068-4ad1-8a5b-f7aa17ae7fba", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "213" + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "154" }, "ResponseBody": [] }, { - "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/5cbf4b66-68d0-4dbc-b3e6-207c0ae2ac07?showStats=true", + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/9d17ec2c-7068-4ad1-8a5b-f7aa17ae7fba?showStats=true", "RequestMethod": "GET", "RequestHeaders": { - "Accept": "application/json, text/json", + "Accept": [ + "application/json", + "text/json" + ], "Ocp-Apim-Subscription-Key": "Sanitized", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "45e51d0216f3aa82ac8d662f4ea84548", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "d6a026686d0319ef4fd032da4c5ed795", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "dc5e56c6-81ba-4f85-9d1a-ae459490f6c9", + "apim-request-id": "0c58573a-522b-4c93-bb36-2b579dc6996f", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 23 Sep 2021 11:21:43 GMT", + "Date": "Sun, 26 Sep 2021 18:37:51 GMT", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "7" + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "8" }, "ResponseBody": { - "jobId": "5cbf4b66-68d0-4dbc-b3e6-207c0ae2ac07", - "lastUpdateDateTime": "2021-09-23T11:21:44Z", - "createdDateTime": "2021-09-23T11:21:44Z", - "expirationDateTime": "2021-09-24T11:21:44Z", - "status": "notStarted", + "jobId": "9d17ec2c-7068-4ad1-8a5b-f7aa17ae7fba", + "lastUpdateDateTime": "2021-09-26T18:37:52Z", + "createdDateTime": "2021-09-26T18:37:51Z", + "expirationDateTime": "2021-09-27T18:37:51Z", + "status": "running", "errors": [], "displayName": "NA", "tasks": { @@ -89,31 +101,37 @@ } }, { - "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/5cbf4b66-68d0-4dbc-b3e6-207c0ae2ac07?showStats=true", + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/9d17ec2c-7068-4ad1-8a5b-f7aa17ae7fba?showStats=true", "RequestMethod": "GET", "RequestHeaders": { - "Accept": "application/json, text/json", + "Accept": [ + "application/json", + "text/json" + ], "Ocp-Apim-Subscription-Key": "Sanitized", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "17cdb58ba6256c4d4373b64dd5207a3d", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "9bd4d20f26905b2abbe44e8557974917", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "8e6b48f0-2669-4b9d-84b8-202254376c77", + "apim-request-id": "1f696025-dfc9-4096-93a4-fb1feb077b57", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 23 Sep 2021 11:21:45 GMT", + "Date": "Sun, 26 Sep 2021 18:37:53 GMT", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "70" + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "73" }, "ResponseBody": { - "jobId": "5cbf4b66-68d0-4dbc-b3e6-207c0ae2ac07", - "lastUpdateDateTime": "2021-09-23T11:21:45Z", - "createdDateTime": "2021-09-23T11:21:44Z", - "expirationDateTime": "2021-09-24T11:21:44Z", + "jobId": "9d17ec2c-7068-4ad1-8a5b-f7aa17ae7fba", + "lastUpdateDateTime": "2021-09-26T18:37:52Z", + "createdDateTime": "2021-09-26T18:37:51Z", + "expirationDateTime": "2021-09-27T18:37:51Z", "status": "succeeded", "errors": [], "displayName": "NA", @@ -124,7 +142,7 @@ "total": 1, "customMultiClassificationTasks": [ { - "lastUpdateDateTime": "2021-09-23T11:21:45.0964217Z", + "lastUpdateDateTime": "2021-09-26T18:37:52.207536Z", "state": "succeeded", "results": { "statistics": { @@ -169,7 +187,7 @@ } ], "Variables": { - "RandomSeed": "2081690880", + "RandomSeed": "1494605637", "TEXT_ANALYTICS_API_KEY": "Sanitized", "TEXT_ANALYTICS_ENDPOINT": "https://cognitiveweppe.azure-api.net" } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceWithStatisticsTestAsync.json b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchWithStatisticsTestAsync.json similarity index 66% rename from sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceWithStatisticsTestAsync.json rename to sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchWithStatisticsTestAsync.json index 437e524df829..958ba8eaf7e3 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesBatchConvenienceWithStatisticsTestAsync.json +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyBatchWithStatisticsTestAsync.json @@ -4,25 +4,31 @@ "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze", "RequestMethod": "POST", "RequestHeaders": { - "Accept": "application/json, text/json", + "Accept": [ + "application/json", + "text/json" + ], "Content-Length": "564", "Content-Type": "application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-b0c3b1b118c6d9438ced80fbe5515af6-714f1e0d1e2cda44-00", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "a0c0f2ee56754e2a26d7f628c9643a49", + "traceparent": "00-c2714305fbbc544fbdaf8ce12d06cb5a-7af9a8ca7992654e-00", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "906b58cad58335a5847440566fdf9175", "x-ms-return-client-request-id": "true" }, "RequestBody": { "analysisInput": { "documents": [ { - "id": "0", + "id": "1", "text": "I need a reservation for an indoor restaurant in China. Please don\u0027t stop the music. Play music and add it to my playlist", "language": "en" }, { - "id": "1", + "id": "2", "text": "David Schmidt, senior vice president--Food Safety, International Food Information Council (IFIC), Washington, D.C., discussed the physical activity component.", "language": "en" } @@ -41,42 +47,48 @@ }, "StatusCode": 202, "ResponseHeaders": { - "apim-request-id": "7f367e93-1986-4732-8311-75544eab6d73", - "Date": "Thu, 23 Sep 2021 11:20:59 GMT", - "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/b24330e1-1a6e-469f-a9f7-5d44bcd64106", + "apim-request-id": "b8b9c71d-e20d-4616-924b-9bf33e1f5b80", + "Date": "Sun, 26 Sep 2021 18:38:03 GMT", + "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/7d7bc432-9155-4740-b33c-5fd2dafe8789", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "165" + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "179" }, "ResponseBody": [] }, { - "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/b24330e1-1a6e-469f-a9f7-5d44bcd64106?showStats=true", + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/7d7bc432-9155-4740-b33c-5fd2dafe8789?showStats=true", "RequestMethod": "GET", "RequestHeaders": { - "Accept": "application/json, text/json", + "Accept": [ + "application/json", + "text/json" + ], "Ocp-Apim-Subscription-Key": "Sanitized", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "6b6fa979d71d14af41eb863d3ecd3152", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "d7bd2b96de4822366676f3e88d30af2c", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "7dad27fe-a855-4d87-94dd-1a66d1e39003", + "apim-request-id": "0b62bd24-ec0e-421e-9087-115b6a7aa365", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 23 Sep 2021 11:20:59 GMT", + "Date": "Sun, 26 Sep 2021 18:38:03 GMT", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "7" + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "8" }, "ResponseBody": { - "jobId": "b24330e1-1a6e-469f-a9f7-5d44bcd64106", - "lastUpdateDateTime": "2021-09-23T11:20:59Z", - "createdDateTime": "2021-09-23T11:20:59Z", - "expirationDateTime": "2021-09-24T11:20:59Z", + "jobId": "7d7bc432-9155-4740-b33c-5fd2dafe8789", + "lastUpdateDateTime": "2021-09-26T18:38:03Z", + "createdDateTime": "2021-09-26T18:38:03Z", + "expirationDateTime": "2021-09-27T18:38:03Z", "status": "notStarted", "errors": [], "displayName": "NA", @@ -89,31 +101,37 @@ } }, { - "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/b24330e1-1a6e-469f-a9f7-5d44bcd64106?showStats=true", + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/7d7bc432-9155-4740-b33c-5fd2dafe8789?showStats=true", "RequestMethod": "GET", "RequestHeaders": { - "Accept": "application/json, text/json", + "Accept": [ + "application/json", + "text/json" + ], "Ocp-Apim-Subscription-Key": "Sanitized", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "250107a830b633cfe1435fe579f14b6b", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "0b245d4008ebad99d3b8e00231144551", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "26fc17b0-e90b-424c-b70c-0ff9d9d19477", + "apim-request-id": "e6fbc09f-e01b-4143-9854-284e2dbad044", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 23 Sep 2021 11:21:00 GMT", + "Date": "Sun, 26 Sep 2021 18:38:05 GMT", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", + "X-Content-Type-Options": "nosniff", "x-envoy-upstream-service-time": "75" }, "ResponseBody": { - "jobId": "b24330e1-1a6e-469f-a9f7-5d44bcd64106", - "lastUpdateDateTime": "2021-09-23T11:21:00Z", - "createdDateTime": "2021-09-23T11:20:59Z", - "expirationDateTime": "2021-09-24T11:20:59Z", + "jobId": "7d7bc432-9155-4740-b33c-5fd2dafe8789", + "lastUpdateDateTime": "2021-09-26T18:38:04Z", + "createdDateTime": "2021-09-26T18:38:03Z", + "expirationDateTime": "2021-09-27T18:38:03Z", "status": "succeeded", "errors": [], "displayName": "NA", @@ -124,7 +142,7 @@ "total": 1, "customMultiClassificationTasks": [ { - "lastUpdateDateTime": "2021-09-23T11:21:00.7248412Z", + "lastUpdateDateTime": "2021-09-26T18:38:04.438308Z", "state": "succeeded", "results": { "statistics": { @@ -135,7 +153,7 @@ }, "documents": [ { - "id": "0", + "id": "1", "classifications": [ { "category": "BookRestaurant", @@ -149,7 +167,7 @@ "warnings": [] }, { - "id": "1", + "id": "2", "classifications": [], "statistics": { "charactersCount": 158, @@ -169,7 +187,7 @@ } ], "Variables": { - "RandomSeed": "712696846", + "RandomSeed": "156613535", "TEXT_ANALYTICS_API_KEY": "Sanitized", "TEXT_ANALYTICS_ENDPOINT": "https://cognitiveweppe.azure-api.net" } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesWithDisableServiceLogsAsync.json b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyWithDisableServiceLogs.json similarity index 63% rename from sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesWithDisableServiceLogsAsync.json rename to sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyWithDisableServiceLogs.json index 5ba82d761ef1..aefebd413985 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesWithDisableServiceLogsAsync.json +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyWithDisableServiceLogs.json @@ -4,13 +4,19 @@ "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze", "RequestMethod": "POST", "RequestHeaders": { - "Accept": "application/json, text/json", + "Accept": [ + "application/json", + "text/json" + ], "Content-Length": "585", "Content-Type": "application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-1dc4fc54d7b00445a833a9e7bf8853e4-da598f49234e4348-00", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "8289b281ef10f25210e42cf6bf093bf2", + "traceparent": "00-c5ef0d263be436429b9751876001e38c-519027e4812b7242-00", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "240aa7eee3f5791310c87f0aea43f279", "x-ms-return-client-request-id": "true" }, "RequestBody": { @@ -42,42 +48,48 @@ }, "StatusCode": 202, "ResponseHeaders": { - "apim-request-id": "c6ba4471-2eb4-4dbf-951a-94280babd66b", - "Date": "Thu, 23 Sep 2021 11:19:52 GMT", - "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/7f1096ac-1064-4c7b-b409-bcc85a14922c", + "apim-request-id": "68b8b827-3c95-4012-80d5-07e869d86d7b", + "Date": "Sun, 26 Sep 2021 18:37:53 GMT", + "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/f1c090c9-e2dd-4a1a-b901-d81d253477af", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "183" + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "188" }, "ResponseBody": [] }, { - "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/7f1096ac-1064-4c7b-b409-bcc85a14922c", + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/f1c090c9-e2dd-4a1a-b901-d81d253477af", "RequestMethod": "GET", "RequestHeaders": { - "Accept": "application/json, text/json", + "Accept": [ + "application/json", + "text/json" + ], "Ocp-Apim-Subscription-Key": "Sanitized", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "321195cd4c5a557ea80a36e79a8e2c17", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "033483e2516ec9aa820c90ec10e84892", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "49508c32-84c3-4c0e-beb6-10229b995ff7", + "apim-request-id": "ce762aba-e99c-485c-9028-de67986fe77c", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 23 Sep 2021 11:19:52 GMT", + "Date": "Sun, 26 Sep 2021 18:37:53 GMT", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", + "X-Content-Type-Options": "nosniff", "x-envoy-upstream-service-time": "8" }, "ResponseBody": { - "jobId": "7f1096ac-1064-4c7b-b409-bcc85a14922c", - "lastUpdateDateTime": "2021-09-23T11:19:53Z", - "createdDateTime": "2021-09-23T11:19:52Z", - "expirationDateTime": "2021-09-24T11:19:52Z", + "jobId": "f1c090c9-e2dd-4a1a-b901-d81d253477af", + "lastUpdateDateTime": "2021-09-26T18:37:53Z", + "createdDateTime": "2021-09-26T18:37:53Z", + "expirationDateTime": "2021-09-27T18:37:53Z", "status": "notStarted", "errors": [], "displayName": "NA", @@ -90,31 +102,37 @@ } }, { - "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/7f1096ac-1064-4c7b-b409-bcc85a14922c", + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/f1c090c9-e2dd-4a1a-b901-d81d253477af", "RequestMethod": "GET", "RequestHeaders": { - "Accept": "application/json, text/json", + "Accept": [ + "application/json", + "text/json" + ], "Ocp-Apim-Subscription-Key": "Sanitized", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "e00bbf98ed504d970060f48927b5d603", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "ac8394b2f677be1091d284ab791b8c09", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "e1e750c3-3842-494a-b294-2760bfb4b8d5", + "apim-request-id": "f63d24c7-4100-4327-9bd6-ade3253f06c7", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 23 Sep 2021 11:19:54 GMT", + "Date": "Sun, 26 Sep 2021 18:37:55 GMT", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "72" + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "93" }, "ResponseBody": { - "jobId": "7f1096ac-1064-4c7b-b409-bcc85a14922c", - "lastUpdateDateTime": "2021-09-23T11:19:54Z", - "createdDateTime": "2021-09-23T11:19:52Z", - "expirationDateTime": "2021-09-24T11:19:52Z", + "jobId": "f1c090c9-e2dd-4a1a-b901-d81d253477af", + "lastUpdateDateTime": "2021-09-26T18:37:54Z", + "createdDateTime": "2021-09-26T18:37:53Z", + "expirationDateTime": "2021-09-27T18:37:53Z", "status": "succeeded", "errors": [], "displayName": "NA", @@ -125,7 +143,7 @@ "total": 1, "customMultiClassificationTasks": [ { - "lastUpdateDateTime": "2021-09-23T11:19:54.1978299Z", + "lastUpdateDateTime": "2021-09-26T18:37:54.2581916Z", "state": "succeeded", "results": { "documents": [ @@ -156,7 +174,7 @@ } ], "Variables": { - "RandomSeed": "2132109812", + "RandomSeed": "1222401182", "TEXT_ANALYTICS_API_KEY": "Sanitized", "TEXT_ANALYTICS_ENDPOINT": "https://cognitiveweppe.azure-api.net" } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesWithDisableServiceLogs.json b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyWithDisableServiceLogsAsync.json similarity index 63% rename from sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesWithDisableServiceLogs.json rename to sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyWithDisableServiceLogsAsync.json index df1dca578860..a37014c4df64 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/ClassifyCustomCategoriesTests/ClassifyCustomCategoriesWithDisableServiceLogs.json +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/MultiCategoryClassifyTests/MultiCategoryClassifyWithDisableServiceLogsAsync.json @@ -4,13 +4,19 @@ "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze", "RequestMethod": "POST", "RequestHeaders": { - "Accept": "application/json, text/json", + "Accept": [ + "application/json", + "text/json" + ], "Content-Length": "585", "Content-Type": "application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-633e81da0c481d43b3edc9b1f0f678a1-145be1c148087946-00", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "dd8512c408e3f98b7b13cd6a87bf57b4", + "traceparent": "00-bebbdf6a93e0da4cb8bce44a539d4c08-53d03d48247aa54a-00", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "0cc53751b5e8088ad70bde584eea5b24", "x-ms-return-client-request-id": "true" }, "RequestBody": { @@ -42,42 +48,48 @@ }, "StatusCode": 202, "ResponseHeaders": { - "apim-request-id": "d946cbc6-8c0a-4770-b8fb-2bcb242f179a", - "Date": "Thu, 23 Sep 2021 11:19:50 GMT", - "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/3b5aec18-9081-4e9d-9c13-fcdd4f8d5269", + "apim-request-id": "b7dd0470-0b60-4d59-a78f-77f43e03c512", + "Date": "Sun, 26 Sep 2021 18:38:05 GMT", + "operation-location": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/df191a86-500d-40c8-93a5-0f3fdfca8063", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "258" + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "168" }, "ResponseBody": [] }, { - "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/3b5aec18-9081-4e9d-9c13-fcdd4f8d5269", + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/df191a86-500d-40c8-93a5-0f3fdfca8063", "RequestMethod": "GET", "RequestHeaders": { - "Accept": "application/json, text/json", + "Accept": [ + "application/json", + "text/json" + ], "Ocp-Apim-Subscription-Key": "Sanitized", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "9eb47ee3189f820516a7d87cb8e236f7", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "920ad4e241f22235a613d50d0c9708ba", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "86f71569-601d-4d32-97d3-e66c2852ad5f", + "apim-request-id": "425340ab-51a1-4433-8ea3-972190949e14", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 23 Sep 2021 11:19:50 GMT", + "Date": "Sun, 26 Sep 2021 18:38:05 GMT", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "18" + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "8" }, "ResponseBody": { - "jobId": "3b5aec18-9081-4e9d-9c13-fcdd4f8d5269", - "lastUpdateDateTime": "2021-09-23T11:19:50Z", - "createdDateTime": "2021-09-23T11:19:50Z", - "expirationDateTime": "2021-09-24T11:19:50Z", + "jobId": "df191a86-500d-40c8-93a5-0f3fdfca8063", + "lastUpdateDateTime": "2021-09-26T18:38:05Z", + "createdDateTime": "2021-09-26T18:38:05Z", + "expirationDateTime": "2021-09-27T18:38:05Z", "status": "notStarted", "errors": [], "displayName": "NA", @@ -90,31 +102,37 @@ } }, { - "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/3b5aec18-9081-4e9d-9c13-fcdd4f8d5269", + "RequestUri": "https://cognitiveweppe.azure-api.net/text/analytics/v3.2-preview.2/analyze/jobs/df191a86-500d-40c8-93a5-0f3fdfca8063", "RequestMethod": "GET", "RequestHeaders": { - "Accept": "application/json, text/json", + "Accept": [ + "application/json", + "text/json" + ], "Ocp-Apim-Subscription-Key": "Sanitized", - "User-Agent": "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210923.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "b83c7c5de2b45343cf2a6a95da9f77bf", + "User-Agent": [ + "azsdk-net-AI.TextAnalytics/5.2.0-alpha.20210926.1", + "(.NET Core 3.1.19; Microsoft Windows 10.0.19043)" + ], + "x-ms-client-request-id": "40e24aa3090e5727acea7d71b9400e84", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "b07e85d9-02ad-4182-90b0-bda7da693d42", + "apim-request-id": "26a16e0b-a39d-4ea7-bed2-1530514550ec", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 23 Sep 2021 11:19:51 GMT", + "Date": "Sun, 26 Sep 2021 18:38:06 GMT", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "94" + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "73" }, "ResponseBody": { - "jobId": "3b5aec18-9081-4e9d-9c13-fcdd4f8d5269", - "lastUpdateDateTime": "2021-09-23T11:19:51Z", - "createdDateTime": "2021-09-23T11:19:50Z", - "expirationDateTime": "2021-09-24T11:19:50Z", + "jobId": "df191a86-500d-40c8-93a5-0f3fdfca8063", + "lastUpdateDateTime": "2021-09-26T18:38:06Z", + "createdDateTime": "2021-09-26T18:38:05Z", + "expirationDateTime": "2021-09-27T18:38:05Z", "status": "succeeded", "errors": [], "displayName": "NA", @@ -125,7 +143,7 @@ "total": 1, "customMultiClassificationTasks": [ { - "lastUpdateDateTime": "2021-09-23T11:19:51.1392783Z", + "lastUpdateDateTime": "2021-09-26T18:38:06.4863445Z", "state": "succeeded", "results": { "documents": [ @@ -156,7 +174,7 @@ } ], "Variables": { - "RandomSeed": "1546450481", + "RandomSeed": "1982339428", "TEXT_ANALYTICS_API_KEY": "Sanitized", "TEXT_ANALYTICS_ENDPOINT": "https://cognitiveweppe.azure-api.net" } From 0d6335644dc2e430635927257422f9c9c2b3f138 Mon Sep 17 00:00:00 2001 From: Ahmed Leithy Date: Sun, 26 Sep 2021 22:51:58 +0200 Subject: [PATCH 17/22] Regenerated After Cherry picking --- .../Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTasks.cs | 1 - .../src/Generated/Models/CustomEntitiesTask.cs | 2 -- .../src/Generated/Models/CustomEntitiesTaskResult.cs | 1 - .../src/Generated/Models/CustomMultiClassificationTask.cs | 2 -- .../src/Generated/Models/CustomMultiClassificationTaskResult.cs | 1 - .../src/Generated/Models/CustomMultiClassificationTasksItem.cs | 1 - .../src/Generated/Models/CustomSingleClassificationTask.cs | 2 -- .../Generated/Models/CustomSingleClassificationTaskResult.cs | 1 - .../src/Generated/Models/CustomSingleClassificationTasksItem.cs | 1 - .../src/Generated/Models/ExtractiveSummarizationTask.cs | 1 - .../src/Generated/Models/JobManifestTasks.cs | 2 -- .../src/Generated/Models/SingleClassificationDocument.cs | 1 - .../Models/TasksStateTasksCustomEntityRecognitionTasksItem.cs | 1 - 13 files changed, 17 deletions(-) diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTasks.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTasks.cs index 96acf6153aab..0c53c42d5576 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTasks.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTasks.cs @@ -76,7 +76,6 @@ internal AnalyzeTasks(int completed, int failed, int inProgress, int total, IRea public IReadOnlyList EntityLinkingTasks { get; } public IReadOnlyList SentimentAnalysisTasks { get; } public IReadOnlyList ExtractiveSummarizationTasks { get; } - /// Gets the custom entity recognition tasks. public IReadOnlyList CustomEntityRecognitionTasks { get; } public IReadOnlyList CustomSingleClassificationTasks { get; } public IReadOnlyList CustomMultiClassificationTasks { get; } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTask.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTask.cs index 5ef5e897ea2b..55818bf4d8f9 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTask.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTask.cs @@ -15,9 +15,7 @@ public CustomEntitiesTask() { } - /// Gets or sets the parameters. public CustomEntitiesTaskParameters Parameters { get; set; } - /// Gets or sets the task name. public string TaskName { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskResult.cs index 6135a7943522..63c5e9c5f539 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskResult.cs @@ -22,7 +22,6 @@ internal CustomEntitiesTaskResult(CustomEntitiesResult results) Results = results; } - /// Gets the results. public CustomEntitiesResult Results { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTask.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTask.cs index 3a32778e9a28..fe67e23473fa 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTask.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTask.cs @@ -15,9 +15,7 @@ public CustomMultiClassificationTask() { } - /// Gets or sets the parameters. public CustomMultiClassificationTaskParameters Parameters { get; set; } - /// Gets or sets the task name. public string TaskName { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTaskResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTaskResult.cs index df0878a961fe..050eeee1e4b7 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTaskResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTaskResult.cs @@ -22,7 +22,6 @@ internal CustomMultiClassificationTaskResult(CustomMultiClassificationResult res Results = results; } - /// Gets the results. public CustomMultiClassificationResult Results { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTasksItem.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTasksItem.cs index b04321854442..b29ced9f4c77 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTasksItem.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiClassificationTasksItem.cs @@ -30,7 +30,6 @@ internal CustomMultiClassificationTasksItem(DateTimeOffset lastUpdateDateTime, s Results = results; } - /// Gets the results. public CustomMultiClassificationResult Results { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTask.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTask.cs index 45417d373524..952de7610f8c 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTask.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTask.cs @@ -15,9 +15,7 @@ public CustomSingleClassificationTask() { } - /// Gets or sets the parameters. public CustomSingleClassificationTaskParameters Parameters { get; set; } - /// Gets or sets the task name. public string TaskName { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTaskResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTaskResult.cs index feec1de8531b..0a5dcece9cce 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTaskResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTaskResult.cs @@ -22,7 +22,6 @@ internal CustomSingleClassificationTaskResult(CustomSingleClassificationResult r Results = results; } - /// Gets the results. public CustomSingleClassificationResult Results { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTasksItem.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTasksItem.cs index 1018cbf22f9e..688815726b1f 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTasksItem.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleClassificationTasksItem.cs @@ -30,7 +30,6 @@ internal CustomSingleClassificationTasksItem(DateTimeOffset lastUpdateDateTime, Results = results; } - /// Gets the results. public CustomSingleClassificationResult Results { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationTask.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationTask.cs index 612d3bcf408d..3be425325457 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationTask.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationTask.cs @@ -16,7 +16,6 @@ public ExtractiveSummarizationTask() } public ExtractiveSummarizationTaskParameters Parameters { get; set; } - /// Gets or sets the task name. public string TaskName { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/JobManifestTasks.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/JobManifestTasks.cs index 4b7f8127f016..133f793720fa 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/JobManifestTasks.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/JobManifestTasks.cs @@ -27,9 +27,7 @@ public JobManifestTasks() CustomSingleClassificationTasks = new ChangeTrackingList(); CustomMultiClassificationTasks = new ChangeTrackingList(); } - /// Gets the custom entity recognition tasks. public IList CustomEntityRecognitionTasks { get; } - /// Gets the custom single classification tasks. public IList CustomSingleClassificationTasks { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SingleClassificationDocument.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SingleClassificationDocument.cs index e24fe1c9070b..9df01df57d2e 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SingleClassificationDocument.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SingleClassificationDocument.cs @@ -55,7 +55,6 @@ internal SingleClassificationDocument(string id, ClassificationResult classifica /// Unique, non-empty document identifier. public string Id { get; } - /// Gets the classification. public ClassificationResult Classification { get; } /// Warnings encountered while processing document. public IReadOnlyList Warnings { get; } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TasksStateTasksCustomEntityRecognitionTasksItem.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TasksStateTasksCustomEntityRecognitionTasksItem.cs index e2ee2cd63ffa..f40aa0fa71ea 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TasksStateTasksCustomEntityRecognitionTasksItem.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TasksStateTasksCustomEntityRecognitionTasksItem.cs @@ -30,7 +30,6 @@ internal TasksStateTasksCustomEntityRecognitionTasksItem(DateTimeOffset lastUpda Results = results; } - /// Gets the results. public CustomEntitiesResult Results { get; } } } From 408c39208a8d2f3b86225f3d2cb770eccfb109a4 Mon Sep 17 00:00:00 2001 From: Ahmed Leithy Date: Wed, 29 Sep 2021 12:14:47 +0200 Subject: [PATCH 18/22] Applied Comments from Single Classify PR --- .../Sample11_ClassifyCustomCategories.md | 28 +++++------------ .../CustomMultiClassificationTasksItem.cs | 2 +- .../src/MultiCategoryClassifyAction.cs | 14 +++------ .../src/MultiCategoryClassifyActionResult.cs | 4 +-- .../src/MultiCategoryClassifyResult.cs | 2 +- .../src/TextAnalyticsModelFactory.cs | 6 ++-- .../Azure.AI.TextAnalytics/src/Transforms.cs | 2 +- .../samples/Sample11_MultiCategoryClassify.cs | 31 +++++++------------ .../Sample11_MultiCategoryClassifyAsync.cs | 31 +++++++------------ ...mple11_MultiCategoryClassifyConvenience.cs | 31 +++++++------------ ...1_MultiCategoryClassifyConvenienceAsync.cs | 31 +++++++------------ 11 files changed, 65 insertions(+), 117 deletions(-) diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample11_ClassifyCustomCategories.md b/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample11_ClassifyCustomCategories.md index a1e5aaebab69..94b8ff687acd 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample11_ClassifyCustomCategories.md +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample11_ClassifyCustomCategories.md @@ -1,5 +1,5 @@ # Perform Custom Multiple Category Classification in Documents -This sample demonstrates how to run a Multi Category Classify action in one or more documents. To get started you will need a Text Analytics endpoint and credentials. See [README][README] for links and instructions. +This sample demonstrates how to run a Multi Category Classification action in one or more documents. To get started you will need a Text Analytics endpoint and credentials. See [README][README] for links and instructions. ## Creating a `TextAnalyticsClient` @@ -15,7 +15,7 @@ var client = new TextAnalyticsClient(new Uri(endpoint), new AzureKeyCredential(a ## Performing Custom Multiple Category Classification in one or multiple documents -To perform Multiple Category Classification in one or multiple documents, set up an `MultiCategoryClassifyAction` and call `StartAnalyzeActionsAsync` on the documents. The result is a Long Running operation of type `AnalyzeActionsOperation` which polls for the results from the API. +To perform Multiple Category Classification in one or multiple documents, set up a `MultiCategoryClassifyAction` and call `StartAnalyzeActionsAsync` on the documents. The result is a Long Running Operation of type `AnalyzeActionsOperation` which polls for the results from the API. ```C# Snippet:TextAnalyticsMultiCategoryClassifyAsync // Get input document. @@ -28,6 +28,10 @@ var batchInput = new List document }; +// Set project and deployment names of the target model +string projectName = ""; +string deploymentName = ""; + var multiCategoryClassifyAction = new MultiCategoryClassifyAction(projectName, deploymentName); TextAnalyticsActions actions = new TextAnalyticsActions() @@ -62,28 +66,12 @@ To view the final results of the long-running operation: // View operation results. await foreach (AnalyzeActionsResult documentsInPage in operation.Value) { - IReadOnlyCollection classificationResultsCollection = documentsInPage.MultiCategoryClassifyResults; + IReadOnlyCollection multiClassificationActionResults = documentsInPage.MultiCategoryClassifyResults; - foreach (MultiCategoryClassifyActionResult classificationActionResults in classificationResultsCollection) + foreach (MultiCategoryClassifyActionResult classificationActionResults in multiClassificationActionResults) { - if (classificationActionResults.HasError) - { - Console.WriteLine($" Error!"); - Console.WriteLine($" Action error code: {classificationActionResults.Error.ErrorCode}."); - Console.WriteLine($" Message: {classificationActionResults.Error.Message}"); - continue; - } - foreach (MultiCategoryClassifyResult documentResults in classificationActionResults.DocumentsResults) { - if (documentResults.HasError) - { - Console.WriteLine($" Error!"); - Console.WriteLine($" Document error code: {documentResults.Error.ErrorCode}."); - Console.WriteLine($" Message: {documentResults.Error.Message}"); - continue; - } - if (documentResults.ClassificationCategories.Count > 0) { Console.WriteLine($" The following classes were predicted for this document:"); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Internal/CustomMultiClassificationTasksItem.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Internal/CustomMultiClassificationTasksItem.cs index 886715f8c8cb..6433d4be4679 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Internal/CustomMultiClassificationTasksItem.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Internal/CustomMultiClassificationTasksItem.cs @@ -6,7 +6,7 @@ namespace Azure.AI.TextAnalytics.Models { /// - /// ExtractiveSummarizationTasksItem. + /// CustomMultiClassificationTasksItem. /// [CodeGenModel("TasksStateTasksCustomMultiClassificationTasksItem")] internal partial class CustomMultiClassificationTasksItem { } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/MultiCategoryClassifyAction.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/MultiCategoryClassifyAction.cs index 6801acedef05..5a66ac500e7b 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/MultiCategoryClassifyAction.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/MultiCategoryClassifyAction.cs @@ -5,8 +5,8 @@ namespace Azure.AI.TextAnalytics { /// /// Configurations that allow callers to specify details about how to execute - /// a Multi Category Classify action on a set of documents. This corresponds - /// to a Multi Classification task in the text analytics service. + /// a Multi Category Classification action on a set of documents. This corresponds + /// to a Multi Classification task in the Text Analytics service. /// For example, the target project and deployment names are required /// for a successful custom classification action. /// @@ -15,7 +15,7 @@ public class MultiCategoryClassifyAction /// /// Initializes a new instance of the /// class which allows callers to specify details about how to execute - /// a Multi Category Classify action on a set of documents. + /// a Multi Category Classification action on a set of documents. /// Sets the and properties. /// public MultiCategoryClassifyAction(string projectName, string deploymentName) @@ -25,16 +25,12 @@ public MultiCategoryClassifyAction(string projectName, string deploymentName) } /// - /// Gets the value of the property corresponding to the name of the - /// target project for this action. This property is set when calling - /// the constructor. + /// Gets the value of the property corresponding to the name of the target project /// public string ProjectName { get; } /// - /// Gets the value of the property corresponding to the name of the - /// deployment for this action. This property is set when calling - /// the constructor. + /// Gets the value of the property corresponding to the name of the target deployment. /// public string DeploymentName { get; } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/MultiCategoryClassifyActionResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/MultiCategoryClassifyActionResult.cs index b63a9d20d796..915b16652d3b 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/MultiCategoryClassifyActionResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/MultiCategoryClassifyActionResult.cs @@ -7,7 +7,7 @@ namespace Azure.AI.TextAnalytics { /// - /// The result of the execution of an on the input documents. + /// The result of the execution of a on the input documents. /// public class MultiCategoryClassifyActionResult : TextAnalyticsActionResult { @@ -29,7 +29,7 @@ internal MultiCategoryClassifyActionResult(DateTimeOffset completedOn, TextAnaly : base(completedOn, error) { } /// - /// Gets the result of the execution of an per each input document. + /// Gets the result of the execution of a per each input document. /// public MultiCategoryClassifyResultCollection DocumentsResults { diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/MultiCategoryClassifyResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/MultiCategoryClassifyResult.cs index 566e26ec4ad8..c40bceb2062c 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/MultiCategoryClassifyResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/MultiCategoryClassifyResult.cs @@ -7,7 +7,7 @@ namespace Azure.AI.TextAnalytics { /// - /// The result of the Multi Category Classify operation on a document, + /// The result of the Multi Category Classification operation on a document, /// containing the collection of objects /// predicted for that document. /// diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsModelFactory.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsModelFactory.cs index d74e3a6718c1..1af9f16cb4be 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsModelFactory.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsModelFactory.cs @@ -545,14 +545,14 @@ public static MultiCategoryClassifyResult MultiCategoryClassifyResult(string id, /// /// Initializes a new instance of for mocking purposes. /// - /// Sets the collection of . + /// Sets the collection of . /// Sets the property. /// Sets the property. /// Sets the property. /// A new instance of for mocking purposes. - public static MultiCategoryClassifyResultCollection MultiCategoryClassifyResultCollection(IEnumerable list, TextDocumentBatchStatistics statistics, string projectName, string deploymentName) + public static MultiCategoryClassifyResultCollection MultiCategoryClassifyResultCollection(IEnumerable classificationResultList, TextDocumentBatchStatistics statistics, string projectName, string deploymentName) { - return new MultiCategoryClassifyResultCollection(list.ToList(), statistics, projectName, deploymentName); + return new MultiCategoryClassifyResultCollection(classificationResultList.ToList(), statistics, projectName, deploymentName); } /// diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Transforms.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Transforms.cs index 4e483fb27a4a..297cd0d507d6 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Transforms.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Transforms.cs @@ -370,7 +370,7 @@ internal static MultiCategoryClassifyResultCollection ConvertToMultiCategoryClas classifiedCustomCategoryResults.Add(new MultiCategoryClassifyResult(error.Id, ConvertToError(error.Error))); } - //Read sentiments + //Read classifications foreach (MultiClassificationDocument classificationsDocument in results.Documents) { classifiedCustomCategoryResults.Add(new MultiCategoryClassifyResult(classificationsDocument.Id, classificationsDocument.Statistics ?? default, ConvertToClassificationCategoryCollection(classificationsDocument), ConvertToWarnings(classificationsDocument.Warnings))); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassify.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassify.cs index 313d5a8095af..5f3bedeeaca2 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassify.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassify.cs @@ -18,8 +18,6 @@ public void MultiCategoryClassify() // Create a text analytics client. string endpoint = TestEnvironment.Endpoint; string apiKey = TestEnvironment.ApiKey; - string projectName = TestEnvironment.MultiClassificationProjectName; - string deploymentName = TestEnvironment.MultiClassificationDeploymentName; var client = new TextAnalyticsClient(new Uri(endpoint), new AzureKeyCredential(apiKey)); @@ -36,6 +34,15 @@ public void MultiCategoryClassify() } }; + // Set project and deployment names of the target model +#if SNIPPET + string projectName = ""; + string deploymentName = ""; +#else + string projectName = TestEnvironment.MultiClassificationProjectName; + string deploymentName = TestEnvironment.MultiClassificationDeploymentName; +#endif + var multiCategoryClassifyAction = new MultiCategoryClassifyAction(projectName, deploymentName); TextAnalyticsActions actions = new TextAnalyticsActions() @@ -75,28 +82,12 @@ public void MultiCategoryClassify() // View operation results. foreach (AnalyzeActionsResult documentsInPage in operation.GetValues()) { - IReadOnlyCollection classificationResultsCollection = documentsInPage.MultiCategoryClassifyResults; + IReadOnlyCollection multiClassificationActionResults = documentsInPage.MultiCategoryClassifyResults; - foreach (MultiCategoryClassifyActionResult classificationActionResults in classificationResultsCollection) + foreach (MultiCategoryClassifyActionResult classificationActionResults in multiClassificationActionResults) { - if (classificationActionResults.HasError) - { - Console.WriteLine($" Error!"); - Console.WriteLine($" Action error code: {classificationActionResults.Error.ErrorCode}."); - Console.WriteLine($" Message: {classificationActionResults.Error.Message}"); - continue; - } - foreach (MultiCategoryClassifyResult documentResults in classificationActionResults.DocumentsResults) { - if (documentResults.HasError) - { - Console.WriteLine($" Error!"); - Console.WriteLine($" Document error code: {documentResults.Error.ErrorCode}."); - Console.WriteLine($" Message: {documentResults.Error.Message}"); - continue; - } - if (documentResults.ClassificationCategories.Count > 0) { Console.WriteLine($" The following classes were predicted for this document:"); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyAsync.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyAsync.cs index 0e07ba699742..535b665438be 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyAsync.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyAsync.cs @@ -18,8 +18,6 @@ public async Task MultiCategoryClassifyAsync() // Create a text analytics client. string endpoint = TestEnvironment.Endpoint; string apiKey = TestEnvironment.ApiKey; - string projectName = TestEnvironment.MultiClassificationProjectName; - string deploymentName = TestEnvironment.MultiClassificationDeploymentName; var client = new TextAnalyticsClient(new Uri(endpoint), new AzureKeyCredential(apiKey)); @@ -36,6 +34,15 @@ public async Task MultiCategoryClassifyAsync() } }; + // Set project and deployment names of the target model +#if SNIPPET + string projectName = ""; + string deploymentName = ""; +#else + string projectName = TestEnvironment.MultiClassificationProjectName; + string deploymentName = TestEnvironment.MultiClassificationDeploymentName; +#endif + var multiCategoryClassifyAction = new MultiCategoryClassifyAction(projectName, deploymentName); TextAnalyticsActions actions = new TextAnalyticsActions() @@ -62,28 +69,12 @@ public async Task MultiCategoryClassifyAsync() // View operation results. await foreach (AnalyzeActionsResult documentsInPage in operation.Value) { - IReadOnlyCollection classificationResultsCollection = documentsInPage.MultiCategoryClassifyResults; + IReadOnlyCollection multiClassificationActionResults = documentsInPage.MultiCategoryClassifyResults; - foreach (MultiCategoryClassifyActionResult classificationActionResults in classificationResultsCollection) + foreach (MultiCategoryClassifyActionResult classificationActionResults in multiClassificationActionResults) { - if (classificationActionResults.HasError) - { - Console.WriteLine($" Error!"); - Console.WriteLine($" Action error code: {classificationActionResults.Error.ErrorCode}."); - Console.WriteLine($" Message: {classificationActionResults.Error.Message}"); - continue; - } - foreach (MultiCategoryClassifyResult documentResults in classificationActionResults.DocumentsResults) { - if (documentResults.HasError) - { - Console.WriteLine($" Error!"); - Console.WriteLine($" Document error code: {documentResults.Error.ErrorCode}."); - Console.WriteLine($" Message: {documentResults.Error.Message}"); - continue; - } - if (documentResults.ClassificationCategories.Count > 0) { Console.WriteLine($" The following classes were predicted for this document:"); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyConvenience.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyConvenience.cs index 1d88b0169f09..7cf68434483f 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyConvenience.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyConvenience.cs @@ -18,8 +18,6 @@ public void MultiCategoryClassifyConvenience() // Create a text analytics client. string endpoint = TestEnvironment.Endpoint; string apiKey = TestEnvironment.ApiKey; - string projectName = TestEnvironment.MultiClassificationProjectName; - string deploymentName = TestEnvironment.MultiClassificationDeploymentName; var client = new TextAnalyticsClient(new Uri(endpoint), new AzureKeyCredential(apiKey)); @@ -33,6 +31,15 @@ public void MultiCategoryClassifyConvenience() document }; + // Set project and deployment names of the target model +#if SNIPPET + string projectName = ""; + string deploymentName = ""; +#else + string projectName = TestEnvironment.MultiClassificationProjectName; + string deploymentName = TestEnvironment.MultiClassificationDeploymentName; +#endif + var multiCategoryClassifyAction = new MultiCategoryClassifyAction(projectName, deploymentName); TextAnalyticsActions actions = new TextAnalyticsActions() @@ -72,28 +79,12 @@ public void MultiCategoryClassifyConvenience() // View operation results. foreach (AnalyzeActionsResult documentsInPage in operation.GetValues()) { - IReadOnlyCollection classificationResultsCollection = documentsInPage.MultiCategoryClassifyResults; + IReadOnlyCollection multiClassificationActionResults = documentsInPage.MultiCategoryClassifyResults; - foreach (MultiCategoryClassifyActionResult classificationActionResults in classificationResultsCollection) + foreach (MultiCategoryClassifyActionResult classificationActionResults in multiClassificationActionResults) { - if (classificationActionResults.HasError) - { - Console.WriteLine($" Error!"); - Console.WriteLine($" Action error code: {classificationActionResults.Error.ErrorCode}."); - Console.WriteLine($" Message: {classificationActionResults.Error.Message}"); - continue; - } - foreach (MultiCategoryClassifyResult documentResults in classificationActionResults.DocumentsResults) { - if (documentResults.HasError) - { - Console.WriteLine($" Error!"); - Console.WriteLine($" Document error code: {documentResults.Error.ErrorCode}."); - Console.WriteLine($" Message: {documentResults.Error.Message}"); - continue; - } - if (documentResults.ClassificationCategories.Count > 0) { Console.WriteLine($" The following classes were predicted for this document:"); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyConvenienceAsync.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyConvenienceAsync.cs index c15c74bdd288..b8b7ed0a4e27 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyConvenienceAsync.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyConvenienceAsync.cs @@ -18,8 +18,6 @@ public async Task MultiCategoryClassifyConvenienceAsync() // Create a text analytics client. string endpoint = TestEnvironment.Endpoint; string apiKey = TestEnvironment.ApiKey; - string projectName = TestEnvironment.MultiClassificationProjectName; - string deploymentName = TestEnvironment.MultiClassificationDeploymentName; var client = new TextAnalyticsClient(new Uri(endpoint), new AzureKeyCredential(apiKey)); @@ -34,6 +32,15 @@ public async Task MultiCategoryClassifyConvenienceAsync() document }; + // Set project and deployment names of the target model +#if SNIPPET + string projectName = ""; + string deploymentName = ""; +#else + string projectName = TestEnvironment.MultiClassificationProjectName; + string deploymentName = TestEnvironment.MultiClassificationDeploymentName; +#endif + var multiCategoryClassifyAction = new MultiCategoryClassifyAction(projectName, deploymentName); TextAnalyticsActions actions = new TextAnalyticsActions() @@ -64,28 +71,12 @@ public async Task MultiCategoryClassifyConvenienceAsync() // View operation results. await foreach (AnalyzeActionsResult documentsInPage in operation.Value) { - IReadOnlyCollection classificationResultsCollection = documentsInPage.MultiCategoryClassifyResults; + IReadOnlyCollection multiClassificationActionResults = documentsInPage.MultiCategoryClassifyResults; - foreach (MultiCategoryClassifyActionResult classificationActionResults in classificationResultsCollection) + foreach (MultiCategoryClassifyActionResult classificationActionResults in multiClassificationActionResults) { - if (classificationActionResults.HasError) - { - Console.WriteLine($" Error!"); - Console.WriteLine($" Action error code: {classificationActionResults.Error.ErrorCode}."); - Console.WriteLine($" Message: {classificationActionResults.Error.Message}"); - continue; - } - foreach (MultiCategoryClassifyResult documentResults in classificationActionResults.DocumentsResults) { - if (documentResults.HasError) - { - Console.WriteLine($" Error!"); - Console.WriteLine($" Document error code: {documentResults.Error.ErrorCode}."); - Console.WriteLine($" Message: {documentResults.Error.Message}"); - continue; - } - if (documentResults.ClassificationCategories.Count > 0) { Console.WriteLine($" The following classes were predicted for this document:"); From fc0f362f5ee6956e06021d1fd6cb1a8963705cfe Mon Sep 17 00:00:00 2001 From: Ahmed Leithy Date: Wed, 29 Sep 2021 12:17:03 +0200 Subject: [PATCH 19/22] regenerated netstandard --- .../api/Azure.AI.TextAnalytics.netstandard2.0.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/api/Azure.AI.TextAnalytics.netstandard2.0.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/api/Azure.AI.TextAnalytics.netstandard2.0.cs index 291bff876539..98b233d59c3c 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/api/Azure.AI.TextAnalytics.netstandard2.0.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/api/Azure.AI.TextAnalytics.netstandard2.0.cs @@ -1031,7 +1031,7 @@ public static partial class TextAnalyticsModelFactory public static Azure.AI.TextAnalytics.MultiCategoryClassifyActionResult MultiCategoryClassifyActionResult(System.DateTimeOffset completedOn, string code, string message) { throw null; } public static Azure.AI.TextAnalytics.MultiCategoryClassifyResult MultiCategoryClassifyResult(string id, Azure.AI.TextAnalytics.TextAnalyticsError error) { throw null; } public static Azure.AI.TextAnalytics.MultiCategoryClassifyResult MultiCategoryClassifyResult(string id, Azure.AI.TextAnalytics.TextDocumentStatistics statistics, Azure.AI.TextAnalytics.ClassificationCategoryCollection documentClassificationCollection, System.Collections.Generic.IEnumerable warnings = null) { throw null; } - public static Azure.AI.TextAnalytics.MultiCategoryClassifyResultCollection MultiCategoryClassifyResultCollection(System.Collections.Generic.IEnumerable list, Azure.AI.TextAnalytics.TextDocumentBatchStatistics statistics, string projectName, string deploymentName) { throw null; } + public static Azure.AI.TextAnalytics.MultiCategoryClassifyResultCollection MultiCategoryClassifyResultCollection(System.Collections.Generic.IEnumerable classificationResultList, Azure.AI.TextAnalytics.TextDocumentBatchStatistics statistics, string projectName, string deploymentName) { throw null; } public static Azure.AI.TextAnalytics.PiiEntity PiiEntity(string text, string category, string subCategory, double score, int offset, int length) { throw null; } public static Azure.AI.TextAnalytics.PiiEntityCollection PiiEntityCollection(System.Collections.Generic.IEnumerable entities, string redactedText, System.Collections.Generic.IEnumerable warnings = null) { throw null; } public static Azure.AI.TextAnalytics.RecognizeEntitiesActionResult RecognizeEntitiesActionResult(Azure.AI.TextAnalytics.RecognizeEntitiesResultCollection result, System.DateTimeOffset completedOn) { throw null; } From e82d0642fa8ec7df8be65c497210da38b981405d Mon Sep 17 00:00:00 2001 From: Ahmed Leithy Date: Thu, 30 Sep 2021 15:09:36 +0200 Subject: [PATCH 20/22] Regenerated code + fixed some build errors --- .../Azure.AI.TextAnalytics/src/AnalyzeActionsResult.cs | 4 ++-- .../src/Generated/Models/JobManifestTasks.cs | 1 - .../Azure.AI.TextAnalytics/src/JobManifestTasks.cs | 2 +- .../src/TextAnalyticsModelFactory.cs | 2 +- .../Azure.AI.TextAnalytics/src/Transforms.cs | 8 ++++---- .../tests/AnalyzeOperationMockTests.cs | 4 ++-- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/AnalyzeActionsResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/AnalyzeActionsResult.cs index 92de445064a8..36c5a00a87b4 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/AnalyzeActionsResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/AnalyzeActionsResult.cs @@ -17,7 +17,7 @@ internal AnalyzeActionsResult( IReadOnlyCollection recognizeLinkedEntitiesActionResults, IReadOnlyCollection analyzeSentimentActionResults, IReadOnlyCollection extractSummaryActionResults, - IReadOnlyCollection singleCategoryClassifyActionResults + IReadOnlyCollection singleCategoryClassifyActionResults, IReadOnlyCollection multiCategoryClassifyActionResults ) { @@ -67,7 +67,7 @@ IReadOnlyCollection multiCategoryClassifyActi public IReadOnlyCollection SingleCategoryClassifyResults { get; } /// - /// Determines the collection of . + /// Determines the collection of . /// public IReadOnlyCollection MultiCategoryClassifyResults { get; } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/JobManifestTasks.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/JobManifestTasks.cs index 133f793720fa..faba44bdb062 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/JobManifestTasks.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/JobManifestTasks.cs @@ -28,6 +28,5 @@ public JobManifestTasks() CustomMultiClassificationTasks = new ChangeTrackingList(); } public IList CustomEntityRecognitionTasks { get; } - public IList CustomSingleClassificationTasks { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/JobManifestTasks.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/JobManifestTasks.cs index 9a500e08cabf..e77a931509e3 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/JobManifestTasks.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/JobManifestTasks.cs @@ -47,7 +47,7 @@ internal partial class JobManifestTasks /// CustomSingleClassificationTasks /// internal IList CustomSingleClassificationTasks { get; set; } - + /// /// CustomMultiClassificationTasks /// diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsModelFactory.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsModelFactory.cs index 1af9f16cb4be..d903cb3acae1 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsModelFactory.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsModelFactory.cs @@ -870,7 +870,7 @@ public static ExtractSummaryActionResult ExtractSummaryActionResult( { return new ExtractSummaryActionResult(completedOn, new TextAnalyticsErrorInternal(code, message)); } - + /// /// Initializes a new instance of for mocking purposes. /// diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Transforms.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Transforms.cs index 297cd0d507d6..aa55d4ae31c1 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Transforms.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Transforms.cs @@ -494,7 +494,7 @@ internal static ExtractiveSummarizationTask ConvertToExtractiveSummarizationTask } }; } - + internal static CustomSingleClassificationTask ConvertToCustomSingleClassificationTask(SingleCategoryClassifyAction action) { return new CustomSingleClassificationTask() @@ -505,7 +505,7 @@ internal static CustomSingleClassificationTask ConvertToCustomSingleClassificati } }; } - + internal static CustomMultiClassificationTask ConvertToCustomMultiClassificationTask(MultiCategoryClassifyAction action) { return new CustomMultiClassificationTask() @@ -701,8 +701,8 @@ internal static AnalyzeActionsResult ConvertToAnalyzeActionsResult(AnalyzeJobSta ConvertToRecognizeLinkedEntitiesActionsResults(jobState, map, entitiesLinkingRecognitionErrors), ConvertToAnalyzeSentimentActionsResults(jobState, map, analyzeSentimentErrors), ConvertToExtractSummaryActionsResults(jobState, map, extractSummaryErrors), - ConvertToSingleCategoryClassifyResults(jobState, map, singleCategoryClassifyErrors) - ConvertToMultiCategoryClassifyActionsResults(jobState, map, multiCategoryClassifyErrors)); + ConvertToSingleCategoryClassifyResults(jobState, map, singleCategoryClassifyErrors), + ConvertToMultiCategoryClassifyActionsResults(jobState, map, multiCategoryClassifyErrors) ); } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/AnalyzeOperationMockTests.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/AnalyzeOperationMockTests.cs index c0fd21c9e6c0..69b04b7f92b3 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/AnalyzeOperationMockTests.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/AnalyzeOperationMockTests.cs @@ -841,7 +841,7 @@ public void AnalyzeOperationMultiCategoryClassifyWithTwoActions() Assert.AreEqual("Multiple of the same action is not currently supported.", ex.Message); } #endregion - + #region Single Category Classify [Test] @@ -1093,7 +1093,7 @@ public async Task AnalyzeOperationWithActionsError() Assert.IsTrue(singleCategoryClassifyActionResult.HasError); Assert.Throws(() => singleCategoryClassifyActionResult.DocumentsResults.GetType()); - + Assert.IsTrue(multiCategoryClassifyActionResult.HasError); Assert.Throws(() => multiCategoryClassifyActionResult.DocumentsResults.GetType()); } From 22a98c0b4fb00526d2070fca1405f1046a3aa1b8 Mon Sep 17 00:00:00 2001 From: Ahmed Leithy Date: Tue, 5 Oct 2021 11:59:44 +0200 Subject: [PATCH 21/22] Removed unneeded '#IF SNIPPET' directives --- .../tests/samples/Sample10_SingleCategoryClassify.cs | 5 ----- .../tests/samples/Sample10_SingleCategoryClassifyAsync.cs | 5 ----- .../samples/Sample10_SingleCategoryClassifyConvenience.cs | 5 ----- .../tests/samples/Sample11_MultiCategoryClassify.cs | 5 ----- .../tests/samples/Sample11_MultiCategoryClassifyAsync.cs | 5 ----- .../samples/Sample11_MultiCategoryClassifyConvenience.cs | 5 ----- 6 files changed, 30 deletions(-) diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample10_SingleCategoryClassify.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample10_SingleCategoryClassify.cs index c2df6873b201..c0344b1b069e 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample10_SingleCategoryClassify.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample10_SingleCategoryClassify.cs @@ -35,13 +35,8 @@ public void SingleCategoryClassify() }; // Set project and deployment names of the target model -#if SNIPPET - string projectName = ""; - string deploymentName = ""; -#else string projectName = TestEnvironment.SingleClassificationProjectName; string deploymentName = TestEnvironment.SingleClassificationDeploymentName; -#endif var singleCategoryClassifyAction = new SingleCategoryClassifyAction(projectName, deploymentName); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample10_SingleCategoryClassifyAsync.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample10_SingleCategoryClassifyAsync.cs index 312e3c3cc972..239b8fe69ef2 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample10_SingleCategoryClassifyAsync.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample10_SingleCategoryClassifyAsync.cs @@ -35,13 +35,8 @@ public async Task SingleCategoryClassifyAsync() }; // Set project and deployment names of the target model -#if SNIPPET - string projectName = ""; - string deploymentName = ""; -#else string projectName = TestEnvironment.SingleClassificationProjectName; string deploymentName = TestEnvironment.SingleClassificationDeploymentName; -#endif var singleCategoryClassifyAction = new SingleCategoryClassifyAction(projectName, deploymentName); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample10_SingleCategoryClassifyConvenience.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample10_SingleCategoryClassifyConvenience.cs index 156dffef5970..b460431900e4 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample10_SingleCategoryClassifyConvenience.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample10_SingleCategoryClassifyConvenience.cs @@ -32,13 +32,8 @@ public void SingleCategoryClassifyConvenience() }; // Set project and deployment names of the target model -#if SNIPPET - string projectName = ""; - string deploymentName = ""; -#else string projectName = TestEnvironment.SingleClassificationProjectName; string deploymentName = TestEnvironment.SingleClassificationDeploymentName; -#endif var singleCategoryClassifyAction = new SingleCategoryClassifyAction(projectName, deploymentName); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassify.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassify.cs index 5f3bedeeaca2..c46dc426fa89 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassify.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassify.cs @@ -35,13 +35,8 @@ public void MultiCategoryClassify() }; // Set project and deployment names of the target model -#if SNIPPET - string projectName = ""; - string deploymentName = ""; -#else string projectName = TestEnvironment.MultiClassificationProjectName; string deploymentName = TestEnvironment.MultiClassificationDeploymentName; -#endif var multiCategoryClassifyAction = new MultiCategoryClassifyAction(projectName, deploymentName); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyAsync.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyAsync.cs index 535b665438be..21cbd75450c4 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyAsync.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyAsync.cs @@ -35,13 +35,8 @@ public async Task MultiCategoryClassifyAsync() }; // Set project and deployment names of the target model -#if SNIPPET - string projectName = ""; - string deploymentName = ""; -#else string projectName = TestEnvironment.MultiClassificationProjectName; string deploymentName = TestEnvironment.MultiClassificationDeploymentName; -#endif var multiCategoryClassifyAction = new MultiCategoryClassifyAction(projectName, deploymentName); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyConvenience.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyConvenience.cs index 7cf68434483f..8988d00e0748 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyConvenience.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyConvenience.cs @@ -32,13 +32,8 @@ public void MultiCategoryClassifyConvenience() }; // Set project and deployment names of the target model -#if SNIPPET - string projectName = ""; - string deploymentName = ""; -#else string projectName = TestEnvironment.MultiClassificationProjectName; string deploymentName = TestEnvironment.MultiClassificationDeploymentName; -#endif var multiCategoryClassifyAction = new MultiCategoryClassifyAction(projectName, deploymentName); From 8fd78b7d1dc03072101bf93bf3dc991807934473 Mon Sep 17 00:00:00 2001 From: Ahmed Leithy Date: Tue, 5 Oct 2021 12:42:36 +0200 Subject: [PATCH 22/22] Rename property ClassificationCategories -> Classifications Rename property ClassificationCategory -> Classification --- .../api/Azure.AI.TextAnalytics.netstandard2.0.cs | 6 +++--- .../samples/Sample10_SingleCategoryClassify.md | 2 +- .../samples/Sample11_ClassifyCustomCategories.md | 4 ++-- .../src/MultiCategoryClassifyResult.cs | 10 +++++----- .../src/SingleCategoryClassifyResult.cs | 8 ++++---- .../src/TextAnalyticsModelFactory.cs | 8 ++++---- .../tests/MultiCategoryClassifyTests.cs | 2 +- .../tests/SingleCategoryClassifyTests.cs | 2 +- .../tests/samples/Sample10_SingleCategoryClassify.cs | 2 +- .../samples/Sample10_SingleCategoryClassifyAsync.cs | 2 +- .../Sample10_SingleCategoryClassifyConvenience.cs | 2 +- .../Sample10_SingleCategoryClassifyConvenienceAsync.cs | 2 +- .../tests/samples/Sample11_MultiCategoryClassify.cs | 4 ++-- .../samples/Sample11_MultiCategoryClassifyAsync.cs | 4 ++-- .../Sample11_MultiCategoryClassifyConvenience.cs | 4 ++-- .../Sample11_MultiCategoryClassifyConvenienceAsync.cs | 4 ++-- 16 files changed, 33 insertions(+), 33 deletions(-) diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/api/Azure.AI.TextAnalytics.netstandard2.0.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/api/Azure.AI.TextAnalytics.netstandard2.0.cs index 98b233d59c3c..5ccade399602 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/api/Azure.AI.TextAnalytics.netstandard2.0.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/api/Azure.AI.TextAnalytics.netstandard2.0.cs @@ -450,7 +450,7 @@ internal MultiCategoryClassifyActionResult() { } public partial class MultiCategoryClassifyResult : Azure.AI.TextAnalytics.TextAnalyticsResult { internal MultiCategoryClassifyResult() { } - public Azure.AI.TextAnalytics.ClassificationCategoryCollection ClassificationCategories { get { throw null; } } + public Azure.AI.TextAnalytics.ClassificationCategoryCollection Classifications { get { throw null; } } public System.Collections.Generic.IReadOnlyCollection Warnings { get { throw null; } } } public partial class MultiCategoryClassifyResultCollection : System.Collections.ObjectModel.ReadOnlyCollection @@ -791,7 +791,7 @@ internal SingleCategoryClassifyActionResult() { } public partial class SingleCategoryClassifyResult : Azure.AI.TextAnalytics.TextAnalyticsResult { internal SingleCategoryClassifyResult() { } - public Azure.AI.TextAnalytics.ClassificationCategory ClassificationCategory { get { throw null; } } + public Azure.AI.TextAnalytics.ClassificationCategory Classification { get { throw null; } } public System.Collections.Generic.IReadOnlyCollection Warnings { get { throw null; } } } public partial class SingleCategoryClassifyResultCollection : System.Collections.ObjectModel.ReadOnlyCollection @@ -1057,7 +1057,7 @@ public static partial class TextAnalyticsModelFactory public static Azure.AI.TextAnalytics.SingleCategoryClassifyActionResult SingleCategoryClassifyActionResult(Azure.AI.TextAnalytics.SingleCategoryClassifyResultCollection result, System.DateTimeOffset completedOn) { throw null; } public static Azure.AI.TextAnalytics.SingleCategoryClassifyActionResult SingleCategoryClassifyActionResult(System.DateTimeOffset completedOn, string code, string message) { throw null; } public static Azure.AI.TextAnalytics.SingleCategoryClassifyResult SingleCategoryClassifyResult(string id, Azure.AI.TextAnalytics.TextAnalyticsError error) { throw null; } - public static Azure.AI.TextAnalytics.SingleCategoryClassifyResult SingleCategoryClassifyResult(string id, Azure.AI.TextAnalytics.TextDocumentStatistics statistics, Azure.AI.TextAnalytics.ClassificationCategory classificationCategory, System.Collections.Generic.IEnumerable warnings = null) { throw null; } + public static Azure.AI.TextAnalytics.SingleCategoryClassifyResult SingleCategoryClassifyResult(string id, Azure.AI.TextAnalytics.TextDocumentStatistics statistics, Azure.AI.TextAnalytics.ClassificationCategory classification, System.Collections.Generic.IEnumerable warnings = null) { throw null; } public static Azure.AI.TextAnalytics.SingleCategoryClassifyResultCollection SingleCategoryClassifyResultCollection(System.Collections.Generic.IEnumerable classificationResultList, Azure.AI.TextAnalytics.TextDocumentBatchStatistics statistics, string projectName, string deploymentName) { throw null; } public static Azure.AI.TextAnalytics.SummarySentence SummarySentence(string text, double rankScore, int offset, int length) { throw null; } public static Azure.AI.TextAnalytics.SummarySentenceCollection SummarySentenceCollection(System.Collections.Generic.IEnumerable sentences, System.Collections.Generic.IEnumerable warnings = null) { throw null; } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample10_SingleCategoryClassify.md b/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample10_SingleCategoryClassify.md index d57116c89e17..b38e11c6859a 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample10_SingleCategoryClassify.md +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample10_SingleCategoryClassify.md @@ -72,7 +72,7 @@ await foreach (AnalyzeActionsResult documentsInPage in operation.Value) { foreach (SingleCategoryClassifyResult documentResults in classificationActionResults.DocumentsResults) { - Console.WriteLine($" Class category \"{documentResults.ClassificationCategory.Category}\" predicted with a confidence score of {documentResults.ClassificationCategory.ConfidenceScore}."); + Console.WriteLine($" Class category \"{documentResults.Classification.Category}\" predicted with a confidence score of {documentResults.Classification.ConfidenceScore}."); Console.WriteLine(); } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample11_ClassifyCustomCategories.md b/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample11_ClassifyCustomCategories.md index 94b8ff687acd..e61c664fbd92 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample11_ClassifyCustomCategories.md +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample11_ClassifyCustomCategories.md @@ -72,11 +72,11 @@ await foreach (AnalyzeActionsResult documentsInPage in operation.Value) { foreach (MultiCategoryClassifyResult documentResults in classificationActionResults.DocumentsResults) { - if (documentResults.ClassificationCategories.Count > 0) + if (documentResults.Classifications.Count > 0) { Console.WriteLine($" The following classes were predicted for this document:"); - foreach (ClassificationCategory classification in documentResults.ClassificationCategories) + foreach (ClassificationCategory classification in documentResults.Classifications) { Console.WriteLine($" Class category \"{classification.Category}\" predicted with a confidence score of {classification.ConfidenceScore}."); } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/MultiCategoryClassifyResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/MultiCategoryClassifyResult.cs index c40bceb2062c..c6e48a80b28c 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/MultiCategoryClassifyResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/MultiCategoryClassifyResult.cs @@ -13,11 +13,11 @@ namespace Azure.AI.TextAnalytics /// public class MultiCategoryClassifyResult : TextAnalyticsResult { - private readonly ClassificationCategoryCollection _classificationCategories; - internal MultiCategoryClassifyResult(string id, TextDocumentStatistics statistics, ClassificationCategoryCollection classificationCategories, IReadOnlyCollection warnings) + private readonly ClassificationCategoryCollection _classifications; + internal MultiCategoryClassifyResult(string id, TextDocumentStatistics statistics, ClassificationCategoryCollection classifications, IReadOnlyCollection warnings) : base(id, statistics) { - _classificationCategories = classificationCategories; + _classifications = classifications; Warnings = warnings; } @@ -31,7 +31,7 @@ internal MultiCategoryClassifyResult(string id, TextAnalyticsError error) : base /// /// Gets the collection of objects predicted for the corresponding document. /// - public ClassificationCategoryCollection ClassificationCategories + public ClassificationCategoryCollection Classifications { get { @@ -39,7 +39,7 @@ public ClassificationCategoryCollection ClassificationCategories { throw new InvalidOperationException($"Cannot access result for document {Id}, due to error {Error.ErrorCode}: {Error.Message}"); } - return _classificationCategories; + return _classifications; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/SingleCategoryClassifyResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/SingleCategoryClassifyResult.cs index 9be060734bcc..80de446f13d3 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/SingleCategoryClassifyResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/SingleCategoryClassifyResult.cs @@ -13,11 +13,11 @@ namespace Azure.AI.TextAnalytics /// public class SingleCategoryClassifyResult : TextAnalyticsResult { - private readonly ClassificationCategory _classificationCategory; + private readonly ClassificationCategory _classification; internal SingleCategoryClassifyResult(string id, TextDocumentStatistics statistics, ClassificationCategory classificationCategory , IReadOnlyCollection warnings) : base(id, statistics) { - _classificationCategory = classificationCategory; + _classification = classificationCategory; Warnings = warnings; } @@ -31,7 +31,7 @@ internal SingleCategoryClassifyResult(string id, TextAnalyticsError error) : bas /// /// Gets the object predicted for the corresponding document. /// - public ClassificationCategory ClassificationCategory + public ClassificationCategory Classification { get { @@ -39,7 +39,7 @@ public ClassificationCategory ClassificationCategory { throw new InvalidOperationException($"Cannot access result for document {Id}, due to error {Error.ErrorCode}: {Error.Message}"); } - return _classificationCategory; + return _classification; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsModelFactory.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsModelFactory.cs index d903cb3acae1..e4b8e3e147f0 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsModelFactory.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsModelFactory.cs @@ -524,7 +524,7 @@ public static SummarySentenceCollection SummarySentenceCollection(IEnumerable /// Sets the property. /// Sets the property. - /// Sets the of . + /// Sets the of . /// Sets the collection of . /// A new instance of for mocking purposes. public static MultiCategoryClassifyResult MultiCategoryClassifyResult(string id, TextDocumentStatistics statistics, ClassificationCategoryCollection documentClassificationCollection, IEnumerable warnings = default) @@ -573,12 +573,12 @@ public static ClassificationCategoryCollection ClassificationCategoryCollection( /// /// Sets the property. /// Sets the property. - /// Sets the of . + /// Sets the of . /// Sets the collection of . /// A new instance of for mocking purposes. - public static SingleCategoryClassifyResult SingleCategoryClassifyResult(string id, TextDocumentStatistics statistics, ClassificationCategory classificationCategory, IEnumerable warnings = default) + public static SingleCategoryClassifyResult SingleCategoryClassifyResult(string id, TextDocumentStatistics statistics, ClassificationCategory classification, IEnumerable warnings = default) { - return new SingleCategoryClassifyResult(id, statistics, classificationCategory, warnings.ToList()); + return new SingleCategoryClassifyResult(id, statistics, classification, warnings.ToList()); } /// diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/MultiCategoryClassifyTests.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/MultiCategoryClassifyTests.cs index d4f4acae5e69..3d9a1e1a23ab 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/MultiCategoryClassifyTests.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/MultiCategoryClassifyTests.cs @@ -259,7 +259,7 @@ private void ValidateSummaryBatchResult(MultiCategoryClassifyResultCollection re Assert.AreEqual(0, result.Statistics.TransactionCount); } - ValidateSummaryDocumentResult(result.ClassificationCategories); + ValidateSummaryDocumentResult(result.Classifications); } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SingleCategoryClassifyTests.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SingleCategoryClassifyTests.cs index be8c64f49107..ccfcb674212c 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SingleCategoryClassifyTests.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/SingleCategoryClassifyTests.cs @@ -254,7 +254,7 @@ private void ValidateSummaryBatchResult(SingleCategoryClassifyResultCollection r Assert.AreEqual(0, result.Statistics.TransactionCount); } - ValidateSummaryDocumentResult(result.ClassificationCategory); + ValidateSummaryDocumentResult(result.Classification); } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample10_SingleCategoryClassify.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample10_SingleCategoryClassify.cs index c0344b1b069e..775193a0457f 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample10_SingleCategoryClassify.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample10_SingleCategoryClassify.cs @@ -83,7 +83,7 @@ public void SingleCategoryClassify() { foreach (SingleCategoryClassifyResult documentResults in classificationActionResults.DocumentsResults) { - Console.WriteLine($" Class category \"{documentResults.ClassificationCategory.Category}\" predicted with a confidence score of {documentResults.ClassificationCategory.ConfidenceScore}."); + Console.WriteLine($" Class category \"{documentResults.Classification.Category}\" predicted with a confidence score of {documentResults.Classification.ConfidenceScore}."); Console.WriteLine(); } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample10_SingleCategoryClassifyAsync.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample10_SingleCategoryClassifyAsync.cs index 239b8fe69ef2..ccb583d26aab 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample10_SingleCategoryClassifyAsync.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample10_SingleCategoryClassifyAsync.cs @@ -70,7 +70,7 @@ public async Task SingleCategoryClassifyAsync() { foreach (SingleCategoryClassifyResult documentResults in classificationActionResults.DocumentsResults) { - Console.WriteLine($" Class category \"{documentResults.ClassificationCategory.Category}\" predicted with a confidence score of {documentResults.ClassificationCategory.ConfidenceScore}."); + Console.WriteLine($" Class category \"{documentResults.Classification.Category}\" predicted with a confidence score of {documentResults.Classification.ConfidenceScore}."); Console.WriteLine(); } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample10_SingleCategoryClassifyConvenience.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample10_SingleCategoryClassifyConvenience.cs index b460431900e4..5f38abc706e3 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample10_SingleCategoryClassifyConvenience.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample10_SingleCategoryClassifyConvenience.cs @@ -80,7 +80,7 @@ public void SingleCategoryClassifyConvenience() { foreach (SingleCategoryClassifyResult documentResults in classificationActionResults.DocumentsResults) { - Console.WriteLine($" Class category \"{documentResults.ClassificationCategory.Category}\" predicted with a confidence score of {documentResults.ClassificationCategory.ConfidenceScore}."); + Console.WriteLine($" Class category \"{documentResults.Classification.Category}\" predicted with a confidence score of {documentResults.Classification.ConfidenceScore}."); Console.WriteLine(); } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample10_SingleCategoryClassifyConvenienceAsync.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample10_SingleCategoryClassifyConvenienceAsync.cs index c80940617233..53d4e0f28e02 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample10_SingleCategoryClassifyConvenienceAsync.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample10_SingleCategoryClassifyConvenienceAsync.cs @@ -77,7 +77,7 @@ public async Task SingleCategoryClassifyConvenienceAsync() { foreach (SingleCategoryClassifyResult documentResults in classificationActionResults.DocumentsResults) { - Console.WriteLine($" Class category \"{documentResults.ClassificationCategory.Category}\" predicted with a confidence score of {documentResults.ClassificationCategory.ConfidenceScore}."); + Console.WriteLine($" Class category \"{documentResults.Classification.Category}\" predicted with a confidence score of {documentResults.Classification.ConfidenceScore}."); Console.WriteLine(); } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassify.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassify.cs index c46dc426fa89..20eea3d305ea 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassify.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassify.cs @@ -83,11 +83,11 @@ public void MultiCategoryClassify() { foreach (MultiCategoryClassifyResult documentResults in classificationActionResults.DocumentsResults) { - if (documentResults.ClassificationCategories.Count > 0) + if (documentResults.Classifications.Count > 0) { Console.WriteLine($" The following classes were predicted for this document:"); - foreach (ClassificationCategory classification in documentResults.ClassificationCategories) + foreach (ClassificationCategory classification in documentResults.Classifications) { Console.WriteLine($" Class category \"{classification.Category}\" predicted with a confidence score of {classification.ConfidenceScore}."); } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyAsync.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyAsync.cs index 21cbd75450c4..6ce186d23361 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyAsync.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyAsync.cs @@ -70,11 +70,11 @@ public async Task MultiCategoryClassifyAsync() { foreach (MultiCategoryClassifyResult documentResults in classificationActionResults.DocumentsResults) { - if (documentResults.ClassificationCategories.Count > 0) + if (documentResults.Classifications.Count > 0) { Console.WriteLine($" The following classes were predicted for this document:"); - foreach (ClassificationCategory classification in documentResults.ClassificationCategories) + foreach (ClassificationCategory classification in documentResults.Classifications) { Console.WriteLine($" Class category \"{classification.Category}\" predicted with a confidence score of {classification.ConfidenceScore}."); } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyConvenience.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyConvenience.cs index 8988d00e0748..c67c243e4e57 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyConvenience.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyConvenience.cs @@ -80,11 +80,11 @@ public void MultiCategoryClassifyConvenience() { foreach (MultiCategoryClassifyResult documentResults in classificationActionResults.DocumentsResults) { - if (documentResults.ClassificationCategories.Count > 0) + if (documentResults.Classifications.Count > 0) { Console.WriteLine($" The following classes were predicted for this document:"); - foreach (ClassificationCategory classification in documentResults.ClassificationCategories) + foreach (ClassificationCategory classification in documentResults.Classifications) { Console.WriteLine($" Class category \"{classification.Category}\" predicted with a confidence score of {classification.ConfidenceScore}."); } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyConvenienceAsync.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyConvenienceAsync.cs index b8b7ed0a4e27..e538ca37f6e2 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyConvenienceAsync.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/samples/Sample11_MultiCategoryClassifyConvenienceAsync.cs @@ -77,11 +77,11 @@ public async Task MultiCategoryClassifyConvenienceAsync() { foreach (MultiCategoryClassifyResult documentResults in classificationActionResults.DocumentsResults) { - if (documentResults.ClassificationCategories.Count > 0) + if (documentResults.Classifications.Count > 0) { Console.WriteLine($" The following classes were predicted for this document:"); - foreach (ClassificationCategory classification in documentResults.ClassificationCategories) + foreach (ClassificationCategory classification in documentResults.Classifications) { Console.WriteLine($" Class category \"{classification.Category}\" predicted with a confidence score of {classification.ConfidenceScore}."); }