Skip to content

Commit 0ca205f

Browse files
committed
update api text file
1 parent 83c7d9b commit 0ca205f

File tree

3 files changed

+10
-22
lines changed

3 files changed

+10
-22
lines changed

firebase-vertexai/api.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ package com.google.firebase.vertexai.java {
127127
public abstract class LiveSessionFutures {
128128
method public abstract com.google.common.util.concurrent.ListenableFuture<kotlin.Unit> close();
129129
method public static final com.google.firebase.vertexai.java.LiveSessionFutures from(com.google.firebase.vertexai.type.LiveSession session);
130-
method public abstract org.reactivestreams.Publisher<com.google.firebase.vertexai.type.LiveContentResponse> receive(java.util.List<com.google.firebase.vertexai.type.ContentModality> outputModalities);
130+
method public abstract org.reactivestreams.Publisher<com.google.firebase.vertexai.type.LiveContentResponse> receive();
131131
method public abstract com.google.common.util.concurrent.ListenableFuture<kotlin.Unit> send(com.google.firebase.vertexai.type.Content content);
132132
method public abstract com.google.common.util.concurrent.ListenableFuture<kotlin.Unit> send(String text);
133133
method public abstract com.google.common.util.concurrent.ListenableFuture<kotlin.Unit> sendFunctionResponse(java.util.List<com.google.firebase.vertexai.type.FunctionResponsePart> functionList);
@@ -626,7 +626,7 @@ package com.google.firebase.vertexai.type {
626626

627627
public final class LiveSession {
628628
method public suspend Object? close(kotlin.coroutines.Continuation<? super kotlin.Unit>);
629-
method public kotlinx.coroutines.flow.Flow<com.google.firebase.vertexai.type.LiveContentResponse> receive(java.util.List<com.google.firebase.vertexai.type.ContentModality> outputModalities);
629+
method public kotlinx.coroutines.flow.Flow<com.google.firebase.vertexai.type.LiveContentResponse> receive();
630630
method public suspend Object? send(com.google.firebase.vertexai.type.Content content, kotlin.coroutines.Continuation<? super kotlin.Unit>);
631631
method public suspend Object? send(String text, kotlin.coroutines.Continuation<? super kotlin.Unit>);
632632
method public suspend Object? sendFunctionResponse(java.util.List<com.google.firebase.vertexai.type.FunctionResponsePart> functionList, kotlin.coroutines.Continuation<? super kotlin.Unit>);

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

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import androidx.concurrent.futures.SuspendToFutureAdapter
2020
import com.google.common.util.concurrent.ListenableFuture
2121
import com.google.firebase.vertexai.GenerativeModel
2222
import com.google.firebase.vertexai.type.Content
23-
import com.google.firebase.vertexai.type.ContentModality
2423
import com.google.firebase.vertexai.type.FunctionCallPart
2524
import com.google.firebase.vertexai.type.FunctionResponsePart
2625
import com.google.firebase.vertexai.type.LiveContentResponse
@@ -91,20 +90,15 @@ public abstract class LiveSessionFutures internal constructor() {
9190
/**
9291
* Receives responses from the server for both streaming and standard requests.
9392
*
94-
* @param outputModalities The list of output formats to receive from the server.
95-
*
9693
* @return A [Publisher] which will emit [LiveContentResponse] as and when it receives it
9794
*
9895
* @throws [SessionAlreadyReceivingException] when the session is already receiving.
9996
*/
100-
public abstract fun receive(
101-
outputModalities: List<ContentModality>
102-
): Publisher<LiveContentResponse>
97+
public abstract fun receive(): Publisher<LiveContentResponse>
10398

10499
private class FuturesImpl(private val session: LiveSession) : LiveSessionFutures() {
105100

106-
override fun receive(outputModalities: List<ContentModality>): Publisher<LiveContentResponse> =
107-
session.receive(outputModalities).asPublisher()
101+
override fun receive(): Publisher<LiveContentResponse> = session.receive().asPublisher()
108102

109103
override fun close(): ListenableFuture<Unit> =
110104
SuspendToFutureAdapter.launchFuture { session.close() }

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

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ internal constructor(
155155
functionCallsHandler: ((FunctionCallPart) -> FunctionResponsePart)? = null
156156
) {
157157
CoroutineScope(backgroundDispatcher).launch {
158-
receive(listOf(ContentModality.AUDIO)).collect {
158+
receive().collect {
159159
if (!isRecording) {
160160
cancel()
161161
}
@@ -240,13 +240,11 @@ internal constructor(
240240
* Receives responses from the server for both streaming and standard requests. Call
241241
* [stopReceiving] to stop receiving responses from the server.
242242
*
243-
* @param outputModalities The list of output formats to receive from the server.
244-
*
245243
* @return A [Flow] which will emit [LiveContentResponse] as and when it receives it
246244
*
247245
* @throws [SessionAlreadyReceivingException] when the session is already receiving.
248246
*/
249-
public fun receive(outputModalities: List<ContentModality>): Flow<LiveContentResponse> {
247+
public fun receive(): Flow<LiveContentResponse> {
250248
if (startedReceiving) {
251249
throw SessionAlreadyReceivingException()
252250
}
@@ -270,15 +268,11 @@ internal constructor(
270268
try {
271269
val serverContent = Json.decodeFromString<ServerContentSetup.Internal>(receivedJson)
272270
val data = serverContent.serverContent.modelTurn.toPublic()
273-
if (outputModalities.contains(ContentModality.AUDIO)) {
274-
if (data.parts[0].asInlineDataPartOrNull()?.mimeType?.equals("audio/pcm") == true) {
275-
emit(LiveContentResponse(data, LiveContentResponse.Status.NORMAL, null))
276-
}
271+
if (data.parts[0].asInlineDataPartOrNull()?.mimeType?.equals("audio/pcm") == true) {
272+
emit(LiveContentResponse(data, LiveContentResponse.Status.NORMAL, null))
277273
}
278-
if (outputModalities.contains(ContentModality.TEXT)) {
279-
if (data.parts[0] is TextPart) {
280-
emit(LiveContentResponse(data, LiveContentResponse.Status.NORMAL, null))
281-
}
274+
if (data.parts[0] is TextPart) {
275+
emit(LiveContentResponse(data, LiveContentResponse.Status.NORMAL, null))
282276
}
283277
continue
284278
} catch (e: Exception) {

0 commit comments

Comments
 (0)