Class ReinforcementTuningExample

java.lang.Object
com.google.genai.JsonSerializable
com.google.genai.types.ReinforcementTuningExample

public abstract class ReinforcementTuningExample extends JsonSerializable
User-facing format for Gemini Reinforcement Tuning examples on Vertex. This data type is not supported in Gemini API.
  • Constructor Details

    • ReinforcementTuningExample

      public ReinforcementTuningExample()
  • Method Details

    • contents

      public abstract Optional<List<Content>> contents()
      Multi-turn contents that represents the Prompt.
    • references

      public abstract Optional<Map<String,String>> 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.
    • systemInstruction

      public abstract Optional<Content> systemInstruction()
      Corresponds to system_instruction in user-facing GenerateContentRequest.
    • builder

      public static ReinforcementTuningExample.Builder builder()
      Instantiates a builder for ReinforcementTuningExample.
    • toBuilder

      public abstract ReinforcementTuningExample.Builder toBuilder()
      Creates a builder with the same values as this instance.
    • fromJson

      public static ReinforcementTuningExample fromJson(String jsonString)
      Deserializes a JSON string to a ReinforcementTuningExample object.