diff --git a/src/IBM.Watson.NaturalLanguageUnderstanding.v1/INaturalLanguageUnderstandingService.cs b/src/IBM.Watson.NaturalLanguageUnderstanding.v1/INaturalLanguageUnderstandingService.cs index 5b8f048ae4..eab14bd484 100644 --- a/src/IBM.Watson.NaturalLanguageUnderstanding.v1/INaturalLanguageUnderstandingService.cs +++ b/src/IBM.Watson.NaturalLanguageUnderstanding.v1/INaturalLanguageUnderstandingService.cs @@ -1,5 +1,5 @@ /** -* (C) Copyright IBM Corp. 2019, 2021. +* (C) Copyright IBM Corp. 2022. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,10 +35,10 @@ public partial interface INaturalLanguageUnderstandingService DetailedResponse GetCategoriesModel(string modelId); DetailedResponse UpdateCategoriesModel(string modelId, string language, System.IO.MemoryStream trainingData, string trainingDataContentType = null, string name = null, string description = null, string modelVersion = null, string workspaceId = null, string versionDescription = null); DetailedResponse DeleteCategoriesModel(string modelId); - DetailedResponse CreateClassificationsModel(string language, System.IO.MemoryStream trainingData, string trainingDataContentType = null, string name = null, string description = null, string modelVersion = null, string workspaceId = null, string versionDescription = null); + DetailedResponse CreateClassificationsModel(string language, System.IO.MemoryStream trainingData, string trainingDataContentType = null, string name = null, string description = null, string modelVersion = null, string workspaceId = null, string versionDescription = null, ClassificationsTrainingParameters trainingParameters = null); DetailedResponse ListClassificationsModels(); DetailedResponse GetClassificationsModel(string modelId); - DetailedResponse UpdateClassificationsModel(string modelId, string language, System.IO.MemoryStream trainingData, string trainingDataContentType = null, string name = null, string description = null, string modelVersion = null, string workspaceId = null, string versionDescription = null); + DetailedResponse UpdateClassificationsModel(string modelId, string language, System.IO.MemoryStream trainingData, string trainingDataContentType = null, string name = null, string description = null, string modelVersion = null, string workspaceId = null, string versionDescription = null, ClassificationsTrainingParameters trainingParameters = null); DetailedResponse DeleteClassificationsModel(string modelId); } } diff --git a/src/IBM.Watson.NaturalLanguageUnderstanding.v1/Model/ClassificationsTrainingParameters.cs b/src/IBM.Watson.NaturalLanguageUnderstanding.v1/Model/ClassificationsTrainingParameters.cs new file mode 100644 index 0000000000..1b75cdde81 --- /dev/null +++ b/src/IBM.Watson.NaturalLanguageUnderstanding.v1/Model/ClassificationsTrainingParameters.cs @@ -0,0 +1,51 @@ +/** +* (C) Copyright IBM Corp. 2022. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +using Newtonsoft.Json; + +namespace IBM.Watson.NaturalLanguageUnderstanding.v1.Model +{ + /// + /// Optional classifications training parameters along with model train requests. + /// + public class ClassificationsTrainingParameters + { + /// + /// Model type selector to train either a single_label or a multi_label classifier. + /// + public class ModelTypeEnumValue + { + /// + /// Constant SINGLE_LABEL for single_label + /// + public const string SINGLE_LABEL = "single_label"; + /// + /// Constant MULTI_LABEL for multi_label + /// + public const string MULTI_LABEL = "multi_label"; + + } + + /// + /// Model type selector to train either a single_label or a multi_label classifier. + /// Constants for possible values can be found using ClassificationsTrainingParameters.ModelTypeEnumValue + /// + [JsonProperty("model_type", NullValueHandling = NullValueHandling.Ignore)] + public string ModelType { get; set; } + } + +} diff --git a/src/IBM.Watson.NaturalLanguageUnderstanding.v1/NaturalLanguageUnderstandingService.cs b/src/IBM.Watson.NaturalLanguageUnderstanding.v1/NaturalLanguageUnderstandingService.cs index 40e46ea00d..510c8c4c4c 100644 --- a/src/IBM.Watson.NaturalLanguageUnderstanding.v1/NaturalLanguageUnderstandingService.cs +++ b/src/IBM.Watson.NaturalLanguageUnderstanding.v1/NaturalLanguageUnderstandingService.cs @@ -1,5 +1,5 @@ /** -* (C) Copyright IBM Corp. 2017, 2022. +* (C) Copyright IBM Corp. 2022. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ */ /** -* IBM OpenAPI SDK Code Generator Version: 3.46.0-a4e29da0-20220224-210428 +* IBM OpenAPI SDK Code Generator Version: 3.53.0-9710cac3-20220713-193508 */ using System.Collections.Generic; @@ -1150,8 +1150,10 @@ public DetailedResponse DeleteCategoriesModel(string modelId /// ID of the Watson Knowledge Studio workspace that deployed this model to Natural /// Language Understanding. (optional) /// The description of the version. (optional) + /// Optional classifications training parameters along with model train + /// requests. (optional) /// ClassificationsModel - public DetailedResponse CreateClassificationsModel(string language, System.IO.MemoryStream trainingData, string trainingDataContentType = null, string name = null, string description = null, string modelVersion = null, string workspaceId = null, string versionDescription = null) + public DetailedResponse CreateClassificationsModel(string language, System.IO.MemoryStream trainingData, string trainingDataContentType = null, string name = null, string description = null, string modelVersion = null, string workspaceId = null, string versionDescription = null, ClassificationsTrainingParameters trainingParameters = null) { if (string.IsNullOrEmpty(Version)) { @@ -1222,6 +1224,13 @@ public DetailedResponse CreateClassificationsModel(string formData.Add(versionDescriptionContent, "version_description"); } + if (trainingParameters != null) + { + var trainingParametersContent = new StringContent(JsonConvert.SerializeObject(trainingParameters), Encoding.UTF8, HttpMediaType.APPLICATION_JSON); + trainingParametersContent.Headers.ContentType = null; + formData.Add(trainingParametersContent, "training_parameters"); + } + IClient client = this.Client; SetAuthentication(); @@ -1391,8 +1400,10 @@ public DetailedResponse GetClassificationsModel(string mod /// ID of the Watson Knowledge Studio workspace that deployed this model to Natural /// Language Understanding. (optional) /// The description of the version. (optional) + /// Optional classifications training parameters along with model train + /// requests. (optional) /// ClassificationsModel - public DetailedResponse UpdateClassificationsModel(string modelId, string language, System.IO.MemoryStream trainingData, string trainingDataContentType = null, string name = null, string description = null, string modelVersion = null, string workspaceId = null, string versionDescription = null) + public DetailedResponse UpdateClassificationsModel(string modelId, string language, System.IO.MemoryStream trainingData, string trainingDataContentType = null, string name = null, string description = null, string modelVersion = null, string workspaceId = null, string versionDescription = null, ClassificationsTrainingParameters trainingParameters = null) { if (string.IsNullOrEmpty(Version)) { @@ -1471,6 +1482,13 @@ public DetailedResponse UpdateClassificationsModel(string formData.Add(versionDescriptionContent, "version_description"); } + if (trainingParameters != null) + { + var trainingParametersContent = new StringContent(JsonConvert.SerializeObject(trainingParameters), Encoding.UTF8, HttpMediaType.APPLICATION_JSON); + trainingParametersContent.Headers.ContentType = null; + formData.Add(trainingParametersContent, "training_parameters"); + } + IClient client = this.Client; SetAuthentication();