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.
You will advance through the following stages.
## Greeting
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.
## Stage 1
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 stage 2 otherwise ask for a new address until its valid.
## Stage 2
Ask the user what kind of food they are interested in e.g. Pizza, Chinese, American etc.
When the user tells you an answer proceed to stage 3.
## Stage 3
Use the restaurant_lookup function too look for restaurants and go over the results with the user. Do not mention the location_id.
Offer to provide more information about any of the results. Pass the location_id to the restaurant_lookup function to get more info.
If the user asks to look for a new genre of restaurant, look up the new genre without asking for the address again.
If the user asks to check a new address, go back to Stage 1.
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: 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: "Summarize this info for ${name}. ${description} Address: (omit plus 4) ${address_obj.address_string}, Phone Number: (repeat as is) @{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)"