Skip to content

Commit 34d0912

Browse files
committed
fix formatting and add CHANGELOG entry
1 parent 2428d4c commit 34d0912

File tree

2 files changed

+25
-19
lines changed

2 files changed

+25
-19
lines changed

firebase-ai/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@
2121
* [feature] Added support for the `id` field on `FunctionResponsePart` and `FunctionCallPart`. (#6910)
2222
* [feature] Add support for specifying response modalities in `GenerationConfig`. (#6921)
2323
* [feature] Added a helper field for getting all the `InlineDataPart` from a `GenerateContentResponse`. (#6922)
24+
* [fixed] Fixed an issue that was causing the SDK to send empty `FunctionDeclaration` descriptions to the API.
2425

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

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ internal class FunctionDeclarationTest {
99

1010
@Test
1111
fun `Basic FunctionDeclaration with name, description and parameters`() {
12-
val functionDeclaration = FunctionDeclaration(
13-
name = "isUserAGoat",
14-
description = "Determine if the user is subject to teleportations.",
15-
parameters = mapOf(
16-
"userID" to Schema.string("ID of the User making the call")
12+
val functionDeclaration =
13+
FunctionDeclaration(
14+
name = "isUserAGoat",
15+
description = "Determine if the user is subject to teleportations.",
16+
parameters = mapOf("userID" to Schema.string("ID of the User making the call"))
1717
)
18-
)
1918

20-
val expectedJson = """
19+
val expectedJson =
20+
"""
2121
{
2222
"name": "isUserAGoat",
2323
"description": "Determine if the user is subject to teleportations.",
@@ -34,24 +34,28 @@ internal class FunctionDeclarationTest {
3434
]
3535
}
3636
}
37-
""".trimIndent()
37+
"""
38+
.trimIndent()
3839

3940
Json.encodeToString(functionDeclaration.toInternal()).shouldEqualJson(expectedJson)
4041
}
4142

4243
@Test
4344
fun `FunctionDeclaration with optional parameters`() {
44-
val functionDeclaration = FunctionDeclaration(
45-
name = "isUserAGoat",
46-
description = "Determine if the user is subject to teleportations.",
47-
parameters = mapOf(
48-
"userID" to Schema.string("ID of the user making the call"),
49-
"userName" to Schema.string("Name of the user making the call")
50-
),
51-
optionalParameters = listOf("userName")
52-
)
45+
val functionDeclaration =
46+
FunctionDeclaration(
47+
name = "isUserAGoat",
48+
description = "Determine if the user is subject to teleportations.",
49+
parameters =
50+
mapOf(
51+
"userID" to Schema.string("ID of the user making the call"),
52+
"userName" to Schema.string("Name of the user making the call")
53+
),
54+
optionalParameters = listOf("userName")
55+
)
5356

54-
val expectedJson = """
57+
val expectedJson =
58+
"""
5559
{
5660
"name": "isUserAGoat",
5761
"description": "Determine if the user is subject to teleportations.",
@@ -72,7 +76,8 @@ internal class FunctionDeclarationTest {
7276
]
7377
}
7478
}
75-
""".trimIndent()
79+
"""
80+
.trimIndent()
7681

7782
Json.encodeToString(functionDeclaration.toInternal()).shouldEqualJson(expectedJson)
7883
}

0 commit comments

Comments
 (0)