Skip to content

Commit a131daa

Browse files
committed
Add documentation
1 parent 411fceb commit a131daa

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

FirebaseVertexAI/Sources/Safety.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,10 @@ public struct SafetySetting {
180180
case probability = "PROBABILITY"
181181
}
182182

183+
/// Use both probability and severity scores.
183184
public static let severity = HarmBlockMethod(kind: .severity)
184185

186+
/// Use only the probability score.
185187
public static let probability = HarmBlockMethod(kind: .probability)
186188

187189
let rawValue: String
@@ -199,9 +201,20 @@ public struct SafetySetting {
199201
/// The threshold describing what content should be blocked.
200202
public let threshold: HarmBlockThreshold
201203

204+
/// The method of computing whether the ``threshold`` has been exceeded.
202205
public let method: HarmBlockMethod?
203206

204207
/// Initializes a new safety setting with the given category and threshold.
208+
///
209+
/// - Parameters:
210+
/// - harmCategory: The category this safety setting should be applied to.
211+
/// - threshold: The threshold describing what content should be blocked.
212+
/// - method: The method of computing whether the threshold has been exceeded; if not specified,
213+
/// the default method is ``HarmBlockMethod/severity`` for most models. See [harm block
214+
/// methods](https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/configure-safety-filters#how_to_configure_safety_filters)
215+
/// in the Google Cloud documentation for more details.
216+
/// > Note: For models older than `gemini-1.5-flash` and `gemini-1.5-pro`, the default method
217+
/// > is ``HarmBlockMethod/probability``.
205218
public init(harmCategory: HarmCategory, threshold: HarmBlockThreshold,
206219
method: HarmBlockMethod? = nil) {
207220
self.harmCategory = harmCategory

0 commit comments

Comments
 (0)