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.
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
parametersJsonSchema
value (Value
format)
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:
{
"type": "object",
"properties": {
"name": { "type": "string" },
"age": { "type": "integer" }
},
"additionalProperties": false,
"required": ["name", "age"],
"propertyOrdering": ["name", "age"]
}
This field is mutually exclusive with parameters
.
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.
responseJsonSchema
value (Value
format)
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 response
.
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.
type
enum (Type
)
Optional. The type of the data.
format
string
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
string
Optional. The title of the Schema.
description
string
Optional. The description of the data.
nullable
boolean
Optional. Indicates if the value may be null.
default
value (Value
format)
Optional. Default value of the data.
items
object (Schema
)
Optional. SCHEMA FIELDS FOR TYPE ARRAY Schema of the elements of type.ARRAY.
minItems
string (int64 format)
Optional. Minimum number of the elements for type.ARRAY.
maxItems
string (int64 format)
Optional. Maximum number of the elements for type.ARRAY.
enum[]
string
Optional. Possible values of the element of primitive type with enum format. Examples: 1. We can define direction as : {type:STRING, format:enum, enum:["EAST", NORTH", "SOUTH", "WEST"]} 2. We can define apartment number as : {type:INTEGER, format:enum, enum:["101", "201", "301"]}
properties
map (key: string, value: object (Schema
))
Optional. SCHEMA FIELDS FOR TYPE OBJECT Properties of type.OBJECT.
propertyOrdering[]
string
Optional. The order of the properties. Not a standard field in open api spec. Only used to support the order of the properties.
required[]
string
Optional. Required properties of type.OBJECT.
minProperties
string (int64 format)
Optional. Minimum number of the properties for type.OBJECT.
maxProperties
string (int64 format)
Optional. Maximum number of the properties for type.OBJECT.
minimum
number
Optional. SCHEMA FIELDS FOR TYPE INTEGER and NUMBER Minimum value of the type.INTEGER and type.NUMBER
maximum
number
Optional. Maximum value of the type.INTEGER and type.NUMBER
minLength
string (int64 format)
Optional. SCHEMA FIELDS FOR TYPE STRING Minimum length of the type.STRING
maxLength
string (int64 format)
Optional. Maximum length of the type.STRING
pattern
string
Optional. Pattern of the type.STRING to restrict a string to a regular expression.
example
value (Value
format)
Optional. Example of the object. Will only populated when the object is the root.
anyOf[]
object (Schema
)
Optional. The value should be validated against any (one or more) of the subschemas in the list.
additionalProperties
value (Value
format)
Optional. Can either be a boolean or an object; controls the presence of additional properties.
ref
string
Optional. Allows indirect references between schema nodes. The value should be a valid reference to a child of the root defs
.
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
map (key: string, value: object (Schema
))
Optional. A map of definitions for use by ref
Only allowed at the root of the schema.
JSON representation |
---|
{ "type": enum ( |
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 |
NULL | Null type |