From dd239598c673feace38c5e858f60675ac142365e Mon Sep 17 00:00:00 2001 From: David Motsonashvili Date: Thu, 17 Oct 2024 07:29:05 -0700 Subject: [PATCH] make SafetySettings#method nullable (#6379) Co-authored-by: David Motsonashvili Co-authored-by: Rodrigo Lazo --- firebase-vertexai/CHANGELOG.md | 1 + .../google/firebase/vertexai/internal/util/conversions.kt | 2 +- .../com/google/firebase/vertexai/type/SafetySetting.kt | 5 +++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/firebase-vertexai/CHANGELOG.md b/firebase-vertexai/CHANGELOG.md index 6a9a7c8b170..1a485a30688 100644 --- a/firebase-vertexai/CHANGELOG.md +++ b/firebase-vertexai/CHANGELOG.md @@ -18,6 +18,7 @@ * [changed] **Breaking Change**: Replaced sealed classes with abstract classes for `StringFormat`. (#6334) * [changed] **Breaking Change**: Refactored enum classes to be normal classes. (#6340) * [changed] **Breaking Change**: Marked `GenerativeModel` properties as private. (#6309) +* [changed] **Breaking Change**: Changed `method` parameter type to be nullable in `SafetySettings`. (#6379) # 16.0.0-beta05 diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/internal/util/conversions.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/internal/util/conversions.kt index 793aeeae659..80542eebe85 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/internal/util/conversions.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/internal/util/conversions.kt @@ -100,7 +100,7 @@ internal fun SafetySetting.toInternal() = com.google.firebase.vertexai.common.shared.SafetySetting( harmCategory.toInternal(), threshold.toInternal(), - method.toInternal() + method?.toInternal() ) internal fun makeMissingCaseException(source: String, ordinal: Int): SerializationException { diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/SafetySetting.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/SafetySetting.kt index 752353f8e4f..68d7f93aa99 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/SafetySetting.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/SafetySetting.kt @@ -22,10 +22,11 @@ package com.google.firebase.vertexai.type * * @param harmCategory The relevant [HarmCategory]. * @param threshold The threshold form harm allowable. - * @param method Specify if the threshold is used for probability or severity score. + * @param method Specify if the threshold is used for probability or severity score, if not + * specified it will default to [HarmBlockMethod.PROBABILITY]. */ public class SafetySetting( internal val harmCategory: HarmCategory, internal val threshold: HarmBlockThreshold, - internal val method: HarmBlockMethod = HarmBlockMethod.PROBABILITY + internal val method: HarmBlockMethod? = null, )