Skip to content

feat: Add responseModalities to GenerationConfig #6892

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ private constructor(
internal val stopSequences: List<String>?,
internal val responseMimeType: String?,
internal val responseSchema: Schema?,
internal val responseModalities: List<ResponseModality>?,
) {

/**
Expand Down Expand Up @@ -128,6 +129,7 @@ private constructor(
@JvmField public var stopSequences: List<String>? = null
@JvmField public var responseMimeType: String? = null
@JvmField public var responseSchema: Schema? = null
@JvmField public var responseModalities: List<ResponseModality>? = null

/** Create a new [GenerationConfig] with the attached arguments. */
public fun build(): GenerationConfig =
Expand Down Expand Up @@ -156,7 +158,8 @@ private constructor(
frequencyPenalty = frequencyPenalty,
presencePenalty = presencePenalty,
responseMimeType = responseMimeType,
responseSchema = responseSchema?.toInternal()
responseSchema = responseSchema?.toInternal(),
responseModalities = responseModalities?.map { it.toInternal() },
)

@Serializable
Expand All @@ -171,6 +174,7 @@ private constructor(
@SerialName("presence_penalty") val presencePenalty: Float? = null,
@SerialName("frequency_penalty") val frequencyPenalty: Float? = null,
@SerialName("response_schema") val responseSchema: Schema.Internal? = null,
@SerialName("response_modalities") val responseModalities: List<String>? = null,
)

public companion object {
Expand Down
Loading