Skip to content

Commit c282b6c

Browse files
authored
[Vertex AI] Cleanup Decodable impl from BlockThreshold (#13673)
1 parent 18c90b8 commit c282b6c

File tree

1 file changed

+1
-19
lines changed

1 file changed

+1
-19
lines changed

FirebaseVertexAI/Sources/Safety.swift

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,6 @@ public struct SafetySetting {
8787

8888
/// Block at and beyond a specified ``SafetyRating/HarmProbability``.
8989
public enum BlockThreshold: String, Sendable {
90-
/// Unknown. A new server value that isn't recognized by the SDK.
91-
case unknown = "UNKNOWN"
92-
93-
/// Threshold is unspecified.
94-
case unspecified = "HARM_BLOCK_THRESHOLD_UNSPECIFIED"
95-
9690
// Content with `.negligible` will be allowed.
9791
case blockLowAndAbove = "BLOCK_LOW_AND_ABOVE"
9892

@@ -160,19 +154,7 @@ extension SafetySetting.HarmCategory: Codable {
160154
}
161155

162156
@available(iOS 15.0, macOS 11.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
163-
extension SafetySetting.BlockThreshold: Encodable {
164-
public init(from decoder: Decoder) throws {
165-
let value = try decoder.singleValueContainer().decode(String.self)
166-
guard let decodedThreshold = SafetySetting.BlockThreshold(rawValue: value) else {
167-
Logging.default
168-
.error("[FirebaseVertexAI] Unrecognized BlockThreshold with value \"\(value)\".")
169-
self = .unknown
170-
return
171-
}
172-
173-
self = decodedThreshold
174-
}
175-
}
157+
extension SafetySetting.BlockThreshold: Encodable {}
176158

177159
@available(iOS 15.0, macOS 11.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
178160
extension SafetySetting: Encodable {}

0 commit comments

Comments
 (0)