Class ReinforcementTuningExample.Builder

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

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

    • Builder

      public Builder()
  • Method Details

    • contents

      public abstract ReinforcementTuningExample.Builder contents(List<Content> contents)
      Setter for contents.

      contents: Multi-turn contents that represents the Prompt.

    • contents

      @CanIgnoreReturnValue public ReinforcementTuningExample.Builder contents(Content... contents)
      Setter for contents.

      contents: Multi-turn contents that represents the Prompt.

    • contents

      @CanIgnoreReturnValue public ReinforcementTuningExample.Builder contents(Content.Builder... contentsBuilders)
      Setter for contents builder.

      contents: Multi-turn contents that represents the Prompt.

    • clearContents

      @CanIgnoreReturnValue public ReinforcementTuningExample.Builder clearContents()
      Clears the value of contents field.
    • references

      public abstract ReinforcementTuningExample.Builder references(Map<String,String> references)
      Setter for references.

      references: References for the given prompt. The key is the name of the reference, and the value is the reference itself. Users can use this field together with the reward configurations to calculate rewards for reinforcement tuning. For example, users can set the following references: ``` { "concise_answer": "Yes", "verbose_answer": "The answer is Yes" } ``` Then in a ReinforcementTuningCodeExecutionRewardScorer reward function config, for example, they can define a python code snippet as follows: ``` def evaluate(example, response) -> float: response_str = response.get("parts", [])0 references = example.get("references", {}) if response_str == references.get("concise_answer"): return 1.0 return -1.0 ``` In this case, references can serve the purpose of holding the ground truth of this example in the training/validation dataset.

    • clearReferences

      @CanIgnoreReturnValue public ReinforcementTuningExample.Builder clearReferences()
      Clears the value of references field.
    • systemInstruction

      public abstract ReinforcementTuningExample.Builder systemInstruction(Content systemInstruction)
      Setter for systemInstruction.

      systemInstruction: Corresponds to system_instruction in user-facing GenerateContentRequest.

    • systemInstruction

      @CanIgnoreReturnValue public ReinforcementTuningExample.Builder systemInstruction(Content.Builder systemInstructionBuilder)
      Setter for systemInstruction builder.

      systemInstruction: Corresponds to system_instruction in user-facing GenerateContentRequest.

    • clearSystemInstruction

      @CanIgnoreReturnValue public ReinforcementTuningExample.Builder clearSystemInstruction()
      Clears the value of systemInstruction field.
    • build

      public abstract ReinforcementTuningExample build()