Class CreateTuningJobConfig.Builder

java.lang.Object
com.google.genai.types.CreateTuningJobConfig.Builder
Enclosing class:
CreateTuningJobConfig

public abstract static class CreateTuningJobConfig.Builder extends Object
Builder for CreateTuningJobConfig.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • httpOptions

      public abstract CreateTuningJobConfig.Builder httpOptions(HttpOptions httpOptions)
      Setter for httpOptions.

      httpOptions: Used to override HTTP request options.

    • httpOptions

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder httpOptions(HttpOptions.Builder httpOptionsBuilder)
      Setter for httpOptions builder.

      httpOptions: Used to override HTTP request options.

    • clearHttpOptions

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder clearHttpOptions()
      Clears the value of httpOptions field.
    • method

      public abstract CreateTuningJobConfig.Builder method(TuningMethod method)
      Setter for method.

      method: The method to use for tuning (SUPERVISED_FINE_TUNING or PREFERENCE_TUNING or DISTILLATION or REINFORCEMENT_TUNING). If not set, the default method (SFT) will be used.

    • clearMethod

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder clearMethod()
      Clears the value of method field.
    • method

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder method(TuningMethod.Known knownType)
      Setter for method given a known enum.

      method: The method to use for tuning (SUPERVISED_FINE_TUNING or PREFERENCE_TUNING or DISTILLATION or REINFORCEMENT_TUNING). If not set, the default method (SFT) will be used.

    • method

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder method(String method)
      Setter for method given a string.

      method: The method to use for tuning (SUPERVISED_FINE_TUNING or PREFERENCE_TUNING or DISTILLATION or REINFORCEMENT_TUNING). If not set, the default method (SFT) will be used.

    • validationDataset

      public abstract CreateTuningJobConfig.Builder validationDataset(TuningValidationDataset validationDataset)
      Setter for validationDataset.

      validationDataset: Validation dataset for tuning. The dataset must be formatted as a JSONL file.

    • validationDataset

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder validationDataset(TuningValidationDataset.Builder validationDatasetBuilder)
      Setter for validationDataset builder.

      validationDataset: Validation dataset for tuning. The dataset must be formatted as a JSONL file.

    • clearValidationDataset

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder clearValidationDataset()
      Clears the value of validationDataset field.
    • tunedModelDisplayName

      public abstract CreateTuningJobConfig.Builder tunedModelDisplayName(String tunedModelDisplayName)
      Setter for tunedModelDisplayName.

      tunedModelDisplayName: The display name of the tuned Model. The name can be up to 128 characters long and can consist of any UTF-8 characters.

    • clearTunedModelDisplayName

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder clearTunedModelDisplayName()
      Clears the value of tunedModelDisplayName field.
    • description

      public abstract CreateTuningJobConfig.Builder description(String description)
      Setter for description.

      description: The description of the TuningJob

    • clearDescription

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder clearDescription()
      Clears the value of description field.
    • epochCount

      public abstract CreateTuningJobConfig.Builder epochCount(Integer epochCount)
      Setter for epochCount.

      epochCount: Number of complete passes the model makes over the entire training dataset during training.

    • clearEpochCount

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder clearEpochCount()
      Clears the value of epochCount field.
    • learningRateMultiplier

      public abstract CreateTuningJobConfig.Builder learningRateMultiplier(Float learningRateMultiplier)
      Setter for learningRateMultiplier.

      learningRateMultiplier: Multiplier for adjusting the default learning rate. 1P models only. Mutually exclusive with learning_rate.

    • clearLearningRateMultiplier

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder clearLearningRateMultiplier()
      Clears the value of learningRateMultiplier field.
    • exportLastCheckpointOnly

      public abstract CreateTuningJobConfig.Builder exportLastCheckpointOnly(boolean exportLastCheckpointOnly)
      Setter for exportLastCheckpointOnly.

      exportLastCheckpointOnly: If set to true, disable intermediate checkpoints and only the last checkpoint will be exported. Otherwise, enable intermediate checkpoints.

    • clearExportLastCheckpointOnly

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder clearExportLastCheckpointOnly()
      Clears the value of exportLastCheckpointOnly field.
    • preTunedModelCheckpointId

      public abstract CreateTuningJobConfig.Builder preTunedModelCheckpointId(String preTunedModelCheckpointId)
      Setter for preTunedModelCheckpointId.

      preTunedModelCheckpointId: The optional checkpoint id of the pre-tuned model to use for tuning, if applicable.

    • clearPreTunedModelCheckpointId

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder clearPreTunedModelCheckpointId()
      Clears the value of preTunedModelCheckpointId field.
    • adapterSize

      public abstract CreateTuningJobConfig.Builder adapterSize(AdapterSize adapterSize)
      Setter for adapterSize.

      adapterSize: Adapter size for tuning.

    • clearAdapterSize

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder clearAdapterSize()
      Clears the value of adapterSize field.
    • adapterSize

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder adapterSize(AdapterSize.Known knownType)
      Setter for adapterSize given a known enum.

      adapterSize: Adapter size for tuning.

    • adapterSize

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder adapterSize(String adapterSize)
      Setter for adapterSize given a string.

      adapterSize: Adapter size for tuning.

    • tuningMode

      public abstract CreateTuningJobConfig.Builder tuningMode(TuningMode tuningMode)
      Setter for tuningMode.

      tuningMode: Tuning mode for tuning.

    • clearTuningMode

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder clearTuningMode()
      Clears the value of tuningMode field.
    • tuningMode

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder tuningMode(TuningMode.Known knownType)
      Setter for tuningMode given a known enum.

      tuningMode: Tuning mode for tuning.

    • tuningMode

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder tuningMode(String tuningMode)
      Setter for tuningMode given a string.

      tuningMode: Tuning mode for tuning.

    • customBaseModel

      public abstract CreateTuningJobConfig.Builder customBaseModel(String customBaseModel)
      Setter for customBaseModel.

      customBaseModel: Custom base model for tuning. This is only supported for OSS models in Gemini Enterprise Agent Platform.

    • clearCustomBaseModel

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder clearCustomBaseModel()
      Clears the value of customBaseModel field.
    • batchSize

      public abstract CreateTuningJobConfig.Builder batchSize(Integer batchSize)
      Setter for batchSize.

      batchSize: The batch size hyperparameter for tuning. This is only supported for OSS models in Gemini Enterprise Agent Platform.

    • clearBatchSize

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder clearBatchSize()
      Clears the value of batchSize field.
    • learningRate

      public abstract CreateTuningJobConfig.Builder learningRate(Float learningRate)
      Setter for learningRate.

      learningRate: The learning rate for tuning. OSS models only. Mutually exclusive with learning_rate_multiplier.

    • clearLearningRate

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder clearLearningRate()
      Clears the value of learningRate field.
    • evaluationConfig

      public abstract CreateTuningJobConfig.Builder evaluationConfig(EvaluationConfig evaluationConfig)
      Setter for evaluationConfig.

      evaluationConfig: Evaluation config for the tuning job.

    • evaluationConfig

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder evaluationConfig(EvaluationConfig.Builder evaluationConfigBuilder)
      Setter for evaluationConfig builder.

      evaluationConfig: Evaluation config for the tuning job.

    • clearEvaluationConfig

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder clearEvaluationConfig()
      Clears the value of evaluationConfig field.
    • labels

      public abstract CreateTuningJobConfig.Builder labels(Map<String,String> labels)
      Setter for labels.

      labels: Optional. The labels with user-defined metadata to organize TuningJob and generated resources such as Model and Endpoint. Label keys and values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. See https://goo.gl/xmQnxf for more information and examples of labels.

    • clearLabels

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder clearLabels()
      Clears the value of labels field.
    • beta

      public abstract CreateTuningJobConfig.Builder beta(Float beta)
      Setter for beta.

      beta: Weight for KL Divergence regularization, Preference Optimization tuning only.

    • clearBeta

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder clearBeta()
      Clears the value of beta field.
    • baseTeacherModel

      public abstract CreateTuningJobConfig.Builder baseTeacherModel(String baseTeacherModel)
      Setter for baseTeacherModel.

      baseTeacherModel: The base teacher model that is being distilled. Distillation only.

    • clearBaseTeacherModel

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder clearBaseTeacherModel()
      Clears the value of baseTeacherModel field.
    • tunedTeacherModelSource

      public abstract CreateTuningJobConfig.Builder tunedTeacherModelSource(String tunedTeacherModelSource)
      Setter for tunedTeacherModelSource.

      tunedTeacherModelSource: The resource name of the Tuned teacher model. Distillation only.

    • clearTunedTeacherModelSource

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder clearTunedTeacherModelSource()
      Clears the value of tunedTeacherModelSource field.
    • sftLossWeightMultiplier

      public abstract CreateTuningJobConfig.Builder sftLossWeightMultiplier(Float sftLossWeightMultiplier)
      Setter for sftLossWeightMultiplier.

      sftLossWeightMultiplier: Multiplier for adjusting the weight of the SFT loss. Distillation only.

    • clearSftLossWeightMultiplier

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder clearSftLossWeightMultiplier()
      Clears the value of sftLossWeightMultiplier field.
    • outputUri

      public abstract CreateTuningJobConfig.Builder outputUri(String outputUri)
      Setter for outputUri.

      outputUri: The Google Cloud Storage location where the tuning job outputs are written.

    • clearOutputUri

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder clearOutputUri()
      Clears the value of outputUri field.
    • encryptionSpec

      public abstract CreateTuningJobConfig.Builder encryptionSpec(EncryptionSpec encryptionSpec)
      Setter for encryptionSpec.

      encryptionSpec: The encryption spec of the tuning job. Customer-managed encryption key options for a TuningJob. If this is set, then all resources created by the TuningJob will be encrypted with provided encryption key.

    • encryptionSpec

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder encryptionSpec(EncryptionSpec.Builder encryptionSpecBuilder)
      Setter for encryptionSpec builder.

      encryptionSpec: The encryption spec of the tuning job. Customer-managed encryption key options for a TuningJob. If this is set, then all resources created by the TuningJob will be encrypted with provided encryption key.

    • clearEncryptionSpec

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder clearEncryptionSpec()
      Clears the value of encryptionSpec field.
    • rewardConfig

      public abstract CreateTuningJobConfig.Builder rewardConfig(SingleReinforcementTuningRewardConfig rewardConfig)
      Setter for rewardConfig.

      rewardConfig: Reward function configuration for reinforcement tuning. Reinforcement tuning only.

    • rewardConfig

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder rewardConfig(SingleReinforcementTuningRewardConfig.Builder rewardConfigBuilder)
      Setter for rewardConfig builder.

      rewardConfig: Reward function configuration for reinforcement tuning. Reinforcement tuning only.

    • clearRewardConfig

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder clearRewardConfig()
      Clears the value of rewardConfig field.
    • compositeRewardConfig

      public abstract CreateTuningJobConfig.Builder compositeRewardConfig(CompositeReinforcementTuningRewardConfig compositeRewardConfig)
      Setter for compositeRewardConfig.

      compositeRewardConfig: Composite reward function configuration for reinforcement tuning. Reinforcement tuning only.

    • compositeRewardConfig

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder compositeRewardConfig(CompositeReinforcementTuningRewardConfig.Builder compositeRewardConfigBuilder)
      Setter for compositeRewardConfig builder.

      compositeRewardConfig: Composite reward function configuration for reinforcement tuning. Reinforcement tuning only.

    • clearCompositeRewardConfig

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder clearCompositeRewardConfig()
      Clears the value of compositeRewardConfig field.
    • samplesPerPrompt

      public abstract CreateTuningJobConfig.Builder samplesPerPrompt(Integer samplesPerPrompt)
      Setter for samplesPerPrompt.

      samplesPerPrompt: Number of different responses to generate per prompt during tuning. Reinforcement tuning only.

    • clearSamplesPerPrompt

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder clearSamplesPerPrompt()
      Clears the value of samplesPerPrompt field.
    • evaluateInterval

      public abstract CreateTuningJobConfig.Builder evaluateInterval(Integer evaluateInterval)
      Setter for evaluateInterval.

      evaluateInterval: How often at steps to evaluate the tuning job during training. Reinforcement tuning only.

    • clearEvaluateInterval

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder clearEvaluateInterval()
      Clears the value of evaluateInterval field.
    • checkpointInterval

      public abstract CreateTuningJobConfig.Builder checkpointInterval(Integer checkpointInterval)
      Setter for checkpointInterval.

      checkpointInterval: How often at steps to save checkpoints during training. Reinforcement tuning only.

    • clearCheckpointInterval

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder clearCheckpointInterval()
      Clears the value of checkpointInterval field.
    • maxOutputTokens

      public abstract CreateTuningJobConfig.Builder maxOutputTokens(Integer maxOutputTokens)
      Setter for maxOutputTokens.

      maxOutputTokens: The maximum number of tokens to generate per prompt. Reinforcement tuning only.

    • clearMaxOutputTokens

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder clearMaxOutputTokens()
      Clears the value of maxOutputTokens field.
    • thinkingLevel

      public abstract CreateTuningJobConfig.Builder thinkingLevel(ReinforcementTuningThinkingLevel thinkingLevel)
      Setter for thinkingLevel.

      thinkingLevel: Indicates the maximum thinking depth. Use with earlier models shall result in error. Reinforcement tuning only.

    • clearThinkingLevel

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder clearThinkingLevel()
      Clears the value of thinkingLevel field.
    • thinkingLevel

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder thinkingLevel(ReinforcementTuningThinkingLevel.Known knownType)
      Setter for thinkingLevel given a known enum.

      thinkingLevel: Indicates the maximum thinking depth. Use with earlier models shall result in error. Reinforcement tuning only.

    • thinkingLevel

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder thinkingLevel(String thinkingLevel)
      Setter for thinkingLevel given a string.

      thinkingLevel: Indicates the maximum thinking depth. Use with earlier models shall result in error. Reinforcement tuning only.

    • validationDatasetUri

      public abstract CreateTuningJobConfig.Builder validationDatasetUri(String validationDatasetUri)
      Setter for validationDatasetUri.

      validationDatasetUri: Cloud Storage path to file containing validation dataset for tuning. The dataset must be formatted as a JSONL file. If no validation dataset is provided, by default the API splits 25% of the training dataset or 50 examples, whichever is larger, as the validation dataset. Reinforcement tuning only.

    • clearValidationDatasetUri

      @CanIgnoreReturnValue public CreateTuningJobConfig.Builder clearValidationDatasetUri()
      Clears the value of validationDatasetUri field.
    • build

      public abstract CreateTuningJobConfig build()