Skip to content

Commit e6f66fd

Browse files
authored
Merge branch 'main' into daymon-sharedpreferences-work
2 parents 4a7cb4a + f08e0c7 commit e6f66fd

File tree

13 files changed

+237
-107
lines changed

13 files changed

+237
-107
lines changed

.github/workflows/sessions-e2e.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: set up JDK 17
2424
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
2525
with:
26-
java-version: '11'
26+
java-version: '17'
2727
distribution: 'temurin'
2828
cache: gradle
2929

@@ -39,4 +39,4 @@ jobs:
3939
env:
4040
FTL_RESULTS_BUCKET: fireescape
4141
run: |
42-
./gradlew :firebase-sessions:test-app:deviceCheck withErrorProne -PtargetBackend="prod" -PtriggerCrashes
42+
./gradlew :firebase-sessions:test-app:deviceCheck withErrorProne -PtargetBackend="prod"

firebase-ai/CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
# Unreleased
22

3+
4+
# 16.1.0
35
* [fixed] Fixed `FirebaseAI.getInstance` StackOverflowException (#6971)
46
* [fixed] Fixed an issue that was causing the SDK to send empty `FunctionDeclaration` descriptions to the API.
57
* [changed] Introduced the `Voice` class, which accepts a voice name, and deprecated the `Voices` class.
68
* [changed] **Breaking Change**: Updated `SpeechConfig` to take in `Voice` class instead of `Voices` class.
79
* **Action Required:** Update all references of `SpeechConfig` initialization to use `Voice` class.
810
* [fixed] Fix incorrect model name in count token requests to the developer API backend
11+
* [feature] Added support for extra schema properties like `title`, `minItems`, `maxItems`, `minimum`
12+
and `maximum`. As well as support for the `anyOf` schema.
913

10-
1114
# 16.0.0
1215
* [feature] Initial release of the Firebase AI SDK (`firebase-ai`). This SDK *replaces* the previous
1316
Vertex AI in Firebase SDK (`firebase-vertexai`) to accommodate the evolving set of supported

firebase-ai/api.txt

Lines changed: 52 additions & 0 deletions
Large diffs are not rendered by default.

firebase-ai/gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
version=16.1.0
16-
latestReleasedVersion=16.0.0
15+
version=16.2.0
16+
latestReleasedVersion=16.1.0

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

Lines changed: 124 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ internal constructor(
4242
public val properties: Map<String, Schema>? = null,
4343
public val required: List<String>? = null,
4444
public val items: Schema? = null,
45+
public val title: String? = null,
46+
public val minItems: Int? = null,
47+
public val maxItems: Int? = null,
48+
public val minimum: Double? = null,
49+
public val maximum: Double? = null,
50+
public val anyOf: List<Schema>? = null,
4551
) {
4652

4753
public companion object {
@@ -53,12 +59,12 @@ internal constructor(
5359
*/
5460
@JvmStatic
5561
@JvmOverloads
56-
public fun boolean(description: String? = null, nullable: Boolean = false): Schema =
57-
Schema(
58-
description = description,
59-
nullable = nullable,
60-
type = "BOOLEAN",
61-
)
62+
public fun boolean(
63+
description: String? = null,
64+
nullable: Boolean = false,
65+
title: String? = null,
66+
): Schema =
67+
Schema(description = description, nullable = nullable, type = "BOOLEAN", title = title)
6268

6369
/**
6470
* Returns a [Schema] for a 32-bit signed integer number.
@@ -73,12 +79,21 @@ internal constructor(
7379
@JvmStatic
7480
@JvmName("numInt")
7581
@JvmOverloads
76-
public fun integer(description: String? = null, nullable: Boolean = false): Schema =
82+
public fun integer(
83+
description: String? = null,
84+
nullable: Boolean = false,
85+
title: String? = null,
86+
minimum: Double? = null,
87+
maximum: Double? = null,
88+
): Schema =
7789
Schema(
7890
description = description,
7991
format = "int32",
8092
nullable = nullable,
8193
type = "INTEGER",
94+
title = title,
95+
minimum = minimum,
96+
maximum = maximum,
8297
)
8398

8499
/**
@@ -90,11 +105,20 @@ internal constructor(
90105
@JvmStatic
91106
@JvmName("numLong")
92107
@JvmOverloads
93-
public fun long(description: String? = null, nullable: Boolean = false): Schema =
108+
public fun long(
109+
description: String? = null,
110+
nullable: Boolean = false,
111+
title: String? = null,
112+
minimum: Double? = null,
113+
maximum: Double? = null,
114+
): Schema =
94115
Schema(
95116
description = description,
96117
nullable = nullable,
97118
type = "INTEGER",
119+
title = title,
120+
minimum = minimum,
121+
maximum = maximum,
98122
)
99123

100124
/**
@@ -106,8 +130,21 @@ internal constructor(
106130
@JvmStatic
107131
@JvmName("numDouble")
108132
@JvmOverloads
109-
public fun double(description: String? = null, nullable: Boolean = false): Schema =
110-
Schema(description = description, nullable = nullable, type = "NUMBER")
133+
public fun double(
134+
description: String? = null,
135+
nullable: Boolean = false,
136+
title: String? = null,
137+
minimum: Double? = null,
138+
maximum: Double? = null,
139+
): Schema =
140+
Schema(
141+
description = description,
142+
nullable = nullable,
143+
type = "NUMBER",
144+
title = title,
145+
minimum = minimum,
146+
maximum = maximum,
147+
)
111148

112149
/**
113150
* Returns a [Schema] for a single-precision floating-point number.
@@ -123,8 +160,22 @@ internal constructor(
123160
@JvmStatic
124161
@JvmName("numFloat")
125162
@JvmOverloads
126-
public fun float(description: String? = null, nullable: Boolean = false): Schema =
127-
Schema(description = description, nullable = nullable, type = "NUMBER", format = "float")
163+
public fun float(
164+
description: String? = null,
165+
nullable: Boolean = false,
166+
title: String? = null,
167+
minimum: Double? = null,
168+
maximum: Double? = null,
169+
): Schema =
170+
Schema(
171+
description = description,
172+
nullable = nullable,
173+
type = "NUMBER",
174+
format = "float",
175+
title = title,
176+
minimum = minimum,
177+
maximum = maximum,
178+
)
128179

129180
/**
130181
* Returns a [Schema] for a string.
@@ -139,13 +190,15 @@ internal constructor(
139190
public fun string(
140191
description: String? = null,
141192
nullable: Boolean = false,
142-
format: StringFormat? = null
193+
format: StringFormat? = null,
194+
title: String? = null,
143195
): Schema =
144196
Schema(
145197
description = description,
146198
format = format?.value,
147199
nullable = nullable,
148-
type = "STRING"
200+
type = "STRING",
201+
title = title,
149202
)
150203

151204
/**
@@ -155,6 +208,7 @@ internal constructor(
155208
* `String` and values of type [Schema].
156209
*
157210
* **Example:** A `city` could be represented with the following object `Schema`.
211+
*
158212
* ```
159213
* Schema.obj(mapOf(
160214
* "name" to Schema.string(),
@@ -176,6 +230,7 @@ internal constructor(
176230
optionalProperties: List<String> = emptyList(),
177231
description: String? = null,
178232
nullable: Boolean = false,
233+
title: String? = null,
179234
): Schema {
180235
if (!properties.keys.containsAll(optionalProperties)) {
181236
throw IllegalArgumentException(
@@ -188,6 +243,7 @@ internal constructor(
188243
properties = properties,
189244
required = properties.keys.minus(optionalProperties.toSet()).toList(),
190245
type = "OBJECT",
246+
title = title,
191247
)
192248
}
193249

@@ -203,20 +259,25 @@ internal constructor(
203259
public fun array(
204260
items: Schema,
205261
description: String? = null,
206-
nullable: Boolean = false
262+
nullable: Boolean = false,
263+
title: String? = null,
264+
minItems: Int? = null,
265+
maxItems: Int? = null,
207266
): Schema =
208267
Schema(
209268
description = description,
210269
nullable = nullable,
211270
items = items,
212271
type = "ARRAY",
272+
title = title,
273+
minItems = minItems,
274+
maxItems = maxItems,
213275
)
214276

215277
/**
216278
* Returns a [Schema] for an enumeration.
217279
*
218280
* For example, the cardinal directions can be represented as:
219-
*
220281
* ```
221282
* Schema.enumeration(listOf("north", "east", "south", "west"), "Cardinal directions")
222283
* ```
@@ -230,37 +291,79 @@ internal constructor(
230291
public fun enumeration(
231292
values: List<String>,
232293
description: String? = null,
233-
nullable: Boolean = false
294+
nullable: Boolean = false,
295+
title: String? = null,
234296
): Schema =
235297
Schema(
236298
description = description,
237299
format = "enum",
238300
nullable = nullable,
239301
enum = values,
240302
type = "STRING",
303+
title = title,
241304
)
305+
306+
/**
307+
* Returns a [Schema] representing a value that must conform to *any* (one of) the provided
308+
* sub-schema.
309+
*
310+
* Example: A field that can hold either a simple userID or a more detailed user object.
311+
*
312+
* Schema.anyOf( listOf( Schema.integer(description = "User ID"), Schema.obj(mapOf(
313+
*
314+
* ```
315+
* "userID" to Schema.integer(description = "User ID"),
316+
* "username" to Schema.string(description = "Username")
317+
* ```
318+
*
319+
* )) )
320+
*
321+
* @param schemas The list of valid schemas which could be here
322+
*/
323+
@JvmStatic
324+
public fun anyOf(schemas: List<Schema>): Schema = Schema(type = "ANYOF", anyOf = schemas)
242325
}
243326

244-
internal fun toInternal(): Internal =
245-
Internal(
246-
type,
327+
internal fun toInternal(): Internal {
328+
val cleanedType =
329+
if (type == "ANYOF") {
330+
null
331+
} else {
332+
type
333+
}
334+
return Internal(
335+
cleanedType,
247336
description,
248337
format,
249338
nullable,
250339
enum,
251340
properties?.mapValues { it.value.toInternal() },
252341
required,
253342
items?.toInternal(),
343+
title,
344+
minItems,
345+
maxItems,
346+
minimum,
347+
maximum,
348+
anyOf?.map { it.toInternal() },
254349
)
350+
}
351+
255352
@Serializable
256353
internal data class Internal(
257-
val type: String,
354+
val type: String? = null,
258355
val description: String? = null,
259356
val format: String? = null,
260357
val nullable: Boolean? = false,
261358
val enum: List<String>? = null,
262359
val properties: Map<String, Internal>? = null,
263360
val required: List<String>? = null,
264361
val items: Internal? = null,
362+
val title: String? = null,
363+
val minItems: Int? = null,
364+
val maxItems: Int? = null,
365+
val minimum: Double? = null,
366+
val maximum: Double? = null,
367+
val anyOf: List<Internal>? = null,
265368
)
266369
}

firebase-ai/src/test/java/com/google/firebase/ai/SerializationTests.kt

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,18 +175,15 @@ internal class SerializationTests {
175175
"type": {
176176
"type": "string"
177177
},
178-
"format": {
178+
"description": {
179179
"type": "string"
180180
},
181-
"description": {
181+
"format": {
182182
"type": "string"
183183
},
184184
"nullable": {
185185
"type": "boolean"
186186
},
187-
"items": {
188-
"${'$'}ref": "Schema"
189-
},
190187
"enum": {
191188
"type": "array",
192189
"items": {
@@ -204,7 +201,31 @@ internal class SerializationTests {
204201
"items": {
205202
"type": "string"
206203
}
207-
}
204+
},
205+
"items": {
206+
"${'$'}ref": "Schema"
207+
},
208+
"title": {
209+
"type": "string"
210+
},
211+
"minItems": {
212+
"type": "integer"
213+
},
214+
"maxItems": {
215+
"type": "integer"
216+
},
217+
"minimum": {
218+
"type": "number"
219+
},
220+
"maximum": {
221+
"type": "number"
222+
},
223+
"anyOf": {
224+
"type": "array",
225+
"items": {
226+
"${'$'}ref": "Schema"
227+
}
228+
}
208229
}
209230
}
210231
"""

firebase-crashlytics-ndk/CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Unreleased
2-
* [changed] Updated `firebase-crashlytics` dependency to v19.4.4
32

43

4+
# 19.4.4
5+
* [changed] Updated `firebase-crashlytics` dependency to v19.4.4
6+
57
# 19.4.3
68
* [changed] Updated internal Crashpad version to commit `21a20e`.
79

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
version=19.4.4
2-
latestReleasedVersion=19.4.3
1+
version=19.4.5
2+
latestReleasedVersion=19.4.4

0 commit comments

Comments
 (0)