Part

@Serializable
data class Part(val mediaResolution: PartMediaResolution? = null, val codeExecutionResult: CodeExecutionResult? = null, val executableCode: ExecutableCode? = null, val fileData: FileData? = null, val functionCall: FunctionCall? = null, val functionResponse: FunctionResponse? = null, val inlineData: Blob? = null, val text: String? = null, val thought: Boolean? = null, val thoughtSignature: ByteArray? = null, val videoMetadata: VideoMetadata? = null, val toolCall: ToolCall? = null, val toolResponse: ToolResponse? = null, val partMetadata: Map<String, JsonElement>? = null)

A datatype containing media content.

Exactly one field within a Part should be set, representing the specific type of content being conveyed. Using multiple fields within the same Part instance is considered invalid.

Constructors

Link copied to clipboard
constructor(mediaResolution: PartMediaResolution? = null, codeExecutionResult: CodeExecutionResult? = null, executableCode: ExecutableCode? = null, fileData: FileData? = null, functionCall: FunctionCall? = null, functionResponse: FunctionResponse? = null, inlineData: Blob? = null, text: String? = null, thought: Boolean? = null, thoughtSignature: ByteArray? = null, videoMetadata: VideoMetadata? = null, toolCall: ToolCall? = null, toolResponse: ToolResponse? = null, partMetadata: Map<String, JsonElement>? = null)

Properties

Link copied to clipboard

Optional. The result of executing the ExecutableCode.

Link copied to clipboard

Optional. Code generated by the model that is intended to be executed.

Link copied to clipboard
val fileData: FileData? = null

Optional. The URI-based data of the part. This can be used to include files from Google Cloud Storage.

Link copied to clipboard

Optional. A predicted function call returned from the model. This contains the name of the function to call and the arguments to pass to the function.

Link copied to clipboard

Optional. The result of a function call. This is used to provide the model with the result of a function call that it predicted.

Link copied to clipboard
val inlineData: Blob? = null

Optional. The inline data content of the part. This can be used to include images, audio, or video in a request.

Link copied to clipboard

Media resolution for the input media.

Link copied to clipboard
val partMetadata: Map<String, JsonElement>? = null

Custom metadata associated with the Part. Agents using genai.Part as content representation may need to keep track of the additional information. For example it can be name of a file/source from which the Part originates or a way to multiplex multiple Part streams. This field is not supported in Vertex AI.

Link copied to clipboard
val text: String? = null

Optional. The text content of the part. When sent from the VSCode Gemini Code Assist extension, references to @mentioned items will be converted to markdown boldface text. For example @my-repo will be converted to and sent as **my-repo** by the IDE agent.

Link copied to clipboard
val thought: Boolean? = null

Optional. Indicates whether the part represents the model's thought process or reasoning.

Link copied to clipboard

Optional. An opaque signature for the thought so it can be reused in subsequent requests.

Link copied to clipboard
val toolCall: ToolCall? = null

Server-side tool call. This field is populated when the model predicts a tool invocation that should be executed on the server. The client is expected to echo this message back to the API.

Link copied to clipboard

The output from a server-side ToolCall execution. This field is populated by the client with the results of executing the corresponding ToolCall.

Link copied to clipboard

Optional. Video metadata. The metadata should only be specified while the video data is presented in inline_data or file_data.