@@ -247,6 +247,42 @@ ObjectNode createTuningJobConfigToMldev(
247247 + " in Gemini Developer API mode." );
248248 }
249249
250+ if (!Common .isZero (Common .getValueByPath (fromObject , new String [] {"rewardConfig" }))) {
251+ throw new IllegalArgumentException (
252+ "rewardConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not"
253+ + " in Gemini Developer API mode." );
254+ }
255+
256+ if (!Common .isZero (Common .getValueByPath (fromObject , new String [] {"compositeRewardConfig" }))) {
257+ throw new IllegalArgumentException (
258+ "compositeRewardConfig parameter is only supported in Gemini Enterprise Agent Platform"
259+ + " mode, not in Gemini Developer API mode." );
260+ }
261+
262+ if (!Common .isZero (Common .getValueByPath (fromObject , new String [] {"samplesPerPrompt" }))) {
263+ throw new IllegalArgumentException (
264+ "samplesPerPrompt parameter is only supported in Gemini Enterprise Agent Platform mode,"
265+ + " not in Gemini Developer API mode." );
266+ }
267+
268+ if (!Common .isZero (Common .getValueByPath (fromObject , new String [] {"evaluateInterval" }))) {
269+ throw new IllegalArgumentException (
270+ "evaluateInterval parameter is only supported in Gemini Enterprise Agent Platform mode,"
271+ + " not in Gemini Developer API mode." );
272+ }
273+
274+ if (!Common .isZero (Common .getValueByPath (fromObject , new String [] {"checkpointInterval" }))) {
275+ throw new IllegalArgumentException (
276+ "checkpointInterval parameter is only supported in Gemini Enterprise Agent Platform mode,"
277+ + " not in Gemini Developer API mode." );
278+ }
279+
280+ if (!Common .isZero (Common .getValueByPath (fromObject , new String [] {"maxOutputTokens" }))) {
281+ throw new IllegalArgumentException (
282+ "maxOutputTokens parameter is only supported in Gemini Enterprise Agent Platform mode,"
283+ + " not in Gemini Developer API mode." );
284+ }
285+
250286 return toObject ;
251287 }
252288
@@ -294,6 +330,17 @@ ObjectNode createTuningJobConfigToVertex(
294330 toObject ,
295331 rootObject ));
296332 }
333+ } else if (discriminatorValueValidationDataset .equals ("REINFORCEMENT_TUNING" )) {
334+ if (Common .getValueByPath (fromObject , new String [] {"validationDataset" }) != null ) {
335+ Common .setValueByPath (
336+ parentObject ,
337+ new String [] {"reinforcementTuningSpec" },
338+ tuningValidationDatasetToVertex (
339+ JsonSerializable .toJsonNode (
340+ Common .getValueByPath (fromObject , new String [] {"validationDataset" })),
341+ toObject ,
342+ rootObject ));
343+ }
297344 }
298345 if (Common .getValueByPath (fromObject , new String [] {"tunedModelDisplayName" }) != null ) {
299346 Common .setValueByPath (
@@ -336,6 +383,13 @@ ObjectNode createTuningJobConfigToVertex(
336383 new String [] {"distillationSpec" , "hyperParameters" , "epochCount" },
337384 Common .getValueByPath (fromObject , new String [] {"epochCount" }));
338385 }
386+ } else if (discriminatorValueEpochCount .equals ("REINFORCEMENT_TUNING" )) {
387+ if (Common .getValueByPath (fromObject , new String [] {"epochCount" }) != null ) {
388+ Common .setValueByPath (
389+ parentObject ,
390+ new String [] {"reinforcementTuningSpec" , "hyperParameters" , "epochCount" },
391+ Common .getValueByPath (fromObject , new String [] {"epochCount" }));
392+ }
339393 }
340394
341395 JsonNode discriminatorLearningRateMultiplier =
@@ -367,6 +421,13 @@ ObjectNode createTuningJobConfigToVertex(
367421 new String [] {"distillationSpec" , "hyperParameters" , "learningRateMultiplier" },
368422 Common .getValueByPath (fromObject , new String [] {"learningRateMultiplier" }));
369423 }
424+ } else if (discriminatorValueLearningRateMultiplier .equals ("REINFORCEMENT_TUNING" )) {
425+ if (Common .getValueByPath (fromObject , new String [] {"learningRateMultiplier" }) != null ) {
426+ Common .setValueByPath (
427+ parentObject ,
428+ new String [] {"reinforcementTuningSpec" , "hyperParameters" , "learningRateMultiplier" },
429+ Common .getValueByPath (fromObject , new String [] {"learningRateMultiplier" }));
430+ }
370431 }
371432
372433 JsonNode discriminatorExportLastCheckpointOnly =
@@ -425,6 +486,13 @@ ObjectNode createTuningJobConfigToVertex(
425486 new String [] {"distillationSpec" , "hyperParameters" , "adapterSize" },
426487 Common .getValueByPath (fromObject , new String [] {"adapterSize" }));
427488 }
489+ } else if (discriminatorValueAdapterSize .equals ("REINFORCEMENT_TUNING" )) {
490+ if (Common .getValueByPath (fromObject , new String [] {"adapterSize" }) != null ) {
491+ Common .setValueByPath (
492+ parentObject ,
493+ new String [] {"reinforcementTuningSpec" , "hyperParameters" , "adapterSize" },
494+ Common .getValueByPath (fromObject , new String [] {"adapterSize" }));
495+ }
428496 }
429497
430498 JsonNode discriminatorTuningMode =
@@ -473,6 +541,13 @@ ObjectNode createTuningJobConfigToVertex(
473541 new String [] {"distillationSpec" , "hyperParameters" , "batchSize" },
474542 Common .getValueByPath (fromObject , new String [] {"batchSize" }));
475543 }
544+ } else if (discriminatorValueBatchSize .equals ("REINFORCEMENT_TUNING" )) {
545+ if (Common .getValueByPath (fromObject , new String [] {"batchSize" }) != null ) {
546+ Common .setValueByPath (
547+ parentObject ,
548+ new String [] {"reinforcementTuningSpec" , "hyperParameters" , "batchSize" },
549+ Common .getValueByPath (fromObject , new String [] {"batchSize" }));
550+ }
476551 }
477552
478553 JsonNode discriminatorLearningRate =
@@ -586,6 +661,48 @@ ObjectNode createTuningJobConfigToVertex(
586661 Common .getValueByPath (fromObject , new String [] {"encryptionSpec" }));
587662 }
588663
664+ if (Common .getValueByPath (fromObject , new String [] {"rewardConfig" }) != null ) {
665+ Common .setValueByPath (
666+ parentObject ,
667+ new String [] {"reinforcementTuningSpec" , "singleRewardConfig" },
668+ Common .getValueByPath (fromObject , new String [] {"rewardConfig" }));
669+ }
670+
671+ if (Common .getValueByPath (fromObject , new String [] {"compositeRewardConfig" }) != null ) {
672+ Common .setValueByPath (
673+ parentObject ,
674+ new String [] {"reinforcementTuningSpec" , "compositeRewardConfig" },
675+ Common .getValueByPath (fromObject , new String [] {"compositeRewardConfig" }));
676+ }
677+
678+ if (Common .getValueByPath (fromObject , new String [] {"samplesPerPrompt" }) != null ) {
679+ Common .setValueByPath (
680+ parentObject ,
681+ new String [] {"reinforcementTuningSpec" , "hyperParameters" , "samplesPerPrompt" },
682+ Common .getValueByPath (fromObject , new String [] {"samplesPerPrompt" }));
683+ }
684+
685+ if (Common .getValueByPath (fromObject , new String [] {"evaluateInterval" }) != null ) {
686+ Common .setValueByPath (
687+ parentObject ,
688+ new String [] {"reinforcementTuningSpec" , "hyperParameters" , "evaluateInterval" },
689+ Common .getValueByPath (fromObject , new String [] {"evaluateInterval" }));
690+ }
691+
692+ if (Common .getValueByPath (fromObject , new String [] {"checkpointInterval" }) != null ) {
693+ Common .setValueByPath (
694+ parentObject ,
695+ new String [] {"reinforcementTuningSpec" , "hyperParameters" , "checkpointInterval" },
696+ Common .getValueByPath (fromObject , new String [] {"checkpointInterval" }));
697+ }
698+
699+ if (Common .getValueByPath (fromObject , new String [] {"maxOutputTokens" }) != null ) {
700+ Common .setValueByPath (
701+ parentObject ,
702+ new String [] {"reinforcementTuningSpec" , "hyperParameters" , "maxOutputTokens" },
703+ Common .getValueByPath (fromObject , new String [] {"maxOutputTokens" }));
704+ }
705+
589706 return toObject ;
590707 }
591708
@@ -1430,6 +1547,13 @@ ObjectNode tuningDatasetToVertex(
14301547 new String [] {"distillationSpec" , "promptDatasetUri" },
14311548 Common .getValueByPath (fromObject , new String [] {"gcsUri" }));
14321549 }
1550+ } else if (discriminatorValueGcsUri .equals ("REINFORCEMENT_TUNING" )) {
1551+ if (Common .getValueByPath (fromObject , new String [] {"gcsUri" }) != null ) {
1552+ Common .setValueByPath (
1553+ parentObject ,
1554+ new String [] {"reinforcementTuningSpec" , "trainingDatasetUri" },
1555+ Common .getValueByPath (fromObject , new String [] {"gcsUri" }));
1556+ }
14331557 }
14341558
14351559 JsonNode discriminatorVertexDatasetResource =
@@ -1459,6 +1583,13 @@ ObjectNode tuningDatasetToVertex(
14591583 new String [] {"distillationSpec" , "promptDatasetUri" },
14601584 Common .getValueByPath (fromObject , new String [] {"vertexDatasetResource" }));
14611585 }
1586+ } else if (discriminatorValueVertexDatasetResource .equals ("REINFORCEMENT_TUNING" )) {
1587+ if (Common .getValueByPath (fromObject , new String [] {"vertexDatasetResource" }) != null ) {
1588+ Common .setValueByPath (
1589+ parentObject ,
1590+ new String [] {"reinforcementTuningSpec" , "trainingDatasetUri" },
1591+ Common .getValueByPath (fromObject , new String [] {"vertexDatasetResource" }));
1592+ }
14621593 }
14631594 if (!Common .isZero (Common .getValueByPath (fromObject , new String [] {"examples" }))) {
14641595 throw new IllegalArgumentException (
0 commit comments