Skip to content

Commit 92c7117

Browse files
committed
add multimodal api
1 parent 534cc53 commit 92c7117

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

firebase-vertexai/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
version=16.4.0
15+
version=99.9.9
1616
latestReleasedVersion=16.3.0

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ public class GenerateContentResponse(
4444
candidates.first().content.parts.filterIsInstance<FunctionCallPart>()
4545
}
4646

47+
/** Convenience field to list all the [InlineDataPart]s in the response, if they exist. */
48+
public val inlineDataParts: List<InlineDataPart> by lazy {
49+
candidates.first().content.parts.filterIsInstance<InlineDataPart>()
50+
}
51+
4752
@Serializable
4853
internal data class Internal(
4954
val candidates: List<Candidate.Internal>? = null,

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ import kotlinx.serialization.Serializable
7777
* guide for more details.
7878
*/
7979
public class GenerationConfig
80+
@OptIn(PublicPreviewAPI::class)
8081
private constructor(
8182
internal val temperature: Float?,
8283
internal val topK: Int?,
@@ -88,6 +89,7 @@ private constructor(
8889
internal val stopSequences: List<String>?,
8990
internal val responseMimeType: String?,
9091
internal val responseSchema: Schema?,
92+
internal val responseModalities: List<ResponseModality>?,
9193
) {
9294

9395
/**
@@ -128,6 +130,7 @@ private constructor(
128130
@JvmField public var stopSequences: List<String>? = null
129131
@JvmField public var responseMimeType: String? = null
130132
@JvmField public var responseSchema: Schema? = null
133+
@JvmField public var responseModalities: List<ResponseModality>? = null
131134

132135
/** Create a new [GenerationConfig] with the attached arguments. */
133136
public fun build(): GenerationConfig =
@@ -142,6 +145,7 @@ private constructor(
142145
frequencyPenalty = frequencyPenalty,
143146
responseMimeType = responseMimeType,
144147
responseSchema = responseSchema,
148+
responseModalities = responseModalities
145149
)
146150
}
147151

@@ -156,7 +160,8 @@ private constructor(
156160
frequencyPenalty = frequencyPenalty,
157161
presencePenalty = presencePenalty,
158162
responseMimeType = responseMimeType,
159-
responseSchema = responseSchema?.toInternal()
163+
responseSchema = responseSchema?.toInternal(),
164+
responseModalities = responseModalities?.map { it.toInternal() }
160165
)
161166

162167
@Serializable
@@ -171,6 +176,7 @@ private constructor(
171176
@SerialName("presence_penalty") val presencePenalty: Float? = null,
172177
@SerialName("frequency_penalty") val frequencyPenalty: Float? = null,
173178
@SerialName("response_schema") val responseSchema: Schema.Internal? = null,
179+
@SerialName("response_modalities") val responseModalities: List<String>? = null
174180
)
175181

176182
public companion object {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import kotlinx.serialization.KSerializer
2121
import kotlinx.serialization.Serializable
2222

2323
/** Represents the type of content present in a response (e.g., text, image, audio). */
24-
@PublicPreviewAPI
2524
public class ResponseModality private constructor(public val ordinal: Int) {
2625

2726
@Serializable(Internal.Serializer::class)

0 commit comments

Comments
 (0)