Content

The structured data content of a message.

AContent message contains arole field, which indicates the producer of the content, and aparts field, which contains the multi-part data of the message.

Fields
rolestring

Optional. The producer of the content. Must be either 'user' or 'model'.

If not set, the service will default to 'user'.

parts[]object (Part)

Required. A list ofPart objects that make up a single message. Parts of a message can have different MIME types.

AContent message must have at least onePart.

JSON representation
{"role":string,"parts":[{object (Part)}]}

Part

A datatype containing media that is part of a multi-partContent message.

APart consists of data which has an associated datatype. APart can only contain one of the accepted types inPart.data.

For media types that are not text,Part must have a fixed IANA MIME type identifying the type and subtype of the media ifinlineData orfileData field is filled with raw bytes.

Fields
thoughtboolean

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

thoughtSignaturestring (bytes format)

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

A base64-encoded string.

dataUnion type
data can be only one of the following:
textstring

Optional. The text content of the part.

inlineDataobject (Blob)

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

fileDataobject (FileData)

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

functionCallobject (FunctionCall)

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.

functionResponseobject (FunctionResponse)

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

executableCodeobject (ExecutableCode)

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

codeExecutionResultobject (CodeExecutionResult)

Optional. The result of executing theExecutableCode.

metadataUnion type
metadata can be only one of the following:
videoMetadataobject (VideoMetadata)

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

JSON representation
{"thought":boolean,"thoughtSignature":string,// data"text":string,"inlineData":{object (Blob)},"fileData":{object (FileData)},"functionCall":{object (FunctionCall)},"functionResponse":{object (FunctionResponse)},"executableCode":{object (ExecutableCode)},"codeExecutionResult":{object (CodeExecutionResult)}// Union type// metadata"videoMetadata":{object (VideoMetadata)}// Union type}

Blob

A content blob.

Ablob contains data of a specific media type. It is used to represent images, audio, and video.

Fields
mimeTypestring

Required. The IANA standard MIME type of the source data.

datastring (bytes format)

Required. The raw bytes of the data.

A base64-encoded string.

displayNamestring

Optional. The display name of the blob. Used to provide a label or filename to distinguish blobs.

This field is only returned inPromptMessage for prompt management. It is used in the Gemini calls only when server-side tools (codeExecution,googleSearch, andurlContext) are enabled.

JSON representation
{"mimeType":string,"data":string,"displayName":string}

FileData

URI-based data.

AFileData message contains a URI pointing to data of a specific media type. It is used to represent images, audio, and video stored in Google Cloud Storage.

Fields
mimeTypestring

Required. The IANA standard MIME type of the source data.

fileUristring

Required. The URI of the file in Google Cloud Storage.

displayNamestring

Optional. The display name of the file. Used to provide a label or filename to distinguish files.

This field is only returned inPromptMessage for prompt management. It is used in the Gemini calls only when server side tools (codeExecution,googleSearch, andurlContext) are enabled.

JSON representation
{"mimeType":string,"fileUri":string,"displayName":string}

FunctionCall

A predicted [FunctionCall] returned from the model that contains a string representing the [FunctionDeclaration.name] and a structured JSON object containing the parameters and their values.

Fields
idstring

Optional. The unique id of the function call. If populated, the client to execute thefunctionCall and return the response with the matchingid.

namestring

Optional. The name of the function to call. Matches [FunctionDeclaration.name].

argsobject (Struct format)

Optional. The function parameters and values in JSON object format. See [FunctionDeclaration.parameters] for parameter details.

willContinueboolean

Optional. Whether this is the last part of the FunctionCall. If true, another partial message for the current FunctionCall is expected to follow.

JSON representation
{"id":string,"name":string,"args":{object},"willContinue":boolean}

FunctionResponse

The result output from a [FunctionCall] that contains a string representing the [FunctionDeclaration.name] and a structured JSON object containing any output from the function is used as context to the model. This should contain the result of a [FunctionCall] made based on model prediction.

Fields
idstring

Optional. The id of the function call this response is for. Populated by the client to match the corresponding function callid.

namestring

Required. The name of the function to call. Matches [FunctionDeclaration.name] and [FunctionCall.name].

responseobject (Struct format)

Required. The function response in JSON object format. Use "output" key to specify function output and "error" key to specify error details (if any). If "output" and "error" keys are not specified, then whole "response" is treated as function output.

parts[]object (FunctionResponsePart)

Optional. OrderedParts that constitute a function response. Parts may have different IANA MIME types.

JSON representation
{"id":string,"name":string,"response":{object},"parts":[{object (FunctionResponsePart)}]}

FunctionResponsePart

A datatype containing media that is part of aFunctionResponse message.

AFunctionResponsePart consists of data which has an associated datatype. AFunctionResponsePart can only contain one of the accepted types inFunctionResponsePart.data.

AFunctionResponsePart must have a fixed IANA MIME type identifying the type and subtype of the media if theinlineData field is filled with raw bytes.

Fields
dataUnion type
The data of the function response part.data can be only one of the following:
inlineDataobject (FunctionResponseBlob)

Inline media bytes.

fileDataobject (FunctionResponseFileData)

URI based data.

JSON representation
{// data"inlineData":{object (FunctionResponseBlob)},"fileData":{object (FunctionResponseFileData)}// Union type}

FunctionResponseBlob

Raw media bytes for function response.

Text should not be sent as raw bytes, use the 'text' field.

Fields
mimeTypestring

Required. The IANA standard MIME type of the source data.

datastring (bytes format)

Required. Raw bytes.

A base64-encoded string.

displayNamestring

Optional. Display name of the blob.

Used to provide a label or filename to distinguish blobs.

This field is only returned in PromptMessage for prompt management. It is currently used in the Gemini GenerateContent calls only when server side tools (codeExecution, googleSearch, and urlContext) are enabled.

JSON representation
{"mimeType":string,"data":string,"displayName":string}

FunctionResponseFileData

URI based data for function response.

Fields
mimeTypestring

Required. The IANA standard MIME type of the source data.

fileUristring

Required. URI.

displayNamestring

Optional. Display name of the file data.

Used to provide a label or filename to distinguish file datas.

This field is only returned in PromptMessage for prompt management. It is currently used in the Gemini GenerateContent calls only when server side tools (codeExecution, googleSearch, and urlContext) are enabled.

JSON representation
{"mimeType":string,"fileUri":string,"displayName":string}

ExecutableCode

code generated by the model that is meant to be executed, and the result returned to the model.

Generated when using the [CodeExecution] tool, in which the code will be automatically executed, and a corresponding [CodeExecutionResult] will also be generated.

Fields
languageenum (Language)

Required. Programming language of thecode.

codestring

Required. The code to be executed.

JSON representation
{"language":enum (Language),"code":string}

Language

Supported programming languages for the generated code.

Enums
LANGUAGE_UNSPECIFIEDUnspecified language. This value should not be used.
PYTHONPython >= 3.10, with numpy and simpy available.

CodeExecutionResult

result of executing the [ExecutableCode].

Only generated when using the [CodeExecution] tool, and always follows apart containing the [ExecutableCode].

Fields
outcomeenum (Outcome)

Required. Outcome of the code execution.

outputstring

Optional. Contains stdout when code execution is successful, stderr or other description otherwise.

JSON representation
{"outcome":enum (Outcome),"output":string}

Outcome

Enumeration of possible outcomes of the code execution.

Enums
OUTCOME_UNSPECIFIEDUnspecified status. This value should not be used.
OUTCOME_OKcode execution completed successfully.
OUTCOME_FAILEDcode execution finished but with a failure.stderr should contain the reason.
OUTCOME_DEADLINE_EXCEEDEDcode execution ran for too long, and was cancelled. There may or may not be a partial output present.

VideoMetadata

Provides metadata for a video, including the start and end offsets for clipping and the frame rate.

Fields
startOffsetstring (Duration format)

Optional. The start offset of the video.

A duration in seconds with up to nine fractional digits, ending with 's'. Example:"3.5s".

endOffsetstring (Duration format)

Optional. The end offset of the video.

A duration in seconds with up to nine fractional digits, ending with 's'. Example:"3.5s".

fpsnumber

Optional. The frame rate of the video sent to the model. If not specified, the default value is 1.0. The valid range is (0.0, 24.0].

JSON representation
{"startOffset":string,"endOffset":string,"fps":number}

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-12-17 UTC.