Skip to content

Commit 18c90b8

Browse files
authored
[Vertex AI] Remove SafetyFeedback struct (#13666)
1 parent 602f3e7 commit 18c90b8

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

FirebaseVertexAI/Sources/Safety.swift

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -59,22 +59,6 @@ public struct SafetyRating: Equatable, Hashable, Sendable {
5959
}
6060
}
6161

62-
/// Safety feedback for an entire request.
63-
@available(iOS 15.0, macOS 11.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
64-
public struct SafetyFeedback {
65-
/// Safety rating evaluated from content.
66-
public let rating: SafetyRating
67-
68-
/// Safety settings applied to the request.
69-
public let setting: SafetySetting
70-
71-
/// Internal initializer.
72-
init(rating: SafetyRating, setting: SafetySetting) {
73-
self.rating = rating
74-
self.setting = setting
75-
}
76-
}
77-
7862
/// A type used to specify a threshold for harmful content, beyond which the model will return a
7963
/// fallback response instead of generated content.
8064
@available(iOS 15.0, macOS 11.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
@@ -143,7 +127,7 @@ public struct SafetySetting {
143127
// MARK: - Codable Conformances
144128

145129
@available(iOS 15.0, macOS 11.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
146-
extension SafetyRating.HarmProbability: Codable {
130+
extension SafetyRating.HarmProbability: Decodable {
147131
public init(from decoder: Decoder) throws {
148132
let value = try decoder.singleValueContainer().decode(String.self)
149133
guard let decodedProbability = SafetyRating.HarmProbability(rawValue: value) else {
@@ -160,9 +144,6 @@ extension SafetyRating.HarmProbability: Codable {
160144
@available(iOS 15.0, macOS 11.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
161145
extension SafetyRating: Decodable {}
162146

163-
@available(iOS 15.0, macOS 11.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
164-
extension SafetyFeedback: Decodable {}
165-
166147
@available(iOS 15.0, macOS 11.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
167148
extension SafetySetting.HarmCategory: Codable {
168149
public init(from decoder: Decoder) throws {
@@ -179,7 +160,7 @@ extension SafetySetting.HarmCategory: Codable {
179160
}
180161

181162
@available(iOS 15.0, macOS 11.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
182-
extension SafetySetting.BlockThreshold: Codable {
163+
extension SafetySetting.BlockThreshold: Encodable {
183164
public init(from decoder: Decoder) throws {
184165
let value = try decoder.singleValueContainer().decode(String.self)
185166
guard let decodedThreshold = SafetySetting.BlockThreshold(rawValue: value) else {
@@ -194,4 +175,4 @@ extension SafetySetting.BlockThreshold: Codable {
194175
}
195176

196177
@available(iOS 15.0, macOS 11.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
197-
extension SafetySetting: Codable {}
178+
extension SafetySetting: Encodable {}

0 commit comments

Comments
 (0)