Tool

Tool details that the model may use to generate response.

A Tool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model. A Tool object should contain exactly one type of Tool (e.g FunctionDeclaration, Retrieval or GoogleSearchRetrieval).

Fields
functionDeclarations[] object (FunctionDeclaration)

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 FunctionCall in the response. user should provide a FunctionResponse for each function call in the next turn. Based on the function responses, Model will generate the final response back to the user. Maximum 128 function declarations can be provided.

retrieval object (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.

googleSearchRetrieval object (GoogleSearchRetrieval)

Optional. GoogleSearchRetrieval tool type. Specialized retrieval tool that is powered by Google search.

JSON representation
{
  "functionDeclarations": [
    {
      object (FunctionDeclaration)
    }
  ],
  "retrieval": {
    object (Retrieval)
  },
  "googleSearchRetrieval": {
    object (GoogleSearchRetrieval)
  }
}

FunctionDeclaration

Structured representation of a function declaration as defined by the OpenAPI 3.0 specification. Included in this declaration are the function name, description, parameters and response type. This FunctionDeclaration is a representation of a block of code that can be used as a Tool by the model and executed by the client.

Fields
name string

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 and dashes, with a maximum length of 64.

description string

Optional. description and purpose of the function. Model uses it to decide how and whether to call the function.

parameters object (Schema)

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

response object (Schema)

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.

JSON representation
{
  "name": string,
  "description": string,
  "parameters": {
    object (Schema)
  },
  "response": {
    object (Schema)
  }
}

Retrieval

Defines a retrieval tool that model can call to access external knowledge.

Fields
disableAttribution
(deprecated)
boolean

Optional. Deprecated. This option is no longer supported.

source Union type
The source of the retrieval. source can be only one of the following:
JSON representation
{
  "disableAttribution": boolean,

  // source
  "vertexAiSearch": {
    object (VertexAISearch)
  }
  // Union type
}

VertexAISearch

Retrieve from Vertex AI Search datastore for grounding. See https://cloud.google.com/products/agent-builder

Fields
datastore string

Required. Fully-qualified Vertex AI Search data store resource id. Format: projects/{project}/locations/{location}/collections/{collection}/dataStores/{dataStore}

JSON representation
{
  "datastore": string
}

GoogleSearchRetrieval

Tool to retrieve public web data for grounding, powered by Google.

Fields
dynamicRetrievalConfig object (DynamicRetrievalConfig)

Specifies the dynamic retrieval configuration for the given source.

JSON representation
{
  "dynamicRetrievalConfig": {
    object (DynamicRetrievalConfig)
  }
}

DynamicRetrievalConfig

Describes the options to customize dynamic retrieval.

Fields
mode enum (Mode)

The mode of the predictor to be used in dynamic retrieval.

dynamicThreshold number

Optional. The threshold to be used in dynamic retrieval. If not set, a system default value is used.

JSON representation
{
  "mode": enum (Mode),
  "dynamicThreshold": number
}

Mode

The mode of the predictor to be used in dynamic retrieval.

Enums
MODE_UNSPECIFIED Always trigger retrieval.
MODE_DYNAMIC Run retrieval only when system decides it is necessary.