Class ReinforcementTuningStringMatchRewardScorerStringMatchExpression

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

public abstract class ReinforcementTuningStringMatchRewardScorerStringMatchExpression extends JsonSerializable
Evaluates parsed response using match type against the expression. Returns `true` if `MatchOperation(target, expression)` evaluates to `true`, and `false` otherwise. This data type is not supported in Gemini API.
  • Constructor Details

    • ReinforcementTuningStringMatchRewardScorerStringMatchExpression

      public ReinforcementTuningStringMatchRewardScorerStringMatchExpression()
  • Method Details

    • matchOperation

      public abstract Optional<MatchOperation> matchOperation()
      Match operation to use for evaluating rewards.
    • expression

      public abstract Optional<String> expression()
      A string or a regular expression to match against for evaluating rewards. Users can also provide a references map of `{key: value}` whose `value` will be used to replace the placeholder {{references.key}} in the expression. For example, if the following `references` are defined in the training / validation dataset: ``` { "systemInstruction": ..., "contents": ..., "references": { "concise_answer": "Yes", "verbose_answer": "The answer is Yes" } } ``` and if users define the following StringMatchExpression: { "matchOperation": "REGEX_CONTAINS", "expression": ".*{{references.concise_answer}}.*" } On evaluating the reward for each sample response, this StringMatchExpression will be substituted as: ``` { "matchOperation": "REGEX_CONTAINS", "expression": ".*Yes.*" } ```
    • builder

      Instantiates a builder for ReinforcementTuningStringMatchRewardScorerStringMatchExpression.
    • toBuilder

      Creates a builder with the same values as this instance.
    • fromJson

      Deserializes a JSON string to a ReinforcementTuningStringMatchRewardScorerStringMatchExpression object.