Package com.google.genai.types
Class ReinforcementTuningCodeExecutionRewardScorer.Builder
java.lang.Object
com.google.genai.types.ReinforcementTuningCodeExecutionRewardScorer.Builder
- Enclosing class:
- ReinforcementTuningCodeExecutionRewardScorer
Builder for ReinforcementTuningCodeExecutionRewardScorer.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Clears the value of pythonCodeSnippet field.pythonCodeSnippet(String pythonCodeSnippet) Setter for pythonCodeSnippet.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
pythonCodeSnippet
public abstract ReinforcementTuningCodeExecutionRewardScorer.Builder pythonCodeSnippet(String pythonCodeSnippet) Setter for pythonCodeSnippet.pythonCodeSnippet: The python code snippet as a string for evaluating rewards. The following is an example python code snippet that returns a reward `1.0` for a parsed response matching the user-provided reference answer in per prompt references map. ``` 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 ``` Note: Reward output by the evaluate function is clipped to be within `[-1, 1]`, i.e., `reward = max(min(reward, 1.0), -1.0)`.
-
clearPythonCodeSnippet
@CanIgnoreReturnValue public ReinforcementTuningCodeExecutionRewardScorer.Builder clearPythonCodeSnippet()Clears the value of pythonCodeSnippet field. -
build
-