version: 1.0.0
sections:
main:
- ai:
post_prompt_url: https://cantina.signalwire.cloud/aicgi/post.cgi
post_prompt_auth_user: developer
post_prompt_auth_password: seekret
prompt:
top_p: 0.3
temperature: 0.3
text: >-
You are Sigourney. Your purpose is to help the user find a restaurant.
Explain You are a demonstration of SignalWire AI Agents.
Explain your purpose and begin the process right away. Ask the user if they would like to find a restaurant.
If they do, Advance to step 1 by calling the advance_step function and follow the instructions.
params:
eleven_labs_stability: .50
eleven_labs_similarity: .25
pronounce:
- replace: "-"
with: ","
ignore_case: true
hints:
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- court
- street
- avenue
- road
- north
- south
- east
- west
languages:
- name: English
code: en-US
voice: elevenlabs.rachel
- name: Spanish
code: es-MX
voice: elevenlabs.rachel
- name: French
code: fr-FR
voice: elevenlabs.rachel
post_prompt:
text: Summarize the conversation
SWAIG:
defaults:
web_hook_url: https://cantina.signalwire.cloud/aicgi/swaig.cgi
web_hook_auth_user: developer
web_hook_auth_password: seekret
functions:
- function: advance_step
purpose: to advance to a particular step
argument:
type: "object"
properties:
step:
type: string
description: The step number as a string
data_map:
expressions:
- string: "${args.step}"
pattern: /1/i
output:
response: >-
Ask the user for their address and look it up with the address_lookup function.
Specifically ask for just street address and zip code.
If the address is valid, proceed to step 2 otherwise ask for a new address until its valid.
- string: "${args.step}"
pattern: /2/i
output:
action:
back_to_back_functions: true
response: >-
Ask the user what kind of food they are interested in e.g. Pizza, Chinese, American etc.
Pass the response as the genre to the restaurant_lookup function to search then go to step 3
- string: "${args.step}"
pattern: /3/i
output:
response: >-
Explain the results to the user. Do not mention the location_id.
If the user mentions one of the restaurants, pass the location_id to restaurant_lookup and repeat the results.
If the user asks for a new genre, pass it to restaurant_lookup are repeat the current step.
If the user asks to check a new address, go back to step 1.
- function: address_lookup
purpose: To check if an address is valid, When using this function make sure you collect the street and zip
argument:
type: "object"
properties:
street:
type: string
description: the street addr e.g. 1234 N Main st.
zipcode:
type: string
description: the 5 digit zipcode
data_map:
webhooks:
- url: "https://global-address.p.rapidapi.com/V3/WEB/GlobalAddress/doGlobalAddress?ctry=US&format=json&a1=${enc:args.street}&DeliveryLines=Off&postal=${args.zipcode}"
headers:
X-RapidAPI-Key: 267f62153emsh5f536bcc582ddccp1408e0jsn793d31f7bbb4
X-RapidAPI-Host: global-address.p.rapidapi.com
expressions:
- string: "${Records[0].FormattedAddress}"
pattern: /\w+/i
output:
response: The Address is valid ${Records[0].FormattedAddress}
action:
back_to_back_functions: true
set_meta_data:
addr: "${Records[0].FormattedAddress}"
LL: "${Records[0].Latitude},${Records[0].Longitude}"
output:
response: There was an error verifying the address.
- function: restaurant_lookup
purpose: To look for restaurants given a certian genre or location_id
argument:
type: object
properties:
genre:
type: string
description: the genre of food
location_id:
type: string
description: the location_id to look up a specific location_id
data_map:
webhooks:
- require_args: location_id
error_keys: error
url: "https://api.content.tripadvisor.com/api/v1/location/${args.location_id}/details?key=C21562F41A3E4D30988BBED54FD403EF&language=en¤cy=USD"
output:
response: "Repeat this info for ${name}. ${description} Address: (omit plus 4) ${address_obj.address_string}, Number: (repeat the following verbatim) @{fmt_ph national:sep ${phone}}, Rating: ${rating}, Ranking: ${ranking_data.ranking_string}"
- require_args: genre
error_keys: error
url: "https://api.content.tripadvisor.com/api/v1/location/search?key=C21562F41A3E4D30988BBED54FD403EF&searchQuery=${lc:enc:args.genre}&latLong=${enc:meta_data.LL}&language=en"
foreach:
input_key: data
output_key: summary
max: 3
append: "location_id: ${this.location_id} name: ${this.name} distance: ${this.distance} miles\n"
output:
response: "Here are the top 3 matches. ${summary}\n(Never mention the location_id)"