Skip to content

Commit a1615ac

Browse files
authored
Merge branch 'main' into fix/unbuffered-io-violation-android-14-resubmission
2 parents 293962b + 5aff679 commit a1615ac

File tree

10 files changed

+92
-35
lines changed

10 files changed

+92
-35
lines changed

.github/workflows/check-vertexai-responses.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on: pull_request
55
jobs:
66
check-version:
77
runs-on: ubuntu-latest
8+
permissions:
9+
pull-requests: write
810
steps:
911
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1012
- name: Clone mock responses

ci/fireci/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies = [
1414
"pandas==1.5.3",
1515
"PyGithub==1.58.2",
1616
"pystache==0.6.0",
17-
"requests==2.31.0",
17+
"requests==2.32.2",
1818
"seaborn==0.12.2",
1919
"PyYAML==6.0.1",
2020
"termcolor==2.4.0",

firebase-config/bandwagoner/src/main/AndroidManifest.xml

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@
1717

1818
<!-- The first number in the version name distinguishes this as the 3P app version. -->
1919
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
20-
package="com.googletest.firebase.remoteconfig.bandwagoner"
21-
android:versionCode="1"
22-
android:versionName="3.0.0">
20+
android:versionCode="1"
21+
android:versionName="3.0.0">
2322

2423

2524
<!--Needed for Firebase Installations getToken method.-->
@@ -30,22 +29,22 @@
3029
<uses-permission android:name="android.permission.WAKE_LOCK"/>
3130

3231
<application
33-
android:name=".MainApplication"
34-
android:label="Bandwagoner"
35-
android:theme="@style/LightNoActionBarTheme">
36-
37-
<activity android:exported="true" android:name=".MainActivity">
38-
<intent-filter>
39-
<action android:name="android.intent.action.MAIN" />
40-
<category android:name="android.intent.category.LAUNCHER" />
41-
</intent-filter>
42-
</activity>
43-
44-
<service android:exported="false" android:name="com.google.firebase.components.ComponentDiscoveryService">
45-
<meta-data
46-
android:name="com.google.firebase.components:com.google.firebase.installations.FirebaseInstallationsRegistrar"
47-
android:value="com.google.firebase.components.ComponentRegistrar"/>
48-
</service>
32+
android:name=".MainApplication"
33+
android:label="Bandwagoner"
34+
android:theme="@style/LightNoActionBarTheme">
35+
36+
<activity android:exported="true" android:name=".MainActivity">
37+
<intent-filter>
38+
<action android:name="android.intent.action.MAIN" />
39+
<category android:name="android.intent.category.LAUNCHER" />
40+
</intent-filter>
41+
</activity>
42+
43+
<service android:exported="false" android:name="com.google.firebase.components.ComponentDiscoveryService">
44+
<meta-data
45+
android:name="com.google.firebase.components:com.google.firebase.installations.FirebaseInstallationsRegistrar"
46+
android:value="com.google.firebase.components.ComponentRegistrar"/>
47+
</service>
4948

5049
</application>
5150

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

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,58 @@
1616

1717
package com.google.firebase.vertexai.type
1818

19-
/* Represents the response from the server. */
19+
/**
20+
* Represents the response from the model for live content updates.
21+
*
22+
* This class encapsulates the content data, the status of the response, and any function calls
23+
* included in the response.
24+
*/
2025
@PublicPreviewAPI
2126
public class LiveContentResponse
2227
internal constructor(
28+
29+
/** The main content data of the response. This can be `null` if there is no content. */
2330
public val data: Content?,
31+
32+
/**
33+
* The status of the live content response. Indicates whether the response is normal, was
34+
* interrupted, or signifies the completion of a turn.
35+
*/
2436
public val status: Status,
37+
38+
/**
39+
* A list of [FunctionCallPart] included in the response, if any.
40+
*
41+
* This list can be null or empty if no function calls are present.
42+
*/
2543
public val functionCalls: List<FunctionCallPart>?
2644
) {
45+
2746
/**
2847
* Convenience field representing all the text parts in the response as a single string, if they
2948
* exists.
3049
*/
3150
public val text: String? =
3251
data?.parts?.filterIsInstance<TextPart>()?.joinToString(" ") { it.text }
3352

53+
/** Represents the status of a [LiveContentResponse], within a single interaction. */
3454
@JvmInline
3555
public value class Status private constructor(private val value: Int) {
3656
public companion object {
57+
/** The server is actively sending data for the current interaction. */
3758
public val NORMAL: Status = Status(0)
59+
/**
60+
* The server was interrupted while generating data.
61+
*
62+
* An interruption occurs when the client sends a message while the server is [actively]
63+
* [NORMAL] sending data.
64+
*/
3865
public val INTERRUPTED: Status = Status(1)
66+
/**
67+
* The model has finished sending data in the current interaction.
68+
*
69+
* Can be set alongside content, signifying that the content is the last in the turn.
70+
*/
3971
public val TURN_COMPLETE: Status = Status(2)
4072
}
4173
}

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

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import android.media.AudioFormat
2020
import android.media.AudioTrack
2121
import android.util.Log
2222
import com.google.firebase.annotations.concurrent.Background
23+
import com.google.firebase.vertexai.LiveGenerativeModel
2324
import io.ktor.client.plugins.websocket.ClientWebSocketSession
2425
import io.ktor.websocket.Frame
2526
import io.ktor.websocket.close
@@ -232,8 +233,14 @@ internal constructor(
232233
}
233234

234235
/**
235-
* Stops receiving from the server. If this function is called during an ongoing audio
236-
* conversation, the server's response will not be received, and no audio will be played.
236+
* Stops receiving from the model.
237+
*
238+
* If this function is called during an ongoing audio conversation, the model's response will not
239+
* be received, and no audio will be played; the live session object will no longer receive data
240+
* from the server.
241+
*
242+
* To resume receiving data, you must either handle it directly using [receive], or indirectly by
243+
* using [startAudioConversation].
237244
*/
238245
public fun stopReceiving() {
239246
if (!startedReceiving) {
@@ -355,7 +362,12 @@ internal constructor(
355362
send(Content.Builder().text(text).build())
356363
}
357364

358-
/** Closes the client session. */
365+
/**
366+
* Closes the client session.
367+
*
368+
* After this is called, the session object becomes unusable. To interact with the server again,
369+
* you must create a new session using [LiveGenerativeModel].
370+
*/
359371
public suspend fun close() {
360372
session?.close()
361373
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import kotlinx.serialization.KSerializer
2121
import kotlinx.serialization.SerialName
2222
import kotlinx.serialization.Serializable
2323

24-
/** Modality for bidirectional streaming. */
24+
/** Represents the type of content present in a response (e.g., text, image, audio). */
2525
@PublicPreviewAPI
2626
public class ResponseModality private constructor(public val ordinal: Int) {
2727

@@ -54,13 +54,13 @@ public class ResponseModality private constructor(public val ordinal: Int) {
5454
/** Unspecified modality. */
5555
@JvmField public val UNSPECIFIED: ResponseModality = ResponseModality(0)
5656

57-
/** Plain text. */
57+
/** Represents a plain text response modality. */
5858
@JvmField public val TEXT: ResponseModality = ResponseModality(1)
5959

60-
/** Image. */
60+
/** Represents an image response modality. */
6161
@JvmField public val IMAGE: ResponseModality = ResponseModality(2)
6262

63-
/** Audio. */
63+
/** Represents an audio response modality. */
6464
@JvmField public val AUDIO: ResponseModality = ResponseModality(4)
6565
}
6666
}

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ import kotlinx.serialization.Serializable
2121

2222
/** Speech configuration class for setting up the voice of the server's response. */
2323
@PublicPreviewAPI
24-
public class SpeechConfig(public val voice: Voices) {
24+
public class SpeechConfig(
25+
/** The voice to be used for the server's speech response. */
26+
public val voice: Voices
27+
) {
2528

2629
@Serializable
2730
internal data class Internal(@SerialName("voice_config") val voiceConfig: VoiceConfigInternal) {

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,26 @@ public class Voices private constructor(public val ordinal: Int) {
5353
}
5454

5555
public companion object {
56-
/** Unspecified modality. */
56+
/**
57+
* Unspecified voice.
58+
*
59+
* Will use the default voice of the model.
60+
*/
5761
@JvmField public val UNSPECIFIED: Voices = Voices(0)
5862

63+
/** Represents the Charon voice. */
5964
@JvmField public val CHARON: Voices = Voices(1)
6065

66+
/** Represents the Aoede voice. */
6167
@JvmField public val AOEDE: Voices = Voices(2)
6268

69+
/** Represents the Fenrir voice. */
6370
@JvmField public val FENRIR: Voices = Voices(3)
6471

72+
/** Represents the Kore voice. */
6573
@JvmField public val KORE: Voices = Voices(4)
6674

75+
/** Represents the Puck voice. */
6776
@JvmField public val PUCK: Voices = Voices(5)
6877
}
6978
}

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ hamcrest = "2.2"
3737
hamcrestJunit = "2.0.0.0"
3838
hamcrestLibrary = "2.2"
3939
httpclientAndroid = "4.3.5.1"
40-
integrity = "1.2.0"
40+
integrity = "1.4.0"
4141
jacksonCore = "2.13.1"
4242
jacksonDatabind = "2.18.2"
4343
javalite = "3.25.5"

plugins/src/main/java/com/google/firebase/gradle/plugins/FirebaseJavaLibraryPlugin.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ import com.google.firebase.gradle.plugins.semver.GmavenCopier
2222
import org.gradle.api.Project
2323
import org.gradle.api.attributes.Attribute
2424
import org.gradle.api.plugins.JavaLibraryPlugin
25-
import org.gradle.api.plugins.JavaPluginConvention
25+
import org.gradle.api.plugins.JavaPluginExtension
2626
import org.gradle.kotlin.dsl.apply
2727
import org.gradle.kotlin.dsl.create
28-
import org.gradle.kotlin.dsl.getPlugin
28+
import org.gradle.kotlin.dsl.getByType
2929
import org.gradle.kotlin.dsl.register
3030
import org.gradle.kotlin.dsl.withType
3131
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
@@ -120,8 +120,8 @@ class FirebaseJavaLibraryPlugin : BaseFirebaseLibraryPlugin() {
120120
private fun setupApiInformationAnalysis(project: Project) {
121121
val srcDirs =
122122
project.files(
123-
project.convention
124-
.getPlugin<JavaPluginConvention>()
123+
project.extensions
124+
.getByType<JavaPluginExtension>()
125125
.sourceSets
126126
.getByName("main")
127127
.java

0 commit comments

Comments
 (0)