SafetySetting

@Serializable
data class SafetySetting(val category: HarmCategory? = null, val method: HarmBlockMethod? = null, val threshold: HarmBlockThreshold? = null)

A safety setting that affects the safety-blocking behavior. A SafetySetting consists of a harm category and a threshold for that category.

Constructors

Link copied to clipboard
constructor(category: HarmCategory? = null, method: HarmBlockMethod? = null, threshold: HarmBlockThreshold? = null)

Properties

Link copied to clipboard
val category: HarmCategory? = null

Required. The harm category to be blocked.

Link copied to clipboard
val method: HarmBlockMethod? = null

Optional. The method for blocking content. If not specified, the default behavior is to use the probability score. This field is not supported in Gemini API.

Link copied to clipboard

Required. The threshold for blocking content. If the harm probability exceeds this threshold, the content will be blocked.