Skip to content

Commit 6f3645c

Browse files
committed
Throw exception instead of using assert
1 parent 0fa258b commit 6f3645c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ThinkingConfig.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ private constructor(
5353
* depends on the model.
5454
*/
5555
public fun setThinkingBudget(thinkingBudget: Int): Builder = apply {
56-
assert(thinkingLevel == null) { "Cannot set both `thinkingBudget` and `thinkingLevel`" }
56+
if (thinkingLevel != null)
57+
throw IllegalArgumentException("Cannot set both `thinkingBudget` and `thinkingLevel`")
5758
this.thinkingBudget = thinkingBudget
5859
}
5960

@@ -71,7 +72,8 @@ private constructor(
7172

7273
/** Indicates the thinking budget based in Levels. */
7374
public fun setThinkingLevel(thinkingLevel: ThinkingLevel): Builder = apply {
74-
assert(thinkingBudget == null) { "Cannot set both `thinkingBudget` and `thinkingLevel`" }
75+
if (thinkingBudget != null)
76+
throw IllegalArgumentException("Cannot set both `thinkingBudget` and `thinkingLevel`")
7577
this.thinkingLevel = thinkingLevel
7678
}
7779

0 commit comments

Comments
 (0)