Skip to content

Commit 9b9b799

Browse files
committed
Fix format and add tests
1 parent cf122c1 commit 9b9b799

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ private constructor(
4747
this.includeThoughts = includeThoughts
4848
}
4949

50-
public fun build(): ThinkingConfig = ThinkingConfig(thinkingBudget = thinkingBudget)
50+
public fun build(): ThinkingConfig =
51+
ThinkingConfig(thinkingBudget = thinkingBudget, includeThoughts = includeThoughts)
5152
}
5253

5354
internal fun toInternal() = Internal(thinkingBudget, includeThoughts)

firebase-ai/src/test/java/com/google/firebase/ai/type/ThinkingConfigTest.kt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,21 @@ internal class ThinkingConfigTest {
3939
Json.encodeToString(thinkingConfig.toInternal()).shouldEqualJson(expectedJson)
4040
}
4141

42+
@Test
43+
fun `Include though thinkingConfig`() {
44+
val thinkingConfig = ThinkingConfig.Builder().setIncludeThoughts(true).build()
45+
// CamelCase or snake_case work equally fine
46+
val expectedJson =
47+
"""
48+
{
49+
"includeThoughts": true
50+
}
51+
"""
52+
.trimIndent()
53+
54+
Json.encodeToString(thinkingConfig.toInternal()).shouldEqualJson(expectedJson)
55+
}
56+
4257
@Test
4358
fun `thinkingConfig DSL correctly delegates to ThinkingConfig#Builder`() {
4459
val thinkingConfig = ThinkingConfig.Builder().setThinkingBudget(1024).build()

0 commit comments

Comments
 (0)