Package com.google.genai.types
Class ReinforcementTuningExample
java.lang.Object
com.google.genai.JsonSerializable
com.google.genai.types.ReinforcementTuningExample
User-facing format for Gemini Reinforcement Tuning examples on Vertex. This data type is not
supported in Gemini API.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for ReinforcementTuningExample. -
Field Summary
Fields inherited from class com.google.genai.JsonSerializable
MAX_READ_LENGTH_PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Instantiates a builder for ReinforcementTuningExample.contents()Multi-turn contents that represents the Prompt.static ReinforcementTuningExampleDeserializes a JSON string to a ReinforcementTuningExample object.References for the given prompt.Corresponds to system_instruction in user-facing GenerateContentRequest.abstract ReinforcementTuningExample.BuilderCreates a builder with the same values as this instance.Methods inherited from class com.google.genai.JsonSerializable
fromJsonNode, fromJsonString, objectMapper, setMaxReadLength, stringToJsonNode, toJson, toJsonNode, toJsonString
-
Constructor Details
-
ReinforcementTuningExample
public ReinforcementTuningExample()
-
-
Method Details
-
contents
Multi-turn contents that represents the Prompt. -
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
Corresponds to system_instruction in user-facing GenerateContentRequest. -
builder
Instantiates a builder for ReinforcementTuningExample. -
toBuilder
Creates a builder with the same values as this instance. -
fromJson
Deserializes a JSON string to a ReinforcementTuningExample object.
-