Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions firebase-vertexai/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Unreleased
* [changed] Breaking Change: refactored enum classes to be normal classes (#6340).


# 16.0.0-beta05
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,24 @@ internal constructor(
)

/** The reason for content finishing. */
public enum class FinishReason {
/** A new and not yet supported value. */
UNKNOWN,
public class FinishReason private constructor(public val ordinal: Int) {
public companion object {
/** A new and not yet supported value. */
@JvmField public val UNKNOWN: FinishReason = FinishReason(0)

/** Model finished successfully and stopped. */
STOP,
/** Model finished successfully and stopped. */
@JvmField public val STOP: FinishReason = FinishReason(1)

/** Model hit the token limit. */
MAX_TOKENS,
/** Model hit the token limit. */
@JvmField public val MAX_TOKENS: FinishReason = FinishReason(2)

/** [SafetySetting] prevented the model from outputting content. */
SAFETY,
/** [SafetySetting] prevented the model from outputting content. */
@JvmField public val SAFETY: FinishReason = FinishReason(3)

/** Model began looping. */
RECITATION,
/** Model began looping. */
@JvmField public val RECITATION: FinishReason = FinishReason(4)

/** Model stopped for another reason. */
OTHER
/** Model stopped for another reason. */
@JvmField public val OTHER: FinishReason = FinishReason(5)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ package com.google.firebase.vertexai.type
* Specifies how the block method computes the score that will be compared against the
* [HarmBlockThreshold] in [SafetySetting].
*/
public enum class HarmBlockMethod {
/**
* The harm block method uses both probability and severity scores. See [HarmSeverity] and
* [HarmProbability].
*/
SEVERITY,
/** The harm block method uses the probability score. See [HarmProbability]. */
PROBABILITY,
public class HarmBlockMethod private constructor(public val ordinal: Int) {
public companion object {
/**
* The harm block method uses both probability and severity scores. See [HarmSeverity] and
* [HarmProbability].
*/
@JvmField public val SEVERITY: HarmBlockMethod = HarmBlockMethod(0)

/** The harm block method uses the probability score. See [HarmProbability]. */
@JvmField public val PROBABILITY: HarmBlockMethod = HarmBlockMethod(1)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,18 @@
package com.google.firebase.vertexai.type

/** Represents the threshold for a [HarmCategory] to be allowed by [SafetySetting]. */
public enum class HarmBlockThreshold {
/** Content with negligible harm is allowed. */
LOW_AND_ABOVE,
public class HarmBlockThreshold private constructor(public val ordinal: Int) {
public companion object {
/** Content with negligible harm is allowed. */
@JvmField public val LOW_AND_ABOVE: HarmBlockThreshold = HarmBlockThreshold(0)

/** Content with negligible to low harm is allowed. */
MEDIUM_AND_ABOVE,
/** Content with negligible to low harm is allowed. */
@JvmField public val MEDIUM_AND_ABOVE: HarmBlockThreshold = HarmBlockThreshold(1)

/** Content with negligible to medium harm is allowed. */
ONLY_HIGH,
/** Content with negligible to medium harm is allowed. */
@JvmField public val ONLY_HIGH: HarmBlockThreshold = HarmBlockThreshold(2)

/** All content is allowed regardless of harm. */
NONE
/** All content is allowed regardless of harm. */
@JvmField public val NONE: HarmBlockThreshold = HarmBlockThreshold(3)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,21 @@
package com.google.firebase.vertexai.type

/** Category for a given harm rating. */
public enum class HarmCategory {
/** A new and not yet supported value. */
UNKNOWN,
public class HarmCategory private constructor(public val ordinal: Int) {
public companion object {
/** A new and not yet supported value. */
@JvmField public val UNKNOWN: HarmCategory = HarmCategory(0)

/** Harassment content. */
HARASSMENT,
/** Harassment content. */
@JvmField public val HARASSMENT: HarmCategory = HarmCategory(1)

/** Hate speech and content. */
HATE_SPEECH,
/** Hate speech and content. */
@JvmField public val HATE_SPEECH: HarmCategory = HarmCategory(2)

/** Sexually explicit content. */
SEXUALLY_EXPLICIT,
/** Sexually explicit content. */
@JvmField public val SEXUALLY_EXPLICIT: HarmCategory = HarmCategory(3)

/** Dangerous content. */
DANGEROUS_CONTENT
/** Dangerous content. */
@JvmField public val DANGEROUS_CONTENT: HarmCategory = HarmCategory(4)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,21 @@
package com.google.firebase.vertexai.type

/** Represents the probability that some [HarmCategory] is applicable in a [SafetyRating]. */
public enum class HarmProbability {
/** A new and not yet supported value. */
UNKNOWN,
public class HarmProbability private constructor(public val ordinal: Int) {
public companion object {
/** A new and not yet supported value. */
@JvmField public val UNKNOWN: HarmProbability = HarmProbability(0)

/** Probability for harm is negligible. */
NEGLIGIBLE,
/** Probability for harm is negligible. */
@JvmField public val NEGLIGIBLE: HarmProbability = HarmProbability(1)

/** Probability for harm is low. */
LOW,
/** Probability for harm is low. */
@JvmField public val LOW: HarmProbability = HarmProbability(2)

/** Probability for harm is medium. */
MEDIUM,
/** Probability for harm is medium. */
@JvmField public val MEDIUM: HarmProbability = HarmProbability(3)

/** Probability for harm is high. */
HIGH,
/** Probability for harm is high. */
@JvmField public val HIGH: HarmProbability = HarmProbability(4)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,21 @@
package com.google.firebase.vertexai.type

/** Represents the severity of a [HarmCategory] being applicable in a [SafetyRating]. */
public enum class HarmSeverity {
/** A new and not yet supported value. */
UNKNOWN,
public class HarmSeverity private constructor(public val ordinal: Int) {
public companion object {
/** A new and not yet supported value. */
@JvmField public val UNKNOWN: HarmSeverity = HarmSeverity(0)

/** Severity for harm is negligible. */
NEGLIGIBLE,
/** Severity for harm is negligible. */
@JvmField public val NEGLIGIBLE: HarmSeverity = HarmSeverity(1)

/** Low level of harm severity. */
LOW,
/** Low level of harm severity. */
@JvmField public val LOW: HarmSeverity = HarmSeverity(2)

/** Medium level of harm severity. */
MEDIUM,
/** Medium level of harm severity. */
@JvmField public val MEDIUM: HarmSeverity = HarmSeverity(3)

/** High level of harm severity. */
HIGH,
/** High level of harm severity. */
@JvmField public val HIGH: HarmSeverity = HarmSeverity(4)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ public class PromptFeedback(
)

/** Describes why content was blocked. */
public enum class BlockReason {
/** A new and not yet supported value. */
UNKNOWN,
public class BlockReason private constructor(public val ordinal: Int) {
public companion object {
/** A new and not yet supported value. */
@JvmField public val UNKNOWN: BlockReason = BlockReason(0)

/** Content was blocked for violating provided [SafetySetting]. */
SAFETY,
/** Content was blocked for violating provided [SafetySetting]. */
@JvmField public val SAFETY: BlockReason = BlockReason(1)

/** Content was blocked for another reason. */
OTHER
/** Content was blocked for another reason. */
@JvmField public val OTHER: BlockReason = BlockReason(2)
}
}
Loading