Package com.google.genai.types
Class ReinforcementTuningStringMatchRewardScorer
java.lang.Object
com.google.genai.JsonSerializable
com.google.genai.types.ReinforcementTuningStringMatchRewardScorer
ReinforcementTuningStringMatchRewardScorer is used to score parsed responses for string matching
use cases. For example, for math problems, users can use string match scorer to check if the
correct exact answer is generated. Note: Reward returned by the string match reward function is
clipped to be within `[-1, 1]` if wrongAnswerReward or correctAnswerReward are beyond the range,
i.e., `reward = max(min(reward, 1.0), -1.0)`. This data type is not supported in Gemini API.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for ReinforcementTuningStringMatchRewardScorer. -
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 ReinforcementTuningStringMatchRewardScorer.Correct answer rewawrd is returned if the parsed response is evaluated as `true`.Deserializes a JSON string to a ReinforcementTuningStringMatchRewardScorer object.Uses json match expression to evaluate parsed response.Uses string match expression to evaluate parsed response.Creates a builder with the same values as this instance.Wrong answer reward is returned if the parsed response is evaluated as `false`.Methods inherited from class com.google.genai.JsonSerializable
fromJsonNode, fromJsonString, objectMapper, setMaxReadLength, stringToJsonNode, toJson, toJsonNode, toJsonString
-
Constructor Details
-
ReinforcementTuningStringMatchRewardScorer
public ReinforcementTuningStringMatchRewardScorer()
-
-
Method Details
-
wrongAnswerReward
Wrong answer reward is returned if the parsed response is evaluated as `false`. All wrong answers get the same reward. -
correctAnswerReward
Correct answer rewawrd is returned if the parsed response is evaluated as `true`. All correct answers get the same reward. -
stringMatchExpression
public abstract Optional<ReinforcementTuningStringMatchRewardScorerStringMatchExpression> stringMatchExpression()Uses string match expression to evaluate parsed response. -
jsonMatchExpression
public abstract Optional<ReinforcementTuningStringMatchRewardScorerJsonMatchExpression> jsonMatchExpression()Uses json match expression to evaluate parsed response. -
builder
Instantiates a builder for ReinforcementTuningStringMatchRewardScorer. -
toBuilder
Creates a builder with the same values as this instance. -
fromJson
Deserializes a JSON string to a ReinforcementTuningStringMatchRewardScorer object.
-