Tool: generate_content
Generates content (text, image, etc.) based on a balanced prompt and given modality-specific configurations. Use this for Gemini model inference.
The following sample demonstrate how to use curl to invoke the generate_content MCP tool.
| Curl Request |
|---|
curl --location 'https://aiplatform.googleapis.com/mcp/generate' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "generate_content", "arguments": { // provide these details according to the tool's MCP specification } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
Request message for [PredictionService.GenerateContent].
GenerateContentRequest
| JSON representation |
|---|
{ "model": string, "contents": [ { object ( |
| Fields | |
|---|---|
model |
Required. The fully qualified name of the publisher model or tuned model endpoint to use. Publisher model format: Tuned model endpoint format: |
contents[] |
Required. The content of the current conversation with the model. For single-turn queries, this is a single instance. For multi-turn queries, this is a repeated field that contains conversation history + latest request. |
cachedContent |
Optional. The name of the cached content used as context to serve the prediction. Note: only used in explicit caching, where users can have control over caching (e.g. what content to cache) and enjoy guaranteed cost savings. Format: |
tools[] |
Optional. A list of A |
toolConfig |
Optional. Tool config. This config is shared for all tools provided in the request. |
labels |
Optional. The labels with user-defined metadata for the request. It is used for billing and reporting only. Label keys and values can be no longer than 63 characters (Unicode codepoints) and can only contain lowercase letters, numeric characters, underscores, and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter. An object containing a list of |
safetySettings[] |
Optional. Per request settings for blocking unsafe content. Enforced on GenerateContentResponse.candidates. |
modelArmorConfig |
Optional. Settings for prompt and response sanitization using the Model Armor service. If supplied, safety_settings must not be supplied. |
generationConfig |
Optional. Generation config. |
Union field
|
|
systemInstruction |
Optional. The user provided system instructions for the model. Note: only text should be used in parts and content in each part will be in a separate paragraph. |
Content
| JSON representation |
|---|
{
"role": string,
"parts": [
{
object ( |
| Fields | |
|---|---|
role |
Optional. The producer of the content. Must be either 'user' or 'model'. If not set, the service will default to 'user'. |
parts[] |
Required. A list of A |
Part
| JSON representation |
|---|
{ "thought": boolean, "thoughtSignature": string, "mediaResolution": { object ( |
| Fields | |
|---|---|
thought |
Optional. Indicates whether the |
thoughtSignature |
Optional. An opaque signature for the thought so it can be reused in subsequent requests. A base64-encoded string. |
mediaResolution |
per part media resolution. Media resolution for the input media. |
Union field
|
|
text |
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 |
inlineData |
Optional. The inline data content of the part. This can be used to include images, audio, or video in a request. |
fileData |
Optional. The URI-based data of the part. This can be used to include files from Google Cloud Storage. |
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. |
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. |
executableCode |
Optional. Code generated by the model that is intended to be executed. |
codeExecutionResult |
Optional. The result of executing the |
Union field
|
|
videoMetadata |
Optional. Video metadata. The metadata should only be specified while the video data is presented in inline_data or file_data. |
Blob
| JSON representation |
|---|
{ "mimeType": string, "data": string, "displayName": string } |
| Fields | |
|---|---|
mimeType |
Required. The IANA standard MIME type of the source data. |
data |
Required. The raw bytes of the data. A base64-encoded string. |
displayName |
Optional. The display name of the blob. Used to provide a label or filename to distinguish blobs. This field is only returned in |
FileData
| JSON representation |
|---|
{ "mimeType": string, "fileUri": string, "displayName": string } |
| Fields | |
|---|---|
mimeType |
Required. The IANA standard MIME type of the source data. |
fileUri |
Required. The URI of the file in Google Cloud Storage. |
displayName |
Optional. The display name of the file. Used to provide a label or filename to distinguish files. This field is only returned in |
FunctionCall
| JSON representation |
|---|
{
"id": string,
"name": string,
"args": {
object
},
"partialArgs": [
{
object ( |
| Fields | |
|---|---|
id |
Optional. The unique id of the function call. If populated, the client to execute the |
name |
Optional. The name of the function to call. Matches |
args |
Optional. The function parameters and values in JSON object format. See |
partialArgs[] |
Optional. The partial argument value of the function call. If provided, represents the arguments/fields that are streamed incrementally. |
willContinue |
Optional. Whether this is the last part of the FunctionCall. If true, another partial message for the current FunctionCall is expected to follow. |
Struct
| JSON representation |
|---|
{ "fields": { string: value, ... } } |
| Fields | |
|---|---|
fields |
Unordered map of dynamically typed values. An object containing a list of |
FieldsEntry
| JSON representation |
|---|
{ "key": string, "value": value } |
| Fields | |
|---|---|
key |
|
value |
|
Value
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field kind. The kind of value. kind can be only one of the following: |
|
nullValue |
Represents a JSON |
numberValue |
Represents a JSON number. Must not be |
stringValue |
Represents a JSON string. |
boolValue |
Represents a JSON boolean ( |
structValue |
Represents a JSON object. |
listValue |
Represents a JSON array. |
ListValue
| JSON representation |
|---|
{ "values": [ value ] } |
| Fields | |
|---|---|
values[] |
Repeated field of dynamically typed values. |
PartialArg
| JSON representation |
|---|
{ "jsonPath": string, "willContinue": boolean, // Union field |
| Fields | |
|---|---|
jsonPath |
Required. A JSON Path (RFC 9535) to the argument being streamed. https://datatracker.ietf.org/doc/html/rfc9535. e.g. "$.foo.bar[0].data". |
willContinue |
Optional. Whether this is not the last part of the same json_path. If true, another PartialArg message for the current json_path is expected to follow. |
Union field delta. The delta of field value being streamed. delta can be only one of the following: |
|
nullValue |
Optional. Represents a null value. |
numberValue |
Optional. Represents a double value. |
stringValue |
Optional. Represents a string value. |
boolValue |
Optional. Represents a boolean value. |
FunctionResponse
| JSON representation |
|---|
{
"id": string,
"name": string,
"response": {
object
},
"parts": [
{
object ( |
| Fields | |
|---|---|
id |
Optional. The id of the function call this response is for. Populated by the client to match the corresponding function call |
name |
Required. The name of the function to call. Matches |
response |
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[] |
Optional. Ordered |
FunctionResponsePart
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field data. The data of the function response part. data can be only one of the following: |
|
inlineData |
Inline media bytes. |
fileData |
URI based data. |
FunctionResponseBlob
| JSON representation |
|---|
{ "mimeType": string, "data": string, "displayName": string } |
| Fields | |
|---|---|
mimeType |
Required. The IANA standard MIME type of the source data. |
data |
Required. Raw bytes. A base64-encoded string. |
displayName |
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 (code_execution, google_search, and url_context) are enabled. |
FunctionResponseFileData
| JSON representation |
|---|
{ "mimeType": string, "fileUri": string, "displayName": string } |
| Fields | |
|---|---|
mimeType |
Required. The IANA standard MIME type of the source data. |
fileUri |
Required. URI. |
displayName |
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 (code_execution, google_search, and url_context) are enabled. |
ExecutableCode
| JSON representation |
|---|
{
"language": enum ( |
| Fields | |
|---|---|
language |
Required. Programming language of the |
code |
Required. The code to be executed. |
CodeExecutionResult
| JSON representation |
|---|
{
"outcome": enum ( |
| Fields | |
|---|---|
outcome |
Required. Outcome of the code execution. |
output |
Optional. Contains stdout when code execution is successful, stderr or other description otherwise. |
VideoMetadata
| JSON representation |
|---|
{ "startOffset": string, "endOffset": string, "fps": number } |
| Fields | |
|---|---|
startOffset |
Optional. The start offset of the video. A duration in seconds with up to nine fractional digits, ending with ' |
endOffset |
Optional. The end offset of the video. A duration in seconds with up to nine fractional digits, ending with ' |
fps |
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]. |
Duration
| JSON representation |
|---|
{ "seconds": string, "nanos": integer } |
| Fields | |
|---|---|
seconds |
Signed seconds of the span of time. Must be from -315,576,000,000 to +315,576,000,000 inclusive. Note: these bounds are computed from: 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years |
nanos |
Signed fractions of a second at nanosecond resolution of the span of time. Durations less than one second are represented with a 0 |
MediaResolution
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field
|
|
level |
The tokenization quality used for given media. |
Tool
| JSON representation |
|---|
{ "functionDeclarations": [ { object ( |
| Fields | |
|---|---|
functionDeclarations[] |
Optional. Function tool type. One or more function declarations to be passed to the model along with the current user query. Model may decide to call a subset of these functions by populating |
retrieval |
Optional. Retrieval tool type. System will always execute the provided retrieval tool(s) to get external knowledge to answer the prompt. Retrieval results are presented to the model for generation. |
googleSearch |
Optional. GoogleSearch tool type. Tool to support Google Search in Model. Powered by Google. |
googleSearchRetrieval |
Optional. Specialized retrieval tool that is powered by Google Search. |
googleMaps |
Optional. GoogleMaps tool type. Tool to support Google Maps in Model. |
enterpriseWebSearch |
Optional. Tool to support searching public web data, powered by Vertex AI Search and Sec4 compliance. |
codeExecution |
Optional. CodeExecution tool type. Enables the model to execute code as part of generation. |
urlContext |
Optional. Tool to support URL context retrieval. |
computerUse |
Optional. Tool to support the model interacting directly with the computer. If enabled, it automatically populates computer-use specific Function Declarations. |
FunctionDeclaration
| JSON representation |
|---|
{ "name": string, "description": string, "parameters": { object ( |
| Fields | |
|---|---|
name |
Required. The name of the function to call. Must start with a letter or an underscore. Must be a-z, A-Z, 0-9, or contain underscores, dots, colons and dashes, with a maximum length of 128. |
description |
Optional. Description and purpose of the function. Model uses it to decide how and whether to call the function. |
parameters |
Optional. Describes the parameters to this function in JSON Schema Object format. Reflects the Open API 3.03 Parameter Object. string Key: the name of the parameter. Parameter names are case sensitive. Schema Value: the Schema defining the type used for the parameter. For function with no parameters, this can be left unset. Parameter names must start with a letter or an underscore and must only contain chars a-z, A-Z, 0-9, or underscores with a maximum length of 64. Example with 1 required and 1 optional parameter: type: OBJECT properties: param1: type: STRING param2: type: INTEGER required: - param1 |
parametersJsonSchema |
Optional. Describes the parameters to the function in JSON Schema format. The schema must describe an object where the properties are the parameters to the function. For example: This field is mutually exclusive with |
response |
Optional. Describes the output from this function in JSON Schema format. Reflects the Open API 3.03 Response Object. The Schema defines the type used for the response value of the function. |
responseJsonSchema |
Optional. Describes the output from this function in JSON Schema format. The value specified by the schema is the response value of the function. This field is mutually exclusive with |
Schema
| JSON representation |
|---|
{ "type": enum ( |
| Fields | |
|---|---|
type |
Optional. Data type of the schema field. |
format |
Optional. The format of the data. For |
title |
Optional. Title for the schema. |
description |
Optional. Describes the data. The model uses this field to understand the purpose of the schema and how to use it. It is a best practice to provide a clear and descriptive explanation for the schema and its properties here, rather than in the prompt. |
nullable |
Optional. Indicates if the value of this field can be null. |
default |
Optional. Default value to use if the field is not specified. |
items |
Optional. If type is |
minItems |
Optional. If type is |
maxItems |
Optional. If type is |
enum[] |
Optional. Possible values of the field. This field can be used to restrict a value to a fixed set of values. To mark a field as an enum, set |
properties |
Optional. If type is An object containing a list of |
propertyOrdering[] |
Optional. Order of properties displayed or used where order matters. This is not a standard field in OpenAPI specification, but can be used to control the order of properties. |
required[] |
Optional. If type is |
minProperties |
Optional. If type is |
maxProperties |
Optional. If type is |
minimum |
Optional. If type is |
maximum |
Optional. If type is |
minLength |
Optional. If type is |
maxLength |
Optional. If type is |
pattern |
Optional. If type is |
example |
Optional. Example of an instance of this schema. |
anyOf[] |
Optional. The instance must be valid against any (one or more) of the subschemas listed in |
additionalProperties |
Optional. If |
ref |
Optional. Allows referencing another schema definition to use in place of this schema. The value must be a valid reference to a schema in For example, the following schema defines a reference to a schema node named "Pet": type: object properties: pet: ref: #/defs/Pet defs: Pet: type: object properties: name: type: string The value of the "pet" property is a reference to the schema node named "Pet". See details in https://json-schema.org/understanding-json-schema/structuring |
defs |
Optional. An object containing a list of |
PropertiesEntry
| JSON representation |
|---|
{
"key": string,
"value": {
object ( |
| Fields | |
|---|---|
key |
|
value |
|
DefsEntry
| JSON representation |
|---|
{
"key": string,
"value": {
object ( |
| Fields | |
|---|---|
key |
|
value |
|
Retrieval
| JSON representation |
|---|
{ "disableAttribution": boolean, // Union field |
| Fields | |
|---|---|
disableAttribution |
Optional. Deprecated. This option is no longer supported. |
Union field source. The source of the retrieval. source can be only one of the following: |
|
vertexAiSearch |
Set to use data source powered by Vertex AI Search. |
vertexRagStore |
Set to use data source powered by Vertex RAG store. User data is uploaded via the VertexRagDataService. |
VertexAISearch
| JSON representation |
|---|
{
"datastore": string,
"engine": string,
"maxResults": integer,
"filter": string,
"dataStoreSpecs": [
{
object ( |
| Fields | |
|---|---|
datastore |
Optional. Fully-qualified Vertex AI Search data store resource ID. Format: |
engine |
Optional. Fully-qualified Vertex AI Search engine resource ID. Format: |
maxResults |
Optional. Number of search results to return per query. The default value is 10. The maximumm allowed value is 10. |
filter |
Optional. Filter strings to be passed to the search API. |
dataStoreSpecs[] |
Specifications that define the specific DataStores to be searched, along with configurations for those data stores. This is only considered for Engines with multiple data stores. It should only be set if engine is used. |
DataStoreSpec
| JSON representation |
|---|
{ "dataStore": string, "filter": string } |
| Fields | |
|---|---|
dataStore |
Full resource name of DataStore, such as Format: |
filter |
Optional. Filter specification to filter documents in the data store specified by data_store field. For more information on filtering, see Filtering |
VertexRagStore
| JSON representation |
|---|
{ "ragCorpora": [ string ], "ragResources": [ { object ( |
| Fields | |
|---|---|
ragCorpora[] |
Optional. Deprecated. Please use rag_resources instead. |
ragResources[] |
Optional. The representation of the rag source. It can be used to specify corpus only or ragfiles. Currently only support one corpus or multiple files from one corpus. In the future we may open up multiple corpora support. |
ragRetrievalConfig |
Optional. The retrieval config for the Rag query. |
storeContext |
Optional. Currently only supported for Gemini Multimodal Live API. In Gemini Multimodal Live API, if |
Union field
|
|
similarityTopK |
Optional. Number of top k results to return from the selected corpora. |
Union field
|
|
vectorDistanceThreshold |
Optional. Only return results with vector distance smaller than the threshold. |
RagResource
| JSON representation |
|---|
{ "ragCorpus": string, "ragFileIds": [ string ] } |
| Fields | |
|---|---|
ragCorpus |
Optional. RagCorpora resource name. Format: |
ragFileIds[] |
Optional. rag_file_id. The files should be in the same rag_corpus set in rag_corpus field. |
RagRetrievalConfig
| JSON representation |
|---|
{ "topK": integer, "hybridSearch": { object ( |
| Fields | |
|---|---|
topK |
Optional. The number of contexts to retrieve. |
hybridSearch |
Optional. Config for Hybrid Search. |
filter |
Optional. Config for filters. |
ranking |
Optional. Config for ranking and reranking. |
HybridSearch
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field
|
|
alpha |
Optional. Alpha value controls the weight between dense and sparse vector search results. The range is [0, 1], while 0 means sparse vector search only and 1 means dense vector search only. The default value is 0.5 which balances sparse and dense vector search equally. |
Filter
| JSON representation |
|---|
{ "metadataFilter": string, // Union field |
| Fields | |
|---|---|
metadataFilter |
Optional. String for metadata filtering. |
Union field vector_db_threshold. Filter contexts retrieved from the vector DB based on either vector distance or vector similarity. vector_db_threshold can be only one of the following: |
|
vectorDistanceThreshold |
Optional. Only returns contexts with vector distance smaller than the threshold. |
vectorSimilarityThreshold |
Optional. Only returns contexts with vector similarity larger than the threshold. |
Ranking
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field ranking_config. Config options for ranking. Currently only Rank Service is supported. ranking_config can be only one of the following: |
|
rankService |
Optional. Config for Rank Service. |
llmRanker |
Optional. Config for LlmRanker. |
RankService
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field
|
|
modelName |
Optional. The model name of the rank service. Format: |
LlmRanker
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field
|
|
modelName |
Optional. The model name used for ranking. See Supported models. |
GoogleSearch
| JSON representation |
|---|
{ "excludeDomains": [ string ], // Union field |
| Fields | |
|---|---|
excludeDomains[] |
Optional. List of domains to be excluded from the search results. The default limit is 2000 domains. Example: ["amazon.com", "facebook.com"]. |
Union field
|
|
blockingConfidence |
Optional. Sites with confidence level chosen & above this value will be blocked from the search results. |
GoogleSearchRetrieval
| JSON representation |
|---|
{
"dynamicRetrievalConfig": {
object ( |
| Fields | |
|---|---|
dynamicRetrievalConfig |
Specifies the dynamic retrieval configuration for the given source. |
DynamicRetrievalConfig
| JSON representation |
|---|
{ "mode": enum ( |
| Fields | |
|---|---|
mode |
The mode of the predictor to be used in dynamic retrieval. |
Union field
|
|
dynamicThreshold |
Optional. The threshold to be used in dynamic retrieval. If not set, a system default value is used. |
GoogleMaps
| JSON representation |
|---|
{ "enableWidget": boolean } |
| Fields | |
|---|---|
enableWidget |
Optional. If true, include the widget context token in the response. |
EnterpriseWebSearch
| JSON representation |
|---|
{ "excludeDomains": [ string ], // Union field |
| Fields | |
|---|---|
excludeDomains[] |
Optional. List of domains to be excluded from the search results. The default limit is 2000 domains. |
Union field
|
|
blockingConfidence |
Optional. Sites with confidence level chosen & above this value will be blocked from the search results. |
ComputerUse
| JSON representation |
|---|
{
"environment": enum ( |
| Fields | |
|---|---|
environment |
Required. The environment being operated. |
excludedPredefinedFunctions[] |
Optional. By default, predefined functions are included in the final model call. Some of them can be explicitly excluded from being automatically included. This can serve two purposes: 1. Using a more restricted / different action space. 2. Improving the definitions / instructions of predefined functions. |
ToolConfig
| JSON representation |
|---|
{ "functionCallingConfig": { object ( |
| Fields | |
|---|---|
functionCallingConfig |
Optional. Function calling config. |
retrievalConfig |
Optional. Retrieval config. |
FunctionCallingConfig
| JSON representation |
|---|
{
"mode": enum ( |
| Fields | |
|---|---|
mode |
Optional. Function calling mode. |
allowedFunctionNames[] |
Optional. Function names to call. Only set when the Mode is ANY. Function names should match |
streamFunctionCallArguments |
Optional. When set to true, arguments of a single function call will be streamed out in multiple parts/contents/responses. Partial parameter results will be returned in the |
RetrievalConfig
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field
|
|
latLng |
The location of the user. |
Union field
|
|
languageCode |
The language code of the user. |
LatLng
| JSON representation |
|---|
{ "latitude": number, "longitude": number } |
| Fields | |
|---|---|
latitude |
The latitude in degrees. It must be in the range [-90.0, +90.0]. |
longitude |
The longitude in degrees. It must be in the range [-180.0, +180.0]. |
LabelsEntry
| JSON representation |
|---|
{ "key": string, "value": string } |
| Fields | |
|---|---|
key |
|
value |
|
SafetySetting
| JSON representation |
|---|
{ "category": enum ( |
| Fields | |
|---|---|
category |
Required. The harm category to be blocked. |
threshold |
Required. The threshold for blocking content. If the harm probability exceeds this threshold, the content will be blocked. |
method |
Optional. The method for blocking content. If not specified, the default behavior is to use the probability score. |
ModelArmorConfig
| JSON representation |
|---|
{ "promptTemplateName": string, "responseTemplateName": string } |
| Fields | |
|---|---|
promptTemplateName |
Optional. The resource name of the Model Armor template to use for prompt screening. A Model Armor template is a set of customized filters and thresholds that define how Model Armor screens content. If specified, Model Armor will use this template to check the user's prompt for safety and security risks before it is sent to the model. The name must be in the format |
responseTemplateName |
Optional. The resource name of the Model Armor template to use for response screening. A Model Armor template is a set of customized filters and thresholds that define how Model Armor screens content. If specified, Model Armor will use this template to check the model's response for safety and security risks before it is returned to the user. The name must be in the format |
GenerationConfig
| JSON representation |
|---|
{ "stopSequences": [ string ], "responseMimeType": string, "responseModalities": [ enum ( |
| Fields | |
|---|---|
stopSequences[] |
Optional. A list of character sequences that will stop the model from generating further tokens. If a stop sequence is generated, the output will end at that point. This is useful for controlling the length and structure of the output. For example, you can use ["\n", "###"] to stop generation at a new line or a specific marker. |
responseMimeType |
Optional. The IANA standard MIME type of the response. The model will generate output that conforms to this MIME type. Supported values include 'text/plain' (default) and 'application/json'. The model needs to be prompted to output the appropriate response type, otherwise the behavior is undefined. |
responseModalities[] |
Optional. The modalities of the response. The model will generate a response that includes all the specified modalities. For example, if this is set to |
thinkingConfig |
Optional. Configuration for thinking features. An error will be returned if this field is set for models that don't support thinking. |
modelConfig |
Optional. Config for model selection. |
Union field
|
|
temperature |
Optional. Controls the randomness of the output. A higher temperature results in more creative and diverse responses, while a lower temperature makes the output more predictable and focused. The valid range is (0.0, 2.0]. |
Union field
|
|
topP |
Optional. Specifies the nucleus sampling threshold. The model considers only the smallest set of tokens whose cumulative probability is at least |
Union field
|
|
topK |
Optional. Specifies the top-k sampling threshold. The model considers only the top k most probable tokens for the next token. This can be useful for generating more coherent and less random text. For example, a |
Union field
|
|
candidateCount |
Optional. The number of candidate responses to generate. A higher |
Union field
|
|
maxOutputTokens |
Optional. The maximum number of tokens to generate in the response. A token is approximately four characters. The default value varies by model. This parameter can be used to control the length of the generated text and prevent overly long responses. |
Union field
|
|
responseLogprobs |
Optional. If set to true, the log probabilities of the output tokens are returned. Log probabilities are the logarithm of the probability of a token appearing in the output. A higher log probability means the token is more likely to be generated. This can be useful for analyzing the model's confidence in its own output and for debugging. |
Union field
|
|
logprobs |
Optional. The number of top log probabilities to return for each token. This can be used to see which other tokens were considered likely candidates for a given position. A higher value will return more options, but it will also increase the size of the response. |
Union field
|
|
presencePenalty |
Optional. Penalizes tokens that have already appeared in the generated text. A positive value encourages the model to generate more diverse and less repetitive text. Valid values can range from [-2.0, 2.0]. |
Union field
|
|
frequencyPenalty |
Optional. Penalizes tokens based on their frequency in the generated text. A positive value helps to reduce the repetition of words and phrases. Valid values can range from [-2.0, 2.0]. |
Union field
|
|
seed |
Optional. A seed for the random number generator. By setting a seed, you can make the model's output mostly deterministic. For a given prompt and parameters (like temperature, top_p, etc.), the model will produce the same response every time. However, it's not a guaranteed absolute deterministic behavior. This is different from parameters like |
Union field
|
|
responseSchema |
Optional. Lets you to specify a schema for the model's response, ensuring that the output conforms to a particular structure. This is useful for generating structured data such as JSON. The schema is a subset of the OpenAPI 3.0 schema object object. When this field is set, you must also set the |
Union field
|
|
responseJsonSchema |
Optional. When this field is set, |
Union field
|
|
routingConfig |
Optional. Routing configuration. |
Union field
|
|
audioTimestamp |
Optional. If enabled, audio timestamps will be included in the request to the model. This can be useful for synchronizing audio with other modalities in the response. |
Union field
|
|
mediaResolution |
Optional. The token resolution at which input media content is sampled. This is used to control the trade-off between the quality of the response and the number of tokens used to represent the media. A higher resolution allows the model to perceive more detail, which can lead to a more nuanced response, but it will also use more tokens. This does not affect the image dimensions sent to the model. |
Union field
|
|
speechConfig |
Optional. The speech generation config. |
Union field
|
|
enableAffectiveDialog |
Optional. If enabled, the model will detect emotions and adapt its responses accordingly. For example, if the model detects that the user is frustrated, it may provide a more empathetic response. |
Union field
|
|
imageConfig |
Optional. Config for image generation features. |
RoutingConfig
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field routing_config. The routing mode for the request. routing_config can be only one of the following: |
|
autoMode |
In this mode, the model is selected automatically based on the content of the request. |
manualMode |
In this mode, the model is specified manually. |
AutoRoutingMode
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field
|
|
modelRoutingPreference |
The model routing preference. |
ManualRoutingMode
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field
|
|
modelName |
The name of the model to use. Only public LLM models are accepted. |
SpeechConfig
| JSON representation |
|---|
{ "voiceConfig": { object ( |
| Fields | |
|---|---|
voiceConfig |
The configuration for the voice to use. |
languageCode |
Optional. The language code (ISO 639-1) for the speech synthesis. |
multiSpeakerVoiceConfig |
The configuration for a multi-speaker text-to-speech request. This field is mutually exclusive with |
VoiceConfig
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field voice_config. The configuration for the speaker to use. voice_config can be only one of the following: |
|
prebuiltVoiceConfig |
The configuration for a prebuilt voice. |
replicatedVoiceConfig |
Optional. The configuration for a replicated voice. This enables users to replicate a voice from an audio sample. |
PrebuiltVoiceConfig
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field
|
|
voiceName |
The name of the prebuilt voice to use. |
ReplicatedVoiceConfig
| JSON representation |
|---|
{ "mimeType": string, "voiceSampleAudio": string } |
| Fields | |
|---|---|
mimeType |
Optional. The mimetype of the voice sample. The only currently supported value is |
voiceSampleAudio |
Optional. The sample of the custom voice. A base64-encoded string. |
MultiSpeakerVoiceConfig
| JSON representation |
|---|
{
"speakerVoiceConfigs": [
{
object ( |
| Fields | |
|---|---|
speakerVoiceConfigs[] |
Required. A list of configurations for the voices of the speakers. Exactly two speaker voice configurations must be provided. |
SpeakerVoiceConfig
| JSON representation |
|---|
{
"speaker": string,
"voiceConfig": {
object ( |
| Fields | |
|---|---|
speaker |
Required. The name of the speaker. This should be the same as the speaker name used in the prompt. |
voiceConfig |
Required. The configuration for the voice of this speaker. |
ThinkingConfig
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field
|
|
includeThoughts |
Optional. If true, the model will include its thoughts in the response. "Thoughts" are the intermediate steps the model takes to arrive at the final response. They can provide insights into the model's reasoning process and help with debugging. If this is true, thoughts are returned only when available. |
Union field
|
|
thinkingBudget |
Optional. The token budget for the model's thinking process. The model will make a best effort to stay within this budget. This can be used to control the trade-off between response quality and latency. |
Union field
|
|
thinkingLevel |
Optional. The number of thoughts tokens that the model should generate. |
ModelConfig
| JSON representation |
|---|
{
"featureSelectionPreference": enum ( |
| Fields | |
|---|---|
featureSelectionPreference |
Required. Feature selection preference. |
ImageConfig
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field
|
|
imageOutputOptions |
Optional. The image output format for generated images. |
Union field
|
|
aspectRatio |
Optional. The desired aspect ratio for the generated images. The following aspect ratios are supported: "1:1" "2:3", "3:2" "3:4", "4:3" "4:5", "5:4" "9:16", "16:9" "21:9" |
Union field
|
|
personGeneration |
Optional. Controls whether the model can generate people. |
Union field
|
|
imageSize |
Optional. Specifies the size of generated images. Supported values are |
ImageOutputOptions
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field
|
|
mimeType |
Optional. The image format that the output should be saved as. |
Union field
|
|
compressionQuality |
Optional. The compression quality of the output image. |
Output Schema
Response message for [PredictionService.GenerateContent].
GenerateContentResponse
| JSON representation |
|---|
{ "candidates": [ { object ( |
| Fields | |
|---|---|
candidates[] |
Output only. Generated candidates. |
modelVersion |
Output only. The model version used to generate the response. |
createTime |
Output only. Timestamp when the request is made to the server. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
responseId |
Output only. response_id is used to identify each response. It is the encoding of the event_id. |
promptFeedback |
Output only. Content filter results for a prompt sent in the request. Note: Sent only in the first stream chunk. Only happens when no candidates were generated due to content violations. |
usageMetadata |
Usage metadata about the response(s). |
Candidate
| JSON representation |
|---|
{ "index": integer, "content": { object ( |
| Fields | |
|---|---|
index |
Output only. The 0-based index of this candidate in the list of generated responses. This is useful for distinguishing between multiple candidates when |
content |
Output only. The content of the candidate. |
avgLogprobs |
Output only. The average log probability of the tokens in this candidate. This is a length-normalized score that can be used to compare the quality of candidates of different lengths. A higher average log probability suggests a more confident and coherent response. |
logprobsResult |
Output only. The detailed log probability information for the tokens in this candidate. This is useful for debugging, understanding model uncertainty, and identifying potential "hallucinations". |
finishReason |
Output only. The reason why the model stopped generating tokens. If empty, the model has not stopped generating. |
safetyRatings[] |
Output only. A list of ratings for the safety of a response candidate. There is at most one rating per category. |
citationMetadata |
Output only. A collection of citations that apply to the generated content. |
groundingMetadata |
Output only. Metadata returned when grounding is enabled. It contains the sources used to ground the generated content. |
urlContextMetadata |
Output only. Metadata returned when the model uses the |
Union field
|
|
finishMessage |
Output only. Describes the reason the model stopped generating tokens in more detail. This field is returned only when |
Content
| JSON representation |
|---|
{
"role": string,
"parts": [
{
object ( |
| Fields | |
|---|---|
role |
Optional. The producer of the content. Must be either 'user' or 'model'. If not set, the service will default to 'user'. |
parts[] |
Required. A list of A |
Part
| JSON representation |
|---|
{ "thought": boolean, "thoughtSignature": string, "mediaResolution": { object ( |
| Fields | |
|---|---|
thought |
Optional. Indicates whether the |
thoughtSignature |
Optional. An opaque signature for the thought so it can be reused in subsequent requests. A base64-encoded string. |
mediaResolution |
per part media resolution. Media resolution for the input media. |
Union field
|
|
text |
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 |
inlineData |
Optional. The inline data content of the part. This can be used to include images, audio, or video in a request. |
fileData |
Optional. The URI-based data of the part. This can be used to include files from Google Cloud Storage. |
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. |
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. |
executableCode |
Optional. Code generated by the model that is intended to be executed. |
codeExecutionResult |
Optional. The result of executing the |
Union field
|
|
videoMetadata |
Optional. Video metadata. The metadata should only be specified while the video data is presented in inline_data or file_data. |
Blob
| JSON representation |
|---|
{ "mimeType": string, "data": string, "displayName": string } |
| Fields | |
|---|---|
mimeType |
Required. The IANA standard MIME type of the source data. |
data |
Required. The raw bytes of the data. A base64-encoded string. |
displayName |
Optional. The display name of the blob. Used to provide a label or filename to distinguish blobs. This field is only returned in |
FileData
| JSON representation |
|---|
{ "mimeType": string, "fileUri": string, "displayName": string } |
| Fields | |
|---|---|
mimeType |
Required. The IANA standard MIME type of the source data. |
fileUri |
Required. The URI of the file in Google Cloud Storage. |
displayName |
Optional. The display name of the file. Used to provide a label or filename to distinguish files. This field is only returned in |
FunctionCall
| JSON representation |
|---|
{
"id": string,
"name": string,
"args": {
object
},
"partialArgs": [
{
object ( |
| Fields | |
|---|---|
id |
Optional. The unique id of the function call. If populated, the client to execute the |
name |
Optional. The name of the function to call. Matches |
args |
Optional. The function parameters and values in JSON object format. See |
partialArgs[] |
Optional. The partial argument value of the function call. If provided, represents the arguments/fields that are streamed incrementally. |
willContinue |
Optional. Whether this is the last part of the FunctionCall. If true, another partial message for the current FunctionCall is expected to follow. |
Struct
| JSON representation |
|---|
{ "fields": { string: value, ... } } |
| Fields | |
|---|---|
fields |
Unordered map of dynamically typed values. An object containing a list of |
FieldsEntry
| JSON representation |
|---|
{ "key": string, "value": value } |
| Fields | |
|---|---|
key |
|
value |
|
Value
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field kind. The kind of value. kind can be only one of the following: |
|
nullValue |
Represents a JSON |
numberValue |
Represents a JSON number. Must not be |
stringValue |
Represents a JSON string. |
boolValue |
Represents a JSON boolean ( |
structValue |
Represents a JSON object. |
listValue |
Represents a JSON array. |
ListValue
| JSON representation |
|---|
{ "values": [ value ] } |
| Fields | |
|---|---|
values[] |
Repeated field of dynamically typed values. |
PartialArg
| JSON representation |
|---|
{ "jsonPath": string, "willContinue": boolean, // Union field |
| Fields | |
|---|---|
jsonPath |
Required. A JSON Path (RFC 9535) to the argument being streamed. https://datatracker.ietf.org/doc/html/rfc9535. e.g. "$.foo.bar[0].data". |
willContinue |
Optional. Whether this is not the last part of the same json_path. If true, another PartialArg message for the current json_path is expected to follow. |
Union field delta. The delta of field value being streamed. delta can be only one of the following: |
|
nullValue |
Optional. Represents a null value. |
numberValue |
Optional. Represents a double value. |
stringValue |
Optional. Represents a string value. |
boolValue |
Optional. Represents a boolean value. |
FunctionResponse
| JSON representation |
|---|
{
"id": string,
"name": string,
"response": {
object
},
"parts": [
{
object ( |
| Fields | |
|---|---|
id |
Optional. The id of the function call this response is for. Populated by the client to match the corresponding function call |
name |
Required. The name of the function to call. Matches |
response |
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[] |
Optional. Ordered |
FunctionResponsePart
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field data. The data of the function response part. data can be only one of the following: |
|
inlineData |
Inline media bytes. |
fileData |
URI based data. |
FunctionResponseBlob
| JSON representation |
|---|
{ "mimeType": string, "data": string, "displayName": string } |
| Fields | |
|---|---|
mimeType |
Required. The IANA standard MIME type of the source data. |
data |
Required. Raw bytes. A base64-encoded string. |
displayName |
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 (code_execution, google_search, and url_context) are enabled. |
FunctionResponseFileData
| JSON representation |
|---|
{ "mimeType": string, "fileUri": string, "displayName": string } |
| Fields | |
|---|---|
mimeType |
Required. The IANA standard MIME type of the source data. |
fileUri |
Required. URI. |
displayName |
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 (code_execution, google_search, and url_context) are enabled. |
ExecutableCode
| JSON representation |
|---|
{
"language": enum ( |
| Fields | |
|---|---|
language |
Required. Programming language of the |
code |
Required. The code to be executed. |
CodeExecutionResult
| JSON representation |
|---|
{
"outcome": enum ( |
| Fields | |
|---|---|
outcome |
Required. Outcome of the code execution. |
output |
Optional. Contains stdout when code execution is successful, stderr or other description otherwise. |
VideoMetadata
| JSON representation |
|---|
{ "startOffset": string, "endOffset": string, "fps": number } |
| Fields | |
|---|---|
startOffset |
Optional. The start offset of the video. A duration in seconds with up to nine fractional digits, ending with ' |
endOffset |
Optional. The end offset of the video. A duration in seconds with up to nine fractional digits, ending with ' |
fps |
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]. |
Duration
| JSON representation |
|---|
{ "seconds": string, "nanos": integer } |
| Fields | |
|---|---|
seconds |
Signed seconds of the span of time. Must be from -315,576,000,000 to +315,576,000,000 inclusive. Note: these bounds are computed from: 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years |
nanos |
Signed fractions of a second at nanosecond resolution of the span of time. Durations less than one second are represented with a 0 |
MediaResolution
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field
|
|
level |
The tokenization quality used for given media. |
LogprobsResult
| JSON representation |
|---|
{ "topCandidates": [ { object ( |
| Fields | |
|---|---|
topCandidates[] |
A list of the top candidate tokens at each decoding step. The length of this list is equal to the total number of decoding steps. |
chosenCandidates[] |
A list of the chosen candidate tokens at each decoding step. The length of this list is equal to the total number of decoding steps. Note that the chosen candidate might not be in |
TopCandidates
| JSON representation |
|---|
{
"candidates": [
{
object ( |
| Fields | |
|---|---|
candidates[] |
The list of candidate tokens, sorted by log probability in descending order. |
Candidate
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field
|
|
token |
The token's string representation. |
Union field
|
|
tokenId |
The token's numerical ID. While the |
Union field
|
|
logProbability |
The log probability of this token. A higher value indicates that the model was more confident in this token. The log probability can be used to assess the relative likelihood of different tokens and to identify when the model is uncertain. |
SafetyRating
| JSON representation |
|---|
{ "category": enum ( |
| Fields | |
|---|---|
category |
Output only. The harm category of this rating. |
probability |
Output only. The probability of harm for this category. |
probabilityScore |
Output only. The probability score of harm for this category. |
severity |
Output only. The severity of harm for this category. |
severityScore |
Output only. The severity score of harm for this category. |
blocked |
Output only. Indicates whether the content was blocked because of this rating. |
overwrittenThreshold |
Output only. The overwritten threshold for the safety category of Gemini 2.0 image out. If minors are detected in the output image, the threshold of each safety category will be overwritten if user sets a lower threshold. |
CitationMetadata
| JSON representation |
|---|
{
"citations": [
{
object ( |
| Fields | |
|---|---|
citations[] |
Output only. A list of citations for the content. |
Citation
| JSON representation |
|---|
{
"startIndex": integer,
"endIndex": integer,
"uri": string,
"title": string,
"license": string,
"publicationDate": {
object ( |
| Fields | |
|---|---|
startIndex |
Output only. The start index of the citation in the content. |
endIndex |
Output only. The end index of the citation in the content. |
uri |
Output only. The URI of the source of the citation. |
title |
Output only. The title of the source of the citation. |
license |
Output only. The license of the source of the citation. |
publicationDate |
Output only. The publication date of the source of the citation. |
Date
| JSON representation |
|---|
{ "year": integer, "month": integer, "day": integer } |
| Fields | |
|---|---|
year |
Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year. |
month |
Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day. |
day |
Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant. |
GroundingMetadata
| JSON representation |
|---|
{ "webSearchQueries": [ string ], "imageSearchQueries": [ string ], "retrievalQueries": [ string ], "groundingChunks": [ { object ( |
| Fields | |
|---|---|
webSearchQueries[] |
Optional. The web search queries that were used to generate the content. This field is populated only when the grounding source is Google Search. |
imageSearchQueries[] |
Optional. The image search queries that were used to generate the content. This field is populated only when the grounding source is Google Search with the Image Search search_type enabled. |
retrievalQueries[] |
Optional. The queries that were executed by the retrieval tools. This field is populated only when the grounding source is a retrieval tool, such as Vertex AI Search. |
groundingChunks[] |
A list of supporting references retrieved from the grounding source. This field is populated when the grounding source is Google Search, Vertex AI Search, or Google Maps. |
groundingSupports[] |
Optional. A list of grounding supports that connect the generated content to the grounding chunks. This field is populated when the grounding source is Google Search or Vertex AI Search. |
sourceFlaggingUris[] |
Optional. Output only. A list of URIs that can be used to flag a place or review for inappropriate content. This field is populated only when the grounding source is Google Maps. |
Union field
|
|
searchEntryPoint |
Optional. A web search entry point that can be used to display search results. This field is populated only when the grounding source is Google Search. |
Union field
|
|
retrievalMetadata |
Optional. Output only. Metadata related to the retrieval grounding source. |
Union field
|
|
googleMapsWidgetContextToken |
Optional. Output only. A token that can be used to render a Google Maps widget with the contextual data. This field is populated only when the grounding source is Google Maps. |
SearchEntryPoint
| JSON representation |
|---|
{ "renderedContent": string, "sdkBlob": string } |
| Fields | |
|---|---|
renderedContent |
Optional. An HTML snippet that can be embedded in a web page or an application's webview. This snippet displays a search result, including the title, URL, and a brief description of the search result. |
sdkBlob |
Optional. A base64-encoded JSON object that contains a list of search queries and their corresponding search URLs. This information can be used to build a custom search UI. A base64-encoded string. |
GroundingChunk
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field chunk_type. The source of the grounding chunk, which can be from Google Search, Vertex AI Search, or Google Maps. chunk_type can be only one of the following: |
|
web |
A grounding chunk from a web page, typically from Google Search. See the |
retrievedContext |
A grounding chunk from a data source retrieved by a retrieval tool, such as Vertex AI Search. See the |
maps |
A grounding chunk from Google Maps. See the |
Web
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field
|
|
uri |
The URI of the web page that contains the evidence. |
Union field
|
|
title |
The title of the web page that contains the evidence. |
Union field
|
|
domain |
The domain of the web page that contains the evidence. This can be used to filter out low-quality sources. |
RetrievedContext
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field context_details. Provides tool-specific details about the retrieved context. This allows for different types of retrieval tools to return their own specific metadata. context_details can be only one of the following: |
|
ragChunk |
Additional context for a Retrieval-Augmented Generation (RAG) retrieval result. This is populated only when the RAG retrieval tool is used. |
Union field
|
|
uri |
The URI of the retrieved data source. |
Union field
|
|
title |
The title of the retrieved data source. |
Union field
|
|
text |
The content of the retrieved data source. |
Union field
|
|
documentName |
Output only. The full resource name of the referenced Vertex AI Search document. This is used to identify the specific document that was retrieved. The format is |
RagChunk
| JSON representation |
|---|
{ "text": string, "fileId": string, "chunkId": string, // Union field |
| Fields | |
|---|---|
text |
The content of the chunk. |
fileId |
The ID of the file that the chunk belongs to. |
chunkId |
The ID of the chunk. |
Union field
|
|
pageSpan |
If populated, represents where the chunk starts and ends in the document. |
PageSpan
| JSON representation |
|---|
{ "firstPage": integer, "lastPage": integer } |
| Fields | |
|---|---|
firstPage |
Page where chunk starts in the document. Inclusive. 1-indexed. |
lastPage |
Page where chunk ends in the document. Inclusive. 1-indexed. |
Maps
| JSON representation |
|---|
{ "placeAnswerSources": { object ( |
| Fields | |
|---|---|
placeAnswerSources |
The sources that were used to generate the place answer. This includes review snippets and photos that were used to generate the answer, as well as URIs to flag content. |
Union field
|
|
uri |
The URI of the place. |
Union field
|
|
title |
The title of the place. |
Union field
|
|
text |
The text of the place answer. |
Union field
|
|
placeId |
This Place's resource name, in |
PlaceAnswerSources
| JSON representation |
|---|
{
"reviewSnippets": [
{
object ( |
| Fields | |
|---|---|
reviewSnippets[] |
Snippets of reviews that were used to generate the answer. |
ReviewSnippet
| JSON representation |
|---|
{ "reviewId": string, "googleMapsUri": string, "title": string } |
| Fields | |
|---|---|
reviewId |
The ID of the review that is being referenced. |
googleMapsUri |
A link to show the review on Google Maps. |
title |
The title of the review. |
GroundingSupport
| JSON representation |
|---|
{ "groundingChunkIndices": [ integer ], "confidenceScores": [ number ], "renderedParts": [ integer ], // Union field |
| Fields | |
|---|---|
groundingChunkIndices[] |
A list of indices into the For example, if this field has the values |
confidenceScores[] |
The confidence scores for the support references. This list is parallel to the For Gemini 2.0 and before, this list has the same size as |
renderedParts[] |
Indices into the |
Union field
|
|
segment |
The content segment that this support message applies to. |
Segment
| JSON representation |
|---|
{ "partIndex": integer, "startIndex": integer, "endIndex": integer, "text": string } |
| Fields | |
|---|---|
partIndex |
Output only. The index of the |
startIndex |
Output only. The start index of the segment in the |
endIndex |
Output only. The end index of the segment in the |
text |
Output only. The text of the segment. |
RetrievalMetadata
| JSON representation |
|---|
{ "googleSearchDynamicRetrievalScore": number } |
| Fields | |
|---|---|
googleSearchDynamicRetrievalScore |
Optional. A score indicating how likely it is that a Google Search query could help answer the prompt. The score is in the range of |
SourceFlaggingUri
| JSON representation |
|---|
{ "sourceId": string, "flagContentUri": string } |
| Fields | |
|---|---|
sourceId |
The ID of the place or review. |
flagContentUri |
The URI that can be used to flag the content. |
UrlContextMetadata
| JSON representation |
|---|
{
"urlMetadata": [
{
object ( |
| Fields | |
|---|---|
urlMetadata[] |
Output only. A list of URL metadata, with one entry for each URL retrieved by the tool. |
UrlMetadata
| JSON representation |
|---|
{
"retrievedUrl": string,
"urlRetrievalStatus": enum ( |
| Fields | |
|---|---|
retrievedUrl |
The URL retrieved by the tool. |
urlRetrievalStatus |
The status of the URL retrieval. |
Timestamp
| JSON representation |
|---|
{ "seconds": string, "nanos": integer } |
| Fields | |
|---|---|
seconds |
Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be between -62135596800 and 253402300799 inclusive (which corresponds to 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z). |
nanos |
Non-negative fractions of a second at nanosecond resolution. This field is the nanosecond portion of the duration, not an alternative to seconds. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be between 0 and 999,999,999 inclusive. |
PromptFeedback
| JSON representation |
|---|
{ "blockReason": enum ( |
| Fields | |
|---|---|
blockReason |
Output only. The reason why the prompt was blocked. |
safetyRatings[] |
Output only. A list of safety ratings for the prompt. There is one rating per category. |
blockReasonMessage |
Output only. A readable message that explains the reason why the prompt was blocked. |
UsageMetadata
| JSON representation |
|---|
{ "promptTokenCount": integer, "candidatesTokenCount": integer, "totalTokenCount": integer, "toolUsePromptTokenCount": integer, "thoughtsTokenCount": integer, "cachedContentTokenCount": integer, "promptTokensDetails": [ { object ( |
| Fields | |
|---|---|
promptTokenCount |
The total number of tokens in the prompt. This includes any text, images, or other media provided in the request. When |
candidatesTokenCount |
The total number of tokens in the generated candidates. |
totalTokenCount |
The total number of tokens for the entire request. This is the sum of |
toolUsePromptTokenCount |
Output only. The number of tokens in the results from tool executions, which are provided back to the model as input, if applicable. |
thoughtsTokenCount |
Output only. The number of tokens that were part of the model's generated "thoughts" output, if applicable. |
cachedContentTokenCount |
Output only. The number of tokens in the cached content that was used for this request. |
promptTokensDetails[] |
Output only. A detailed breakdown of the token count for each modality in the prompt. |
cacheTokensDetails[] |
Output only. A detailed breakdown of the token count for each modality in the cached content. |
candidatesTokensDetails[] |
Output only. A detailed breakdown of the token count for each modality in the generated candidates. |
toolUsePromptTokensDetails[] |
Output only. A detailed breakdown by modality of the token counts from the results of tool executions, which are provided back to the model as input. |
trafficType |
Output only. The traffic type for this request. |
ModalityTokenCount
| JSON representation |
|---|
{
"modality": enum ( |
| Fields | |
|---|---|
modality |
The modality that this token count applies to. |
tokenCount |
The number of tokens counted for this modality. |
Tool Annotations
Destructive Hint: ❌ | Idempotent Hint: ✅ | Read Only Hint: ✅ | Open World Hint: ✅