functions.parameters
The parameters object is used to define the input data that will be passed to the function.
An object that contains the parameters
Parameters
The parameters object defines the function parameters that will be passed to the AI.
An object containing the properties definitions to be passed to the function
Properties
The properties object defines the input data that will be passed to the function. It supports different types of parameters, each with their own set of configuration options.
The property name is a key in the properties object that is user-defined.
An object with dynamic property names, where:
- Keys: User-defined strings, that set the property name.
- Values: Must be one of the valid schema types. Learn more about valid schema types from the JSON Schema documentation
Schema Types
- string
- integer
- number
- boolean
- array
- object
- oneOf
- allOf
- anyOf
- const
String Properties
The type of property the AI is passing to the function. Must be set to "string"
Example
- YAML
- JSON
parameters:
type: object
properties:
property_name:
type: string
description: A string value
pattern: ^[a-z]+$
{
"parameters": {
"type": "object",
"properties": {
"property_name": {
"type": "string",
"description": "A string value",
"pattern": "^[a-z]+$"
}
}
}
}
Integer Properties
The type of parameter the AI is passing to the function. Must be set to "integer"
Example
- YAML
- JSON
parameters:
type: object
properties:
property_name:
type: integer
description: An integer value
default: 10
{
"parameters": {
"type": "object",
"properties": {
"property_name": {
"type": "integer",
"description": "An integer value",
"default": 10
}
}
}
}
Number Properties
The type of parameter the AI is passing to the function. Must be set to "number"
Example
- YAML
- JSON
parameters:
type: object
properties:
property_name:
type: number
description: A number value
default: 10.5
{
"parameters": {
"type": "object",
"properties": {
"property_name": {
"type": "number",
"description": "A number value",
"default": 10.5
}
}
}
}
Boolean Properties
The type of parameter the AI is passing to the function. Must be set to "boolean"
Example
- YAML
- JSON
parameters:
type: object
properties:
property_name:
type: boolean
description: A boolean value
{
"parameters": {
"type": "object",
"properties": {
"property_name": {
"type": "boolean",
"description": "A boolean value"
}
}
}
}
Array Properties
The type of parameter(s) the AI is passing to the function. Must be set to "array"
An array of items. These items must be one of the valid schema types
Example
- YAML
- JSON
parameters:
type: object
properties:
property_name:
type: array
description: Array of strings and objects
items:
- type: string
description: A single string value that must be one of the possible values
default: "one"
enum:
- "one"
- "two"
- "three"
- type: object
description: An object with a required property, `desired_value`, that must be one of the possible values
required:
- desired_value
properties:
desired_value:
type: string
description: A single string value that must be one of the possible values
enum:
- "four"
- "five"
- "six"
{
"parameters": {
"type": "object",
"properties": {
"property_name": {
"type": "array",
"description": "Array of strings and objects",
"items": [
{
"type": "string",
"description": "A single string value that must be one of the possible values",
"default": "one",
"enum": [
"one",
"two",
"three"
]
},
{
"type": "object",
"description": "An object with a required property, `desired_value`, that must be one of the possible values",
"required": [
"desired_value"
],
"properties": {
"desired_value": {
"type": "string",
"description": "A single string value that must be one of the possible values",
"enum": [
"four",
"five",
"six"
]
}
}
}
]
}
}
}
}
Object Properties
The type of parameter(s) the AI is passing to the function. Must be set to "object"
An object that contains the properties definitions to be passed to the function.
Example
- YAML
- JSON
parameters:
type: object
properties:
name:
type: string
description: The user's name
age:
type: integer
description: The user's age
address:
type: object
description: The user's address
properties:
street:
type: string
description: The user's street address
city:
type: string
description: The user's city
required:
- street
- city
{
"parameters": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The user's name"
},
"age": {
"type": "integer",
"description": "The user's age"
},
"address": {
"type": "object",
"description": "The user's address",
"properties": {
"street": {
"type": "string",
"description": "The user's street address"
},
"city": {
"type": "string",
"description": "The user's city"
}
},
"required": [
"street",
"city"
]
}
}
}
}
oneOf Property
Specifies that the data must be valid against exactly one of the provided schemas.
An array of schemas where exactly one must be valid.
The value must be a valid schema type
Example
- YAML
- JSON
parameters:
type: object
properties:
property_name:
oneOf:
- type: string
description: A string value
- type: integer
description: An integer value
{
"parameters": {
"type": "object",
"properties": {
"property_name": {
"oneOf": [
{
"type": "string",
"description": "A string value"
},
{
"type": "integer",
"description": "An integer value"
}
]
}
}
}
}
allOf Property
Specifies that the data must be valid against all of the provided schemas.
An array of schemas where all must be valid.
The value must be a valid schema type
Example
- YAML
- JSON
parameters:
type: object
properties:
property_name:
allOf:
- type: string
description: A string value
- type: integer
description: An integer value
{
"parameters": {
"type": "object",
"properties": {
"property_name": {
"allOf": [
{
"type": "string",
"description": "A string value"
},
{
"type": "integer",
"description": "An integer value"
}
]
}
}
}
}
anyOf Property
Specifies that the data must be valid against at least one of the provided schemas.
An array of schemas where at least one must be valid.
The value must be a valid schema type
Example
- YAML
- JSON
parameters:
type: object
properties:
property_name:
anyOf:
- type: string
description: A string value
- type: integer
description: An integer value
{
"parameters": {
"type": "object",
"properties": {
"property_name": {
"anyOf": [
{
"type": "string",
"description": "A string value"
},
{
"type": "integer",
"description": "An integer value"
}
]
}
}
}
}
const Property
Specifies an exact value that the data must match.
Example
- YAML
- JSON
parameters:
type: object
properties:
property_name:
const: "constant_value"
{
"parameters": {
"type": "object",
"properties": {
"property_name": {
"const": "constant_value"
}
}
}
}