Class ReinforcementTuningExample.Builder
- Enclosing class:
- ReinforcementTuningExample
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract ReinforcementTuningExamplebuild()Clears the value of contents field.Clears the value of references field.Clears the value of systemInstruction field.Setter for contents.contents(Content.Builder... contentsBuilders) Setter for contents builder.abstract ReinforcementTuningExample.BuilderSetter for contents.abstract ReinforcementTuningExample.Builderreferences(Map<String, String> references) Setter for references.abstract ReinforcementTuningExample.BuildersystemInstruction(Content systemInstruction) Setter for systemInstruction.systemInstruction(Content.Builder systemInstructionBuilder) Setter for systemInstruction builder.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
contents
Setter for contents.contents: Multi-turn contents that represents the Prompt.
-
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
Clears the value of contents field. -
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
Clears the value of references field. -
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
Clears the value of systemInstruction field. -
build
-