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).
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 [FunctionCall][content.part.function_call] in the response. user should provide a [FunctionResponse][content.part.function_response] for each function call in the next turn. Based on the function responses, Model will generate the final response back to the user. Maximum 64 function declarations can be provided. |
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. |
FunctionDeclaration
Structured representation of a function declaration as defined by the OpenAPI 3.0 specification. Included in this declaration are the function name and parameters. 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.
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 and dashes, with a maximum length of 64. |
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 |
Schema
Schema is used to define the format of input/output data. Represents a select subset of an OpenAPI 3.0 schema object. More fields may be added in the future as needed.
JSON representation |
---|
{ "type": enum ( |
Fields | |
---|---|
type |
Optional. The type of the data. |
format |
Optional. The format of the data. Supported formats: for NUMBER type: "float", "double" for INTEGER type: "int32", "int64" for STRING type: "email", "byte", etc |
title |
Optional. The title of the Schema. |
description |
Optional. The description of the data. |
nullable |
Optional. Indicates if the value may be null. |
default |
Optional. Default value of the data. |
items |
Optional. SCHEMA FIELDS FOR TYPE ARRAY Schema of the elements of type.ARRAY. |
minItems |
Optional. Minimum number of the elements for type.ARRAY. |
maxItems |
Optional. Maximum number of the elements for type.ARRAY. |
enum[] |
Optional. Possible values of the element of type.STRING with enum format. For example we can define an Enum Direction as : {type:STRING, format:enum, enum:["EAST", NORTH", "SOUTH", "WEST"]} |
properties |
Optional. SCHEMA FIELDS FOR TYPE OBJECT Properties of type.OBJECT. |
required[] |
Optional. Required properties of type.OBJECT. |
minProperties |
Optional. Minimum number of the properties for type.OBJECT. |
maxProperties |
Optional. Maximum number of the properties for type.OBJECT. |
minimum |
Optional. SCHEMA FIELDS FOR TYPE INTEGER and NUMBER Minimum value of the type.INTEGER and type.NUMBER |
maximum |
Optional. Maximum value of the type.INTEGER and type.NUMBER |
minLength |
Optional. SCHEMA FIELDS FOR TYPE STRING Minimum length of the type.STRING |
maxLength |
Optional. Maximum length of the type.STRING |
pattern |
Optional. Pattern of the type.STRING to restrict a string to a regular expression. |
example |
Optional. Example of the object. Will only populated when the object is the root. |
Type
type contains the list of OpenAPI data types as defined by https://swagger.io/docs/specification/data-models/data-types/
Enums | |
---|---|
TYPE_UNSPECIFIED |
Not specified, should not be used. |
STRING |
OpenAPI string type |
NUMBER |
OpenAPI number type |
INTEGER |
OpenAPI integer type |
BOOLEAN |
OpenAPI boolean type |
ARRAY |
OpenAPI array type |
OBJECT |
OpenAPI object type |
Retrieval
Defines a retrieval tool that model can call to access external knowledge.
JSON representation |
---|
{ "disableAttribution": boolean, // Union field |
Fields | |
---|---|
disableAttribution |
Optional. Disable using the result from this tool in detecting grounding attribution. This does not affect how the result is given to the model for generation. |
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. |
VertexAISearch
Retrieve from Vertex AI Search datastore for grounding. See https://cloud.google.com/vertex-ai-search-and-conversation
JSON representation |
---|
{ "datastore": string } |
Fields | |
---|---|
datastore |
Required. Fully-qualified Vertex AI Search's datastore resource ID. Format: |