Parameters for ai.SWAIG
Name | Type | Description |
---|---|---|
defaults | object | Default settings for all SWAIG functions. If defaults is not set, settings may be set in each function object. Optional. Default is not set. |
defaults.web_hook_url | string | Default URL to send status callbacks and reports to. Optional. Default is not set. See Callback Parameters for details on the request body. |
defaults.web_hook_auth_user | string | Default auth username for web_hook_url endpoint. Optional. Default is not set. |
defaults.web_hook_auth_password | string | Default auth password for web_hook_url endpoint. Optional. Default is not set. |
native_functions | string[] | Prebuilt functions the AI agent is able to call (from this list of available native functions) |
includes | object[] | An array of objects to include remote function signatures. The object fields are url to specify where the remote functions are defined and functions which is an array of the function names as strings. See examples below of implementation. |
functions | object[] | An array of JSON objects to define functions that can be executed during the interaction with the AI. Optional. Default is not set. The fields of this object are the six following. |
functions.active | boolean | Whether the function is active. Optional. Default is true. |
functions.function | string | A unique name for the function. For example, "get_weather". Required. |
functions.meta_data | object | A JSON object containing any metadata, as a key-value map. Optional. Default is not set. |
functions.meta_data_token | string | Scoping token for meta_data . If not supplied, metadata will be scoped to function's web_hook_url . Optional. Default is set by SignalWire. |
functions.data_map | object[] | An object containing properties to process or validate the input, perform actions based on the input, or connect to external APIs or services in a serverless fashion. |
functions.web_hook_url | string | Function-specific URL to send status callbacks and reports to. Takes precedence over a default setting. Optional. Default is not set. See Callback Parameters for details on the request body. |
functions.web_hook_auth_user | string | Function-specific auth username for web_hook_url endpoint. Takes precedence over a default setting. Optional. Default is not set. |
functions.web_hook_auth_pass | string | Function-specific auth password for web_hook_url endpoint. Takes precedence over a default setting. Optional. Default is not set. |
functions.wait_file | string | A file to play while the function is running. wait_file_loops can specify the amount of times that files should continously play. Optional. Default is not set. |
functions.wait_file_loops | string | integer | The amount of times that wait_file should continously play/loop. Optional. Default is not set. |
functions.purpose | string | A description of the context and purpose of the function, to explain to the agent when to use it. Required. |
functions.argument | object | A JSON object defining the input that should be passed to the function. The fields of this object are the following two parameters. Required. |
functions.argument.type | string | The type of argument the AI is passing to the function. Possible values are "string" and "object". Required. |
functions.argument.properties | object | A JSON object describing the argument. The value is set by the user. For example, "location" for a location-based search or "company" if searching a database of companies. This object has sub-parameters description and type to help define the property. See examples below for implementation. Required. |
Examples
Using SWAIG Functions
- YAML
- JSON
version: 1.0.0
sections:
main:
- ai:
post_prompt_url: "https://example.com/my-api"
prompt:
text: |
You are a helpful assistant that can provide information to users about a destination.
You can use the appropriate function to get the phone number, address,
or weather information.
post_prompt:
text: "Summarize the conversation."
SWAIG:
includes:
- functions:
- get_phone_number
- get_address
url: https://example.com/functions
user: me
pass: secret
defaults:
web_hook_url: https://example.com/my-webhook
web_hook_auth_user: me
web_hook_auth_pass: secret
functions:
- function: get_weather
purpose: To determine what the current weather is in a provided location.
argument:
properties:
location:
type: string
description: The name of the city to find the weather from.
type: object
{
"version": "1.0.0",
"sections": {
"main": [
{
"ai": {
"post_prompt_url": "https://example.com/my-api",
"prompt": {
"text": "You are a helpful assistant that can provide information to users about a destination. \nYou can use the appropriate function to get the phone number, address, \nor weather information.\n"
},
"post_prompt": {
"text": "Summarize the conversation."
},
"SWAIG": {
"includes": [
{
"functions": [
"get_phone_number",
"get_address"
],
"url": "https://example.com/functions",
"user": "me",
"pass": "secret"
}
],
"defaults": {
"web_hook_url": "https://example.com/my-webhook",
"web_hook_auth_user": "me",
"web_hook_auth_pass": "secret"
},
"functions": [
{
"function": "get_weather",
"purpose": "To determine what the current weather is in a provided location.",
"argument": {
"properties": {
"location": {
"type": "string",
"description": "The name of the city to find the weather from."
}
},
"type": "object"
}
}
]
}
}
}
]
}
}