@@ -90,18 +90,41 @@ public struct SafetyRating: Equatable, Hashable, Sendable {
9090@available ( iOS 15 . 0 , macOS 11 . 0 , macCatalyst 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
9191public struct SafetySetting {
9292 /// Block at and beyond a specified ``SafetyRating/HarmProbability``.
93- public enum HarmBlockThreshold : String , Sendable {
94- // Content with `.negligible` will be allowed.
95- case blockLowAndAbove = " BLOCK_LOW_AND_ABOVE "
93+ public struct HarmBlockThreshold : EncodableProtoEnum , Sendable {
94+ enum Kind : String {
95+ case blockLowAndAbove = " BLOCK_LOW_AND_ABOVE "
96+ case blockMediumAndAbove = " BLOCK_MEDIUM_AND_ABOVE "
97+ case blockOnlyHigh = " BLOCK_ONLY_HIGH "
98+ case blockNone = " BLOCK_NONE "
99+ case off = " OFF "
100+ }
101+
102+ /// Content with `.negligible` will be allowed.
103+ public static var blockLowAndAbove : HarmBlockThreshold {
104+ return self . init ( kind: . blockLowAndAbove)
105+ }
96106
97107 /// Content with `.negligible` and `.low` will be allowed.
98- case blockMediumAndAbove = " BLOCK_MEDIUM_AND_ABOVE "
108+ public static var blockMediumAndAbove : HarmBlockThreshold {
109+ return self . init ( kind: . blockMediumAndAbove)
110+ }
99111
100112 /// Content with `.negligible`, `.low`, and `.medium` will be allowed.
101- case blockOnlyHigh = " BLOCK_ONLY_HIGH "
113+ public static var blockOnlyHigh : HarmBlockThreshold {
114+ return self . init ( kind: . blockOnlyHigh)
115+ }
102116
103117 /// All content will be allowed.
104- case blockNone = " BLOCK_NONE "
118+ public static var blockNone : HarmBlockThreshold {
119+ return self . init ( kind: . blockNone)
120+ }
121+
122+ /// Turn off the safety filter.
123+ public static var off : HarmBlockThreshold {
124+ return self . init ( kind: . off)
125+ }
126+
127+ let rawValue : String
105128 }
106129
107130 enum CodingKeys : String , CodingKey {
0 commit comments