Part

interfacePart

Known direct subclasses
FileDataPart

This class is deprecated. The Vertex AI in Firebase SDK (firebase-vertexai) has been replaced with the FirebaseAI SDK (firebase-ai) to accommodate the evolving set of supported features and services.

FunctionCallPart

This class is deprecated. The Vertex AI in Firebase SDK (firebase-vertexai) has been replaced with the FirebaseAI SDK (firebase-ai) to accommodate the evolving set of supported features and services.

FunctionResponsePart

This class is deprecated. The Vertex AI in Firebase SDK (firebase-vertexai) has been replaced with the FirebaseAI SDK (firebase-ai) to accommodate the evolving set of supported features and services.

ImagePart

This class is deprecated. The Vertex AI in Firebase SDK (firebase-vertexai) has been replaced with the FirebaseAI SDK (firebase-ai) to accommodate the evolving set of supported features and services.

InlineDataPart

This class is deprecated. The Vertex AI in Firebase SDK (firebase-vertexai) has been replaced with the FirebaseAI SDK (firebase-ai) to accommodate the evolving set of supported features and services.

TextPart

This class is deprecated. The Vertex AI in Firebase SDK (firebase-vertexai) has been replaced with the FirebaseAI SDK (firebase-ai) to accommodate the evolving set of supported features and services.


This interface is deprecated.
The Vertex AI in Firebase SDK (firebase-vertexai) has been replaced with the FirebaseAI SDK (firebase-ai) to accommodate the evolving set of supported features and services.For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk

Interface representing data sent to and received from requests.

Summary

Extension functions

FileDataPart?

Returns the part as aFileDataPart if it represents a file, and null otherwise

Bitmap?

Returns the part as aBitmap if it represents an image, and null otherwise

InlineDataPart?

Returns the part as aInlineDataPart if it represents inline data, and null otherwise

String?

Returns the part as aString if it represents text, and null otherwise

Extension functions

asFileDataOrNull

fun Part.asFileDataOrNull(): FileDataPart?

Returns the part as aFileDataPart if it represents a file, and null otherwise

asImageOrNull

fun Part.asImageOrNull(): Bitmap?

Returns the part as aBitmap if it represents an image, and null otherwise

asInlineDataPartOrNull

fun Part.asInlineDataPartOrNull(): InlineDataPart?

Returns the part as aInlineDataPart if it represents inline data, and null otherwise

asTextOrNull

fun Part.asTextOrNull(): String?

Returns the part as aString if it represents text, and null otherwise

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-07-21 UTC.