Skip to content

Commit df9adeb

Browse files
authored
Merge branch 'main' into rl.kapt.functions
2 parents e033cd9 + 22ace25 commit df9adeb

File tree

4 files changed

+110
-32
lines changed

4 files changed

+110
-32
lines changed

firebase-dataconnect/gradleplugin/plugin/src/main/resources/com/google/firebase/dataconnect/gradle/plugin/DataConnectExecutableVersions.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,42 @@
216216
"os": "linux",
217217
"size": 25129112,
218218
"sha512DigestHex": "6ae87788e55d3c79dc8558fe899c06aed21237b2ab332593d05c02d6db98fc94c3e7861dbb58af1fbb69a0dfa639c005539fe3006d4f001af69b8532a7f175b0"
219+
},
220+
{
221+
"version": "1.5.1",
222+
"os": "windows",
223+
"size": 25720320,
224+
"sha512DigestHex": "c53e7225186fa16b890992705a1aca49e63d6b910f2150c6a64a6ce62d56f01781a2f24a93058595e8eba84cd9bc68aa076b6197c6dacd7e9c04f808efa32172"
225+
},
226+
{
227+
"version": "1.5.1",
228+
"os": "macos",
229+
"size": 25289472,
230+
"sha512DigestHex": "1922e64aecfb70db1bf73a8b45e8eca08f0ff5e0bc49ef8ef386cfe5b3d92b3a8e54f9f296f991bf9dabedb90cfb3dc89e2f0d058818444f8b1f5f44dcae7ec9"
231+
},
232+
{
233+
"version": "1.5.1",
234+
"os": "linux",
235+
"size": 25202840,
236+
"sha512DigestHex": "23fc6ee16d70af1c9cff71ebd5a8b4c171cb2992f27bf8defb267701fb6b7e650ccf6745ad17aac14f6b9208929bac4c4a25d0b0b42437c1f91c474d779e20c4"
237+
},
238+
{
239+
"version": "1.6.0",
240+
"os": "windows",
241+
"size": 25731072,
242+
"sha512DigestHex": "33f59b28649eae190e8b54e181efb5d0db675f4dbd104cbd635302b6db7ebcedb430f99106a5181ec328a02cacc79dbf2e73aec878e74c3eb17b2e554cc24d27"
243+
},
244+
{
245+
"version": "1.6.0",
246+
"os": "macos",
247+
"size": 25301760,
248+
"sha512DigestHex": "ac147e24eee3611b186dd89e7b2829d843544552708d7fbce54cf340fa87fa073ae0c32332659519c16eabd0bf5d3e4fa85311aed5e2a5b7de1ee770f50a329b"
249+
},
250+
{
251+
"version": "1.6.0",
252+
"os": "linux",
253+
"size": 25219224,
254+
"sha512DigestHex": "1ac47fee5ef0a06f2f4acb9d464da21d9df1e17df5768cd73fdb69c839048c30fd57d330881ef6e1c78b5cc37e3fe92378dac22aed0d3d0a8d0a1fa77a045f0d"
219255
}
220256
]
221257
}

firebase-vertexai/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Unreleased
22
* [fixed] Fixed issue where Firebase App Check error tokens were unintentionally missing from the requests. (#6409)
3-
3+
* [fixed] Clarified in the documentation that `Schema.integer` and `Schema.float` only provide hints to the model. (#6420)
44

55
# 16.0.1
66
* [fixed] Fixed issue where authorization headers weren't correctly formatted and were ignored by the backend. (#6400)

firebase-vertexai/firebase-vertexai.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ dependencies {
8686
implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
8787
implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
8888
implementation("io.ktor:ktor-client-logging:$ktorVersion")
89-
compileOnly("io.ktor:ktor-client-mock:$ktorVersion")
9089

9190
api("com.google.firebase:firebase-common:21.0.0")
9291
implementation("com.google.firebase:firebase-components:18.0.0")

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

Lines changed: 73 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,16 @@ public abstract class StringFormat private constructor(internal val value: Strin
2020
public class Custom(value: String) : StringFormat(value)
2121
}
2222

23-
/** Represents a schema */
23+
/**
24+
* Definition of a data type.
25+
*
26+
* These types can be objects, but also primitives and arrays. Represents a select subset of an
27+
* [OpenAPI 3.0 schema object](https://spec.openapis.org/oas/v3.0.3#schema).
28+
*
29+
* **Note:** While optional, including a `description` field in your `Schema` is strongly
30+
* encouraged. The more information the model has about what it's expected to generate, the better
31+
* the results.
32+
*/
2433
public class Schema
2534
internal constructor(
2635
public val type: String,
@@ -34,7 +43,12 @@ internal constructor(
3443
) {
3544

3645
public companion object {
37-
/** Returns a schema for a boolean */
46+
/**
47+
* Returns a [Schema] representing a boolean value.
48+
*
49+
* @param description An optional description of what the boolean should contain or represent.
50+
* @param nullable Indicates whether the value can be `null`. Defaults to `false`.
51+
*/
3852
@JvmStatic
3953
@JvmOverloads
4054
public fun boolean(description: String? = null, nullable: Boolean = false): Schema =
@@ -45,10 +59,14 @@ internal constructor(
4559
)
4660

4761
/**
48-
* Returns a schema for a 32-bit integer number
62+
* Returns a [Schema] for a 32-bit signed integer number.
4963
*
50-
* @param description: The description of what the parameter should contain or represent
51-
* @param nullable: Whether null is a valid value for this schema
64+
* **Important:** This [Schema] provides a hint to the model that it should generate a 32-bit
65+
* integer, but only guarantees that the value will be an integer. Therefore it's *possible*
66+
* that decoding it as an `Int` variable (or `int` in Java) could overflow.
67+
*
68+
* @param description An optional description of what the integer should contain or represent.
69+
* @param nullable Indicates whether the value can be `null`. Defaults to `false`.
5270
*/
5371
@JvmStatic
5472
@JvmName("numInt")
@@ -62,10 +80,10 @@ internal constructor(
6280
)
6381

6482
/**
65-
* Returns a schema for a 64-bit integer number
83+
* Returns a [Schema] for a 64-bit signed integer number.
6684
*
67-
* @param description: The description of what the parameter should contain or represent
68-
* @param nullable: Whether null is a valid value for this schema
85+
* @param description An optional description of what the number should contain or represent.
86+
* @param nullable Indicates whether the value can be `null`. Defaults to `false`.
6987
*/
7088
@JvmStatic
7189
@JvmName("numLong")
@@ -78,10 +96,10 @@ internal constructor(
7896
)
7997

8098
/**
81-
* Returns a schema for a floating point number
99+
* Returns a [Schema] for a double-precision floating-point number.
82100
*
83-
* @param description: The description of what the parameter should contain or represent
84-
* @param nullable: Whether null is a valid value for this schema
101+
* @param description An optional description of what the number should contain or represent.
102+
* @param nullable Indicates whether the value can be `null`. Defaults to `false`.
85103
*/
86104
@JvmStatic
87105
@JvmName("numDouble")
@@ -90,10 +108,15 @@ internal constructor(
90108
Schema(description = description, nullable = nullable, type = "NUMBER", format = "double")
91109

92110
/**
93-
* Returns a schema for a floating point number
111+
* Returns a [Schema] for a single-precision floating-point number.
112+
*
113+
* **Important:** This [Schema] provides a hint to the model that it should generate a
114+
* single-precision floating-point number, but only guarantees that the value will be a number.
115+
* Therefore it's *possible* that decoding it as a `Float` variable (or `float` in Java) could
116+
* overflow.
94117
*
95-
* @param description: The description of what the parameter should contain or represent
96-
* @param nullable: Whether null is a valid value for this schema
118+
* @param description An optional description of what the number should contain or represent.
119+
* @param nullable Indicates whether the value can be `null`. Defaults to `false`.
97120
*/
98121
@JvmStatic
99122
@JvmName("numFloat")
@@ -102,11 +125,11 @@ internal constructor(
102125
Schema(description = description, nullable = nullable, type = "NUMBER", format = "float")
103126

104127
/**
105-
* Returns a schema for a string
128+
* Returns a [Schema] for a string.
106129
*
107-
* @param description: The description of what the parameter should contain or represent
108-
* @param nullable: Whether null is a valid value for this schema
109-
* @param format: The pattern that values need to adhere to
130+
* @param description An optional description of what the string should contain or represent.
131+
* @param nullable Indicates whether the value can be `null`. Defaults to `false`.
132+
* @param format An optional pattern that values need to adhere to.
110133
*/
111134
@JvmStatic
112135
@JvmName("str")
@@ -124,11 +147,25 @@ internal constructor(
124147
)
125148

126149
/**
127-
* Returns a schema for a complex object. In a function, it will be returned as a [JSONObject].
150+
* Returns a [Schema] for a complex data type.
151+
*
152+
* This schema instructs the model to produce data of type object, which has keys of type
153+
* `String` and values of type [Schema].
128154
*
129-
* @param properties: The map of the object's fields to their schema
130-
* @param description: The description of what the parameter should contain or represent
131-
* @param nullable: Whether null is a valid value for this schema
155+
* **Example:** A `city` could be represented with the following object `Schema`.
156+
* ```
157+
* Schema.obj(mapOf(
158+
* "name" to Schema.string(),
159+
* "population" to Schema.integer()
160+
* ))
161+
* ```
162+
*
163+
* @param properties The map of the object's property names to their [Schema]s.
164+
* @param optionalProperties The list of optional properties. They must correspond to the keys
165+
* provided in the `properties` map. By default it's empty, signaling the model that all
166+
* properties are to be included.
167+
* @param description An optional description of what the object represents.
168+
* @param nullable Indicates whether the value can be `null`. Defaults to `false`.
132169
*/
133170
@JvmStatic
134171
@JvmOverloads
@@ -153,11 +190,11 @@ internal constructor(
153190
}
154191

155192
/**
156-
* Returns a schema for an array.
193+
* Returns a [Schema] for an array.
157194
*
158-
* @param items: The schema of the elements of this array
159-
* @param description: The description of what the parameter should contain or represent
160-
* @param nullable: Whether null is a valid value for this schema
195+
* @param items The [Schema] of the elements stored in the array.
196+
* @param description An optional description of what the array represents.
197+
* @param nullable Indicates whether the value can be `null`. Defaults to `false`.
161198
*/
162199
@JvmStatic
163200
@JvmOverloads
@@ -174,11 +211,17 @@ internal constructor(
174211
)
175212

176213
/**
177-
* Returns a schema for an enumeration
214+
* Returns a [Schema] for an enumeration.
215+
*
216+
* For example, the cardinal directions can be represented as:
217+
*
218+
* ```
219+
* Schema.enumeration(listOf("north", "east", "south", "west"), "Cardinal directions")
220+
* ```
178221
*
179-
* @param values: The list of valid values for this enumeration
180-
* @param description: The description of what the parameter should contain or represent
181-
* @param nullable: Whether null is a valid value for this schema
222+
* @param values The list of valid values for this enumeration
223+
* @param description The description of what the parameter should contain or represent
224+
* @param nullable Indicates whether the value can be `null`. Defaults to `false`.
182225
*/
183226
@JvmStatic
184227
@JvmOverloads

0 commit comments

Comments
 (0)