SafetySpec

Safety specification. There are two use cases: 1. when only safetySpec.enable is set, the BLOCK_LOW_AND_ABOVE threshold will be applied for all categories. 2. when safetySpec.enable is set and some safetySettings are set, only specified safetySettings are applied.

JSON representation
{
  "enable": boolean,
  "safetySettings": [
    {
      object (SafetySetting)
    }
  ]
}
Fields
enable

boolean

Enable the safety filtering on the answer response. It is false by default.

safetySettings[]

object (SafetySetting)

Optional. Safety settings. This settings are effective only when the safetySpec.enable is true.

SafetySetting

Safety settings.

JSON representation
{
  "category": enum (HarmCategory),
  "threshold": enum (HarmBlockThreshold)
}
Fields
category

enum (HarmCategory)

Required. Harm category.

threshold

enum (HarmBlockThreshold)

Required. The harm block threshold.

HarmBlockThreshold

probability based thresholds levels for blocking.

Enums
HARM_BLOCK_THRESHOLD_UNSPECIFIED Unspecified harm block threshold.
BLOCK_LOW_AND_ABOVE Block low threshold and above (i.e. block more).
BLOCK_MEDIUM_AND_ABOVE Block medium threshold and above.
BLOCK_ONLY_HIGH Block only high threshold (i.e. block less).
BLOCK_NONE Block none.
OFF Turn off the safety filter.