Skip to content

Commit 87d4fb0

Browse files
committed
update javadocs
1 parent f97833e commit 87d4fb0

File tree

5 files changed

+54
-5
lines changed

5 files changed

+54
-5
lines changed

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

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

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

19-
/* Represents the response from the server. */
19+
/**
20+
* Represents the response from the server for live content updates. This class encapsulates the
21+
* content data, the status of the response, and any function calls included in the response.
22+
* @param data
23+
*/
2024
@PublicPreviewAPI
2125
public class LiveContentResponse
2226
internal constructor(
27+
28+
/** The main content data of the response. This can be null if there is no content. */
2329
public val data: Content?,
30+
31+
/**
32+
* The status of the live content response. Indicates whether the response is normal, was
33+
* interrupted, or signifies the completion of a turn.
34+
*/
2435
public val status: Status,
36+
37+
/**
38+
* A list of function call parts included in the response, if any. This list can be null or empty
39+
* if no function calls are present.
40+
*/
2541
public val functionCalls: List<FunctionCallPart>?
2642
) {
43+
2744
/**
2845
* Convenience field representing all the text parts in the response as a single string, if they
2946
* exists.
3047
*/
3148
public val text: String? =
3249
data?.parts?.filterIsInstance<TextPart>()?.joinToString(" ") { it.text }
3350

51+
/** Represents the status of a [LiveContentResponse]. */
3452
@JvmInline
3553
public value class Status private constructor(private val value: Int) {
3654
public companion object {
55+
/** Indicates that server has sent data and will continue to send data. */
3756
public val NORMAL: Status = Status(0)
57+
/** Indicates that the server was interrupted. */
3858
public val INTERRUPTED: Status = Status(1)
59+
/** Indicates that a turn in the interaction has been completed. */
3960
public val TURN_COMPLETE: Status = Status(2)
4061
}
4162
}

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

Lines changed: 10 additions & 2 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
@@ -234,7 +235,10 @@ internal constructor(
234235

235236
/**
236237
* Stops receiving from the server. If this function is called during an ongoing audio
237-
* conversation, the server's response will not be received, and no audio will be played.
238+
* conversation, the server's response will not be received, and no audio will be played. By
239+
* stopping receiving, the live session object will no longer receive data from the server. To
240+
* resume receiving data, you must either handle it directly using [receive], or indirectly by
241+
* using [startAudioConversation].
238242
*/
239243
public fun stopReceiving() {
240244
if (!startedReceiving) {
@@ -356,7 +360,11 @@ internal constructor(
356360
send(Content.Builder().text(text).build())
357361
}
358362

359-
/** Closes the client session. */
363+
/**
364+
* Closes the client session. After this is called, the session object becomes unusable. To
365+
* interact with the Gemini server again, you must create a new session using
366+
* [LiveGenerativeModel].
367+
*/
360368
public suspend fun close() {
361369
session?.close()
362370
}

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,22 @@ import kotlinx.serialization.KSerializer
2121
import kotlinx.serialization.SerialName
2222
import kotlinx.serialization.Serializable
2323

24-
/** Modality for bidirectional streaming. */
24+
/**
25+
* Represents the modality of a response. This indicates the type of content being returned (e.g.,
26+
* text, image, audio).
27+
*/
2528
@PublicPreviewAPI
2629
public class ResponseModality private constructor(public val ordinal: Int) {
2730

2831
@Serializable(Internal.Serializer::class)
2932
internal enum class Internal {
33+
/** Represents an unspecified response modality. */
3034
@SerialName("MODALITY_UNSPECIFIED") UNSPECIFIED,
35+
/** Represents a plain text response modality. */
3136
TEXT,
37+
/** Represents an image response modality. */
3238
IMAGE,
39+
/** Represents an audio response modality. */
3340
AUDIO;
3441

3542
internal object Serializer : KSerializer<Internal> by FirstOrdinalSerializer(Internal::class)

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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,15 @@ public class Voices private constructor(public val ordinal: Int) {
2727

2828
@Serializable
2929
internal enum class InternalEnum {
30+
/** Represents the Charon voice. */
3031
CHARON,
32+
/** Represents the Aoede voice. */
3133
AOEDE,
34+
/** Represents the Fenrir voice. */
3235
FENRIR,
36+
/** Represents the Kore voice. */
3337
KORE,
38+
/** Represents the Puck voice. */
3439
PUCK;
3540
internal fun toPublic() =
3641
when (this) {
@@ -56,14 +61,19 @@ public class Voices private constructor(public val ordinal: Int) {
5661
/** Unspecified modality. */
5762
@JvmField public val UNSPECIFIED: Voices = Voices(0)
5863

64+
/** Represents the Charon voice. */
5965
@JvmField public val CHARON: Voices = Voices(1)
6066

67+
/** Represents the Aoede voice. */
6168
@JvmField public val AOEDE: Voices = Voices(2)
6269

70+
/** Represents the Fenrir voice. */
6371
@JvmField public val FENRIR: Voices = Voices(3)
6472

73+
/** Represents the Kore voice. */
6574
@JvmField public val KORE: Voices = Voices(4)
6675

76+
/** Represents the Puck voice. */
6777
@JvmField public val PUCK: Voices = Voices(5)
6878
}
6979
}

0 commit comments

Comments
 (0)