diff --git a/Google.GenAI/Tunings.cs b/Google.GenAI/Tunings.cs index 6b7de32b..93c09d9a 100644 --- a/Google.GenAI/Tunings.cs +++ b/Google.GenAI/Tunings.cs @@ -355,6 +355,11 @@ internal JsonNode CreateTuningJobConfigToVertex(JsonNode fromObject, JsonObject Common.SetValueByPath(parentObject, new string[] { "supervisedTuningSpec", "tuningMode" }, Common.GetValueByPath(fromObject, new string[] { "tuningMode" })); } + } else if (discriminatorValueTuningMode == "DISTILLATION") { + if (Common.GetValueByPath(fromObject, new string[] { "tuningMode" }) != null) { + Common.SetValueByPath(parentObject, new string[] { "distillationSpec", "tuningMode" }, + Common.GetValueByPath(fromObject, new string[] { "tuningMode" })); + } } if (Common.GetValueByPath(fromObject, new string[] { "customBaseModel" }) != null) { Common.SetValueByPath( @@ -373,6 +378,12 @@ internal JsonNode CreateTuningJobConfigToVertex(JsonNode fromObject, JsonObject parentObject, new string[] { "supervisedTuningSpec", "hyperParameters", "batchSize" }, Common.GetValueByPath(fromObject, new string[] { "batchSize" })); } + } else if (discriminatorValueBatchSize == "DISTILLATION") { + if (Common.GetValueByPath(fromObject, new string[] { "batchSize" }) != null) { + Common.SetValueByPath(parentObject, + new string[] { "distillationSpec", "hyperParameters", "batchSize" }, + Common.GetValueByPath(fromObject, new string[] { "batchSize" })); + } } JsonNode discriminatorLearningRate = @@ -387,6 +398,12 @@ internal JsonNode CreateTuningJobConfigToVertex(JsonNode fromObject, JsonObject new string[] { "supervisedTuningSpec", "hyperParameters", "learningRate" }, Common.GetValueByPath(fromObject, new string[] { "learningRate" })); } + } else if (discriminatorValueLearningRate == "DISTILLATION") { + if (Common.GetValueByPath(fromObject, new string[] { "learningRate" }) != null) { + Common.SetValueByPath( + parentObject, new string[] { "distillationSpec", "hyperParameters", "learningRate" }, + Common.GetValueByPath(fromObject, new string[] { "learningRate" })); + } } if (Common.GetValueByPath(fromObject, new string[] { "labels" }) != null) { diff --git a/Google.GenAI/types/CreateTuningJobConfig.cs b/Google.GenAI/types/CreateTuningJobConfig.cs index 50d54fa8..c69cd16c 100644 --- a/Google.GenAI/types/CreateTuningJobConfig.cs +++ b/Google.GenAI/types/CreateTuningJobConfig.cs @@ -129,7 +129,7 @@ public AdapterSize } /// - /// Tuning mode for SFT tuning. + /// Tuning mode for tuning. /// [JsonPropertyName("tuningMode")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] diff --git a/Google.GenAI/types/DistillationHyperParameters.cs b/Google.GenAI/types/DistillationHyperParameters.cs index fed2e98c..bd4f8df6 100644 --- a/Google.GenAI/types/DistillationHyperParameters.cs +++ b/Google.GenAI/types/DistillationHyperParameters.cs @@ -23,7 +23,7 @@ namespace Google.GenAI.Types { /// - /// Hyperparameters for Distillation. This data type is not supported in Gemini API. + /// Hyperparameters for distillation. /// public record DistillationHyperParameters { @@ -56,6 +56,26 @@ public double get; set; } + /// + /// The batch size hyperparameter for tuning. This is only supported for OSS models in Vertex. + /// + [JsonPropertyName("batchSize")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public int + ? BatchSize { + get; set; + } + + /// + /// The learning rate for tuning. OSS models only. + /// + [JsonPropertyName("learningRate")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public double + ? LearningRate { + get; set; + } + /// /// Deserializes a JSON string to a DistillationHyperParameters object. /// diff --git a/Google.GenAI/types/DistillationSpec.cs b/Google.GenAI/types/DistillationSpec.cs index 4f6c56f2..a670d800 100644 --- a/Google.GenAI/types/DistillationSpec.cs +++ b/Google.GenAI/types/DistillationSpec.cs @@ -111,6 +111,16 @@ public string get; set; } + /// + /// Tuning mode for tuning. + /// + [JsonPropertyName("tuningMode")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public TuningMode + ? TuningMode { + get; set; + } + /// /// Deserializes a JSON string to a DistillationSpec object. ///