Interface SafetySetting

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

interface SafetySetting {
    category?: HarmCategory;
    method?: HarmBlockMethod;
    threshold?: HarmBlockThreshold;
}

Properties

category?: HarmCategory

Required. The harm category to be blocked.

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.

threshold?: HarmBlockThreshold

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