Skip to content

Commit e145b38

Browse files
feat: Add responseModalities to GenerationConfig
Adds an optional `responseModalities` property to the `GenerationConfig` class. This allows specifying the desired modality types (e.g., TEXT, IMAGE, AUDIO) for the response. The changes include: - Adding `responseModalities: List<ResponseModality>?` to the `GenerationConfig` primary constructor. - Updating the `GenerationConfig.Builder` to include the new property. - Updating the internal `GenerationConfig.Internal` data class and the `toInternal` mapping for serialization.
1 parent 51b4a1c commit e145b38

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ private constructor(
8888
internal val stopSequences: List<String>?,
8989
internal val responseMimeType: String?,
9090
internal val responseSchema: Schema?,
91+
internal val responseModalities: List<ResponseModality>?,
9192
) {
9293

9394
/**
@@ -128,6 +129,7 @@ private constructor(
128129
@JvmField public var stopSequences: List<String>? = null
129130
@JvmField public var responseMimeType: String? = null
130131
@JvmField public var responseSchema: Schema? = null
132+
@JvmField public var responseModalities: List<ResponseModality>? = null
131133

132134
/** Create a new [GenerationConfig] with the attached arguments. */
133135
public fun build(): GenerationConfig =
@@ -155,8 +157,13 @@ private constructor(
155157
stopSequences = stopSequences,
156158
frequencyPenalty = frequencyPenalty,
157159
presencePenalty = presencePenalty,
160+
responseMimeType = responseMimeType,
161+
responseSchema = responseSchema,
162+
responseModalities = responseModalities,
163+
)
158164
responseMimeType = responseMimeType,
159-
responseSchema = responseSchema?.toInternal()
165+
responseSchema = responseSchema?.toInternal(),
166+
responseModalities = responseModalities?.map { it.toInternal() }
160167
)
161168

162169
@Serializable
@@ -171,6 +178,7 @@ private constructor(
171178
@SerialName("presence_penalty") val presencePenalty: Float? = null,
172179
@SerialName("frequency_penalty") val frequencyPenalty: Float? = null,
173180
@SerialName("response_schema") val responseSchema: Schema.Internal? = null,
181+
@SerialName("response_modalities") val responseModalities: List<String>? = null,
174182
)
175183

176184
public companion object {

0 commit comments

Comments
 (0)