Skip to content

Commit 28a227a

Browse files
authored
Add missing category to HarmCategory (#6502)
1 parent 4e2dcd0 commit 28a227a

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

firebase-vertexai/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Unreleased
2+
* [changed] Added support for Civic Integrity in Harm Category. (#6502)
23
* [fixed] Improved error message when using an invalid location. (#6428)
34
* [fixed] Fixed issue where Firebase App Check error tokens were unintentionally missing from the requests. (#6409)
45
* [fixed] Clarified in the documentation that `Schema.integer` and `Schema.float` only provide hints to the model. (#6420)

firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/common/shared/Types.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ internal enum class HarmCategory {
3838
@SerialName("HARM_CATEGORY_HARASSMENT") HARASSMENT,
3939
@SerialName("HARM_CATEGORY_HATE_SPEECH") HATE_SPEECH,
4040
@SerialName("HARM_CATEGORY_SEXUALLY_EXPLICIT") SEXUALLY_EXPLICIT,
41-
@SerialName("HARM_CATEGORY_DANGEROUS_CONTENT") DANGEROUS_CONTENT
41+
@SerialName("HARM_CATEGORY_DANGEROUS_CONTENT") DANGEROUS_CONTENT,
42+
@SerialName("HARM_CATEGORY_CIVIC_INTEGRITY") CIVIC_INTEGRITY,
4243
}
4344

4445
internal typealias Base64 = String

firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/internal/util/conversions.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ internal fun HarmCategory.toInternal() =
137137
com.google.firebase.vertexai.common.shared.HarmCategory.SEXUALLY_EXPLICIT
138138
HarmCategory.DANGEROUS_CONTENT ->
139139
com.google.firebase.vertexai.common.shared.HarmCategory.DANGEROUS_CONTENT
140+
HarmCategory.CIVIC_INTEGRITY ->
141+
com.google.firebase.vertexai.common.shared.HarmCategory.CIVIC_INTEGRITY
140142
HarmCategory.UNKNOWN -> com.google.firebase.vertexai.common.shared.HarmCategory.UNKNOWN
141143
else -> throw makeMissingCaseException("HarmCategory", ordinal)
142144
}
@@ -315,6 +317,8 @@ internal fun com.google.firebase.vertexai.common.shared.HarmCategory.toPublic()
315317
HarmCategory.SEXUALLY_EXPLICIT
316318
com.google.firebase.vertexai.common.shared.HarmCategory.DANGEROUS_CONTENT ->
317319
HarmCategory.DANGEROUS_CONTENT
320+
com.google.firebase.vertexai.common.shared.HarmCategory.CIVIC_INTEGRITY ->
321+
HarmCategory.CIVIC_INTEGRITY
318322
else -> HarmCategory.UNKNOWN
319323
}
320324

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,8 @@ public class HarmCategory private constructor(public val ordinal: Int) {
3333

3434
/** Dangerous content. */
3535
@JvmField public val DANGEROUS_CONTENT: HarmCategory = HarmCategory(4)
36+
37+
/** Content that may be used to harm civic integrity. */
38+
@JvmField public val CIVIC_INTEGRITY: HarmCategory = HarmCategory(5)
3639
}
3740
}

0 commit comments

Comments
 (0)