Skip to content

Commit aeed57e

Browse files
committed
add modality
1 parent 1df7e48 commit aeed57e

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ import kotlinx.serialization.Serializable
5555
* response. The number of tokens per word varies depending on the language outputted. Defaults to 0
5656
* (unbounded).
5757
*
58-
* @property responseModalities Specifies the format of the data in which the server responds to
58+
* @property responseModality Specifies the format of the data in which the server responds to
5959
* requests
6060
*
6161
* @property speechConfig Specifies the voice configuration of the audio response from the server.
@@ -73,7 +73,7 @@ private constructor(
7373
internal val maxOutputTokens: Int?,
7474
internal val presencePenalty: Float?,
7575
internal val frequencyPenalty: Float?,
76-
internal val responseModalities: List<ContentModality>?,
76+
internal val responseModality: ContentModality?,
7777
internal val speechConfig: SpeechConfig?
7878
) {
7979

@@ -97,7 +97,7 @@ private constructor(
9797
*
9898
* @property maxOutputTokens See [LiveGenerationConfig.maxOutputTokens].
9999
*
100-
* @property responseModalities See [LiveGenerationConfig.responseModalities]
100+
* @property responseModality See [LiveGenerationConfig.responseModality]
101101
*
102102
* @property speechConfig See [LiveGenerationConfig.speechConfig]
103103
*/
@@ -109,7 +109,7 @@ private constructor(
109109
@JvmField public var maxOutputTokens: Int? = null
110110
@JvmField public var presencePenalty: Float? = null
111111
@JvmField public var frequencyPenalty: Float? = null
112-
@JvmField public var responseModalities: List<ContentModality>? = null
112+
@JvmField public var responseModality: ContentModality? = null
113113
@JvmField public var speechConfig: SpeechConfig? = null
114114

115115
public fun setTemperature(temperature: Float?): Builder = apply {
@@ -129,8 +129,8 @@ private constructor(
129129
public fun setFrequencyPenalty(frequencyPenalty: Float?): Builder = apply {
130130
this.frequencyPenalty = frequencyPenalty
131131
}
132-
public fun setResponseModalities(responseModalities: List<ContentModality>?): Builder = apply {
133-
this.responseModalities = responseModalities
132+
public fun setResponseModalities(responseModalities: ContentModality?): Builder = apply {
133+
this.responseModality = responseModalities
134134
}
135135
public fun setSpeechConfig(speechConfig: SpeechConfig?): Builder = apply {
136136
this.speechConfig = speechConfig
@@ -147,7 +147,7 @@ private constructor(
147147
presencePenalty = presencePenalty,
148148
frequencyPenalty = frequencyPenalty,
149149
speechConfig = speechConfig,
150-
responseModalities = responseModalities
150+
responseModality = responseModality
151151
)
152152
}
153153

@@ -161,7 +161,8 @@ private constructor(
161161
frequencyPenalty = frequencyPenalty,
162162
presencePenalty = presencePenalty,
163163
speechConfig = speechConfig?.toInternal(),
164-
responseModalities = responseModalities?.map { it.toInternal() }
164+
responseModalities =
165+
if (responseModality != null) listOf(responseModality.toInternal()) else null
165166
)
166167
}
167168

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ internal constructor(
128128
}
129129

130130
/**
131-
* Receives all function call responses from the server for the audio conversation feature.
132-
* This can be called only after calling [startAudioConversation] function.
131+
* Receives all function call responses from the server for the audio conversation feature. This
132+
* can be called only after calling [startAudioConversation] function.
133133
*
134134
* @return A [Flow] which will emit list of [FunctionCallPart] as they are returned by the model.
135135
*/
@@ -216,9 +216,10 @@ internal constructor(
216216
delay(1000)
217217
}
218218

219-
/** Stops the audio conversation with the Gemini Server. This needs to be called only after
220-
* calling [startAudioConversation]
221-
* */
219+
/**
220+
* Stops the audio conversation with the Gemini Server. This needs to be called only after calling
221+
* [startAudioConversation]
222+
*/
222223
public fun stopAudioConversation() {
223224
stopReceiving()
224225
isRecording = false

0 commit comments

Comments
 (0)