Package com.google.genai.types
Class SafetyRating
java.lang.Object
com.google.genai.JsonSerializable
com.google.genai.types.SafetyRating
A safety rating for a piece of content. The safety rating contains the harm category and the harm
probability level.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class com.google.genai.JsonSerializable
MAX_READ_LENGTH_PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionblocked()Output only.static SafetyRating.Builderbuilder()Instantiates a builder for SafetyRating.abstract Optional<HarmCategory>category()Output only.static SafetyRatingDeserializes a JSON string to a SafetyRating object.abstract Optional<HarmBlockThreshold>Output only.abstract Optional<HarmProbability>Output only.Output only.abstract Optional<HarmSeverity>severity()Output only.Output only.abstract SafetyRating.BuilderCreates a builder with the same values as this instance.Methods inherited from class com.google.genai.JsonSerializable
fromJsonNode, fromJsonString, objectMapper, setMaxReadLength, stringToJsonNode, toJson, toJsonNode, toJsonString
-
Constructor Details
-
SafetyRating
public SafetyRating()
-
-
Method Details
-
blocked
Output only. Indicates whether the content was blocked because of this rating. -
category
Output only. The harm category of this rating. -
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. This field is not supported in Gemini API. -
probability
Output only. The probability of harm for this category. -
probabilityScore
Output only. The probability score of harm for this category. This field is not supported in Gemini API. -
severity
Output only. The severity of harm for this category. This field is not supported in Gemini API. -
severityScore
Output only. The severity score of harm for this category. This field is not supported in Gemini API. -
builder
Instantiates a builder for SafetyRating. -
toBuilder
Creates a builder with the same values as this instance. -
fromJson
Deserializes a JSON string to a SafetyRating object.
-