Class SafetyRating

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

public abstract class SafetyRating extends JsonSerializable
Safety rating corresponding to the generated content.
  • Constructor Details

    • SafetyRating

      public SafetyRating()
  • Method Details

    • blocked

      public abstract Optional<Boolean> blocked()
      Output only. Indicates whether the content was filtered out because of this rating.
    • category

      public abstract Optional<HarmCategory> category()
      Output only. Harm category.
    • overwrittenThreshold

      public abstract Optional<HarmBlockThreshold> overwrittenThreshold()
      Output only. The overwritten threshold for the safety category of Gemini 2.0 image out. If minors are detected in the output image, the threshold of each safety category will be overwritten if user sets a lower threshold.
    • probability

      public abstract Optional<HarmProbability> probability()
      Output only. Harm probability levels in the content.
    • probabilityScore

      public abstract Optional<Float> probabilityScore()
      Output only. Harm probability score.
    • severity

      public abstract Optional<HarmSeverity> severity()
      Output only. Harm severity levels in the content.
    • severityScore

      public abstract Optional<Float> severityScore()
      Output only. Harm severity score.
    • builder

      public static SafetyRating.Builder builder()
      Instantiates a builder for SafetyRating.
    • toBuilder

      public abstract SafetyRating.Builder toBuilder()
      Creates a builder with the same values as this instance.
    • fromJson

      public static SafetyRating fromJson(String jsonString)
      Deserializes a JSON string to a SafetyRating object.