functions.parameters
The parameters
object is used to define the input data that will be passed to the function.
Name | Type | Default | Description |
---|---|---|---|
parameters Optional | object | - | An object that contains the parameters |
Parameters
The parameters
object defines the function parameters that will be passed to the AI.
Name | Type | Default | Description |
---|---|---|---|
type Required | string | - | Defines the top-level type of the parameters. Must be set to "object" |
properties Required | object | - | An object containing the properties definitions to be passed to the function |
required Optional | string[] | - | Array of required property names from the properties object |
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.
Name | Type | Default | Description |
---|---|---|---|
[key: string] Required | object | - | An object with dynamic property names, where:
|
Schema Types
- string
- integer
- number
- boolean
- array
- object
- oneOf
- allOf
- anyOf
- const
String Properties
Name | Type | Default | Description |
---|---|---|---|
type Required | string | - | The type of property the AI is passing to the function. Must be set to "string" |
description Optional | string | - | A description of the property |
enum Optional | string[] | - | An array of strings that are the possible values |
default Optional | string | - | The default string value |
pattern Optional | string | - | Regular expression pattern for the string value to match |
nullable Optional | boolean | false | Whether the property can be null |
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
Name | Type | Default | Description |
---|---|---|---|
type Required | string | - | The type of parameter the AI is passing to the function. Must be set to "integer" |
description Optional | string | - | A description of the property |
enum Optional | integer[] | - | An array of integers that are the possible values |
default Optional | integer | - | The default integer value |
nullable Optional | boolean | false | Whether the property can be null |
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
Name | Type | Default | Description |
---|---|---|---|
type Required | string | - | The type of parameter the AI is passing to the function. Must be set to "number" |
description Optional | string | - | A description of the property |
enum Optional | number[] | - | An array of numbers that are the possible values |
default Optional | number | - | The default number value |
nullable Optional | boolean | false | Whether the property can be null |
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
Name | Type | Default | Description |
---|---|---|---|
type Required | string | - | The type of parameter the AI is passing to the function. Must be set to "boolean" |
description Optional | string | - | A description of the property |
default Optional | boolean | - | The default boolean value |
nullable Optional | boolean | false | Whether the property can be null |
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
Name | Type | Default | Description |
---|---|---|---|
type Required | string | - | The type of parameter(s) the AI is passing to the function. Must be set to "array" |
description Optional | string | - | A description of the property |
items Required | object | - | An array of items. These items must be one of the valid schema types |
default Optional | array | - | The default array value |
nullable Optional | boolean | false | Whether the property can be null |
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
Name | Type | Default | Description |
---|---|---|---|
type Required | string | - | The type of parameter(s) the AI is passing to the function. Must be set to "object" |
description Optional | string | - | A description of the property |
properties Optional | object | - | An object that contains the properties definitions to be passed to the function. |
required Optional | string[] | - | The property names that are required for the properties object |
default Optional | object | - | The default object value |
nullable Optional | boolean | false | Whether the property can be null |
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.
Name | Type | Default | Description |
---|---|---|---|
oneOf Required | array | - | 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.
Name | Type | Default | Description |
---|---|---|---|
allOf Required | array | - | 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.
Name | Type | Default | Description |
---|---|---|---|
anyOf Required | array | - | 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.
Name | Type | Default | Description |
---|---|---|---|
const Required | any | - | The value that will be set as a constant value for the property |
Example
- YAML
- JSON
parameters:
type: object
properties:
property_name:
const: "constant_value"
{
"parameters": {
"type": "object",
"properties": {
"property_name": {
"const": "constant_value"
}
}
}
}