Skip to content

Commit 448adae

Browse files
authored
Change InlineDataPart to match ImagePart (#6346)
The order of the parameters should be consistent between them, and it should be (url/byte, mime-type).
1 parent f194676 commit 448adae

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/internal/util/conversions.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ internal fun com.google.firebase.vertexai.common.shared.Part.toPublic(): Part {
232232
if (inlineData.mimeType.contains("image")) {
233233
ImagePart(decodeBitmapFromImage(data))
234234
} else {
235-
InlineDataPart(inlineData.mimeType, data)
235+
InlineDataPart(data, inlineData.mimeType)
236236
}
237237
}
238238
is com.google.firebase.vertexai.common.shared.FunctionCallPart ->

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ constructor(public val role: String? = "user", public val parts: List<Part>) {
5656
*/
5757
@JvmName("addInlineData")
5858
public fun inlineData(mimeType: String, bytes: ByteArray): Content.Builder =
59-
part(InlineDataPart(mimeType, bytes))
59+
part(InlineDataPart(bytes, mimeType))
6060

6161
/** Wraps the provided [image] inside an [ImagePart] and adds it to the [parts] list. */
6262
@JvmName("addImage") public fun image(image: Bitmap): Content.Builder = part(ImagePart(image))

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,11 @@ public class ImagePart(public val image: Bitmap) : Part
3737
/**
3838
* Represents binary data with an associated MIME type sent to and received from requests.
3939
*
40+
* @param inlineData the binary data as a [ByteArray]
4041
* @param mimeType an IANA standard MIME type. For supported values, see the
4142
* [Vertex AI documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/send-multimodal-prompts#media_requirements)
42-
* .
43-
* @param inlineData the binary data as a [ByteArray]
4443
*/
45-
public class InlineDataPart(public val mimeType: String, public val inlineData: ByteArray) : Part
44+
public class InlineDataPart(public val inlineData: ByteArray, public val mimeType: String) : Part
4645

4746
/**
4847
* Represents a function call request from the model

0 commit comments

Comments
 (0)