Skip to content

Commit 340b819

Browse files
committed
update
1 parent 3d41253 commit 340b819

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/java/LiveModelFutures.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ public abstract class LiveModelFutures internal constructor() {
3737
* @throws [ServiceConnectionHandshakeFailedException] If the client was not able to establish a
3838
* connection with the server.
3939
*/
40-
public abstract fun connect(): ListenableFuture<LiveSession>
40+
public abstract fun connect(): ListenableFuture<LiveSessionFutures>
4141

4242
private class FuturesImpl(private val model: LiveGenerativeModel) : LiveModelFutures() {
43-
override fun connect(): ListenableFuture<LiveSession> {
44-
return SuspendToFutureAdapter.launchFuture { model.connect() }
43+
override fun connect(): ListenableFuture<LiveSessionFutures> {
44+
return SuspendToFutureAdapter.launchFuture { LiveSessionFutures.from(model.connect()) }
4545
}
4646
}
4747

firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/java/LiveSessionFutures.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ public abstract class LiveSessionFutures internal constructor() {
4848
functionCallHandler: ((FunctionCallPart) -> FunctionResponsePart)?
4949
): ListenableFuture<Unit>
5050

51+
/**
52+
* Starts an audio conversation with the Gemini server, which can only be stopped using
53+
* [stopAudioConversation].
54+
*
55+
* @param functionCallHandler A callback function to map function calls from the server to their
56+
* response parts.
57+
*/
58+
public abstract fun startAudioConversation(
59+
): ListenableFuture<Unit>
60+
5161
/**
5262
* Stops the audio conversation with the Gemini Server.
5363
*
@@ -124,6 +134,8 @@ public abstract class LiveSessionFutures internal constructor() {
124134
functionCallHandler: ((FunctionCallPart) -> FunctionResponsePart)?
125135
) = SuspendToFutureAdapter.launchFuture { session.startAudioConversation(functionCallHandler) }
126136

137+
override fun startAudioConversation() = SuspendToFutureAdapter.launchFuture { session.startAudioConversation() }
138+
127139
override fun stopAudioConversation() =
128140
SuspendToFutureAdapter.launchFuture { session.stopAudioConversation() }
129141

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ private constructor(
130130
public fun setFrequencyPenalty(frequencyPenalty: Float?): Builder = apply {
131131
this.frequencyPenalty = frequencyPenalty
132132
}
133-
public fun setResponseModalities(responseModalities: ResponseModality?): Builder = apply {
134-
this.responseModality = responseModalities
133+
public fun setResponseModality(responseModality: ResponseModality?): Builder = apply {
134+
this.responseModality = responseModality
135135
}
136136
public fun setSpeechConfig(speechConfig: SpeechConfig?): Builder = apply {
137137
this.speechConfig = speechConfig

0 commit comments

Comments
 (0)