Skip to content

Commit 9e89b28

Browse files
authored
Add support for HarmBlockThreshold.OFF (#6843)
Per [b/409040155](https://b.corp.google.com/issues/409040155), This adds support for `HarmBlockThreshold.OFF`, and also adds javadocs that clearly articulate the difference it holds from `NONE`.
1 parent 5081e7c commit 9e89b28

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

firebase-vertexai/CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Unreleased
2-
2+
* [feature] Added support for `HarmBlockThreshold.OFF`. See the
3+
[model documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/configure-safety-filters#how_to_configure_content_filters){: .external}
4+
for more information.
35

46
# 16.3.0
57
* [feature] Emits a warning when attempting to use an incompatible model with

firebase-vertexai/api.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@ package com.google.firebase.vertexai.type {
384384
field public static final com.google.firebase.vertexai.type.HarmBlockThreshold LOW_AND_ABOVE;
385385
field public static final com.google.firebase.vertexai.type.HarmBlockThreshold MEDIUM_AND_ABOVE;
386386
field public static final com.google.firebase.vertexai.type.HarmBlockThreshold NONE;
387+
field public static final com.google.firebase.vertexai.type.HarmBlockThreshold OFF;
387388
field public static final com.google.firebase.vertexai.type.HarmBlockThreshold ONLY_HIGH;
388389
}
389390

firebase-vertexai/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
version=16.3.1
15+
version=16.4.0
1616
latestReleasedVersion=16.3.0

firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/HarmBlockThreshold.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public class HarmBlockThreshold private constructor(public val ordinal: Int) {
2525

2626
internal fun toInternal() =
2727
when (this) {
28+
OFF -> Internal.OFF
2829
NONE -> Internal.BLOCK_NONE
2930
ONLY_HIGH -> Internal.BLOCK_ONLY_HIGH
3031
MEDIUM_AND_ABOVE -> Internal.BLOCK_MEDIUM_AND_ABOVE
@@ -39,6 +40,7 @@ public class HarmBlockThreshold private constructor(public val ordinal: Int) {
3940
BLOCK_MEDIUM_AND_ABOVE,
4041
BLOCK_ONLY_HIGH,
4142
BLOCK_NONE,
43+
OFF
4244
}
4345

4446
public companion object {
@@ -53,5 +55,13 @@ public class HarmBlockThreshold private constructor(public val ordinal: Int) {
5355

5456
/** All content is allowed regardless of harm. */
5557
@JvmField public val NONE: HarmBlockThreshold = HarmBlockThreshold(3)
58+
59+
/**
60+
* All content is allowed regardless of harm.
61+
*
62+
* The same as [NONE], but metadata when the corresponding [HarmCategory] occurs will **NOT** be
63+
* present in the response.
64+
*/
65+
@JvmField public val OFF: HarmBlockThreshold = HarmBlockThreshold(4)
5666
}
5767
}

0 commit comments

Comments
 (0)