File tree Expand file tree Collapse file tree 3 files changed +17
-5
lines changed
firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai Expand file tree Collapse file tree 3 files changed +17
-5
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments