google_ai_rs/proto/
safety_setting.rs

1/// Block at and beyond a specified harm probability.
2#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
3#[repr(i32)]
4pub enum HarmBlockThreshold {
5    /// Threshold is unspecified.
6    Unspecified = 0,
7    /// Content with NEGLIGIBLE will be allowed.
8    BlockLowAndAbove = 1,
9    /// Content with NEGLIGIBLE and LOW will be allowed.
10    BlockMediumAndAbove = 2,
11    /// Content with NEGLIGIBLE, LOW, and MEDIUM will be allowed.
12    BlockOnlyHigh = 3,
13    /// All content will be allowed.
14    BlockNone = 4,
15    /// Turn off the safety filter.
16    Off = 5,
17}
18impl HarmBlockThreshold {
19    /// String value of the enum field names used in the ProtoBuf definition.
20    ///
21    /// The values are not transformed in any way and thus are considered stable
22    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
23    pub fn as_str_name(&self) -> &'static str {
24        match self {
25            Self::Unspecified => "HARM_BLOCK_THRESHOLD_UNSPECIFIED",
26            Self::BlockLowAndAbove => "BLOCK_LOW_AND_ABOVE",
27            Self::BlockMediumAndAbove => "BLOCK_MEDIUM_AND_ABOVE",
28            Self::BlockOnlyHigh => "BLOCK_ONLY_HIGH",
29            Self::BlockNone => "BLOCK_NONE",
30            Self::Off => "OFF",
31        }
32    }
33    /// Creates an enum from field names used in the ProtoBuf definition.
34    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
35        match value {
36            "HARM_BLOCK_THRESHOLD_UNSPECIFIED" => Some(Self::Unspecified),
37            "BLOCK_LOW_AND_ABOVE" => Some(Self::BlockLowAndAbove),
38            "BLOCK_MEDIUM_AND_ABOVE" => Some(Self::BlockMediumAndAbove),
39            "BLOCK_ONLY_HIGH" => Some(Self::BlockOnlyHigh),
40            "BLOCK_NONE" => Some(Self::BlockNone),
41            "OFF" => Some(Self::Off),
42            _ => None,
43        }
44    }
45}