Class SafetyRating
-
- All Implemented Interfaces:
public abstract class SafetyRating extends JsonSerializable
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 Modifier and Type Class Description public abstract classSafetyRating.BuilderBuilder for SafetyRating.
-
Field Summary
Fields Modifier and Type Field Description public final static StringMAX_READ_LENGTH_PROPERTY
-
Constructor Summary
Constructors Constructor Description SafetyRating()
-
Method Summary
Modifier and Type Method Description abstract Optional<Boolean>blocked()Output only. abstract Optional<HarmCategory>category()Output only. abstract Optional<HarmBlockThreshold>overwrittenThreshold()Output only. abstract Optional<HarmProbability>probability()Output only. abstract Optional<Float>probabilityScore()Output only. abstract Optional<HarmSeverity>severity()Output only. abstract Optional<Float>severityScore()Output only. static SafetyRating.Builderbuilder()Instantiates a builder for SafetyRating. abstract SafetyRating.BuildertoBuilder()Creates a builder with the same values as this instance. static SafetyRatingfromJson(String jsonString)Deserializes a JSON string to a SafetyRating object. -
Methods inherited from class com.google.genai.JsonSerializable
fromJsonNode, fromJsonString, objectMapper, setMaxReadLength, stringToJsonNode, toJson, toJsonNode, toJsonString -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
blocked
abstract Optional<Boolean> blocked()
Output only. Indicates whether the content was blocked because of this rating.
-
category
abstract Optional<HarmCategory> category()
Output only. The harm category of this rating.
-
overwrittenThreshold
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. This field is not supported in Gemini API.
-
probability
abstract Optional<HarmProbability> probability()
Output only. The probability of harm for this category.
-
probabilityScore
abstract Optional<Float> probabilityScore()
Output only. The probability score of harm for this category. This field is not supported in Gemini API.
-
severity
abstract Optional<HarmSeverity> severity()
Output only. The severity of harm for this category. This field is not supported in Gemini API.
-
severityScore
abstract Optional<Float> severityScore()
Output only. The severity score of harm for this category. This field is not supported in Gemini API.
-
builder
static SafetyRating.Builder builder()
Instantiates a builder for SafetyRating.
-
toBuilder
abstract SafetyRating.Builder toBuilder()
Creates a builder with the same values as this instance.
-
fromJson
static SafetyRating fromJson(String jsonString)
Deserializes a JSON string to a SafetyRating object.
-
-
-
-