{"_id":"5845a4a99f6fbb1b004307f8","parentDoc":null,"project":"54d3007669578e0d002730c9","user":"55a04a395730f40d001104d2","category":{"_id":"5845a4a89f6fbb1b004307b9","version":"5845a4a89f6fbb1b004307b7","__v":0,"project":"54d3007669578e0d002730c9","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-07-30T06:25:25.645Z","from_sync":false,"order":1,"slug":"key-concepts","title":"Key Concepts"},"version":{"_id":"5845a4a89f6fbb1b004307b7","project":"54d3007669578e0d002730c9","__v":2,"createdAt":"2016-12-05T17:32:24.708Z","releaseDate":"2016-12-05T17:32:24.708Z","categories":["5845a4a89f6fbb1b004307b8","5845a4a89f6fbb1b004307b9","5845a4a89f6fbb1b004307ba","5845a4a89f6fbb1b004307bb","5845a4a89f6fbb1b004307bc","5845a4a89f6fbb1b004307bd","5845a4a89f6fbb1b004307be","5845a4a89f6fbb1b004307bf","5845a4a89f6fbb1b004307c0","592deb23644f060f008e5aa6"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"25.0.0","version":"25"},"__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-11-03T19:32:19.599Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":11,"body":"There are two types of dialogs that we currently consider when building voice interaction scenarios:\n  * **Linear dialogs**, the aim of which is to collect the information necessary to complete the required action (e.g. find the best hotel, turn on the right light bulb, or play the desired song).\n  * **Non-linear dialogs**, which may have several branches, depending on users’ answers. \n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Linear dialog\"\n}\n[/block]\nTo build linear dialogs, we use a feature known as **slot filling**. Let’s look at the following example of an agent for a hotel booking app.\n\nSince our app understands natural language, our travelers can request a hotel any way they like. Depending on how it is worded, this request may include several different search parameters:\n  * “I need to book a hotel.”\n  * “Find a cheap hotel in Rome.”\n  * “Book a hotel in New York, check in November 10, check out November 15.”\n\nNow let’s say our app requires at least three parameters to start the search:\n  * destination\n  * check-in date\n  * check-out date\n\nThis is where the slot filling feature comes in. Even before you start listing examples in the User Says section, you can list all of the parameters your app can use to perform a search, both required and optional.\n[block:image]\n{\n  \"images\": [\n    {\n      \"caption\": \"\",\n      \"image\": [\n        \"https://files.readme.io/Zy8IUKoaRyaSuRzf0kNx_Screenshot_5.png\",\n        \"Screenshot_5.png\",\n        \"928\",\n        \"470\",\n        \"#5b6f8a\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nWhen you mark a parameter as “Required”, you’ll be asked to write prompts that your app will address to your user when they make a request that does not include that parameter.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/A61Z45WgQYWN5itgjgam_image00.gif\",\n        \"image00.gif\",\n        \"886\",\n        \"393\",\n        \"#354f77\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nYou can define the order in which your app will ask these questions by dragging and dropping the parameters in the list.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/MKqC0utTeKrjrzKRJyNQ_image03.gif\",\n        \"image03.gif\",\n        \"881\",\n        \"372\",\n        \"#35608b\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nYour agent will continue to ask these questions until it has collected information for all required parameters. At any time, users can ask to cancel and start from the beginning.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/QCAsf4U5TIyM8Tws3CbF_image02.png\",\n        \"image02.png\",\n        \"356\",\n        \"456\",\n        \"#308ace\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Non-linear dialogs\"\n}\n[/block]\nNow let’s look at an example of a non-linear dialog – in this case, a customer satisfaction survey for a hotel.\n\nIt starts with these two questions:\n  * How would you rate the location of the property?\n  * How would you rate the facilities at the hotel?\n\nFor each question, there are four types of answers:\n  * poor\n  * fair\n  * good\n  * excellent\n\nTo build this dialog we’ll need to use contexts. Here’s how it’s done:\n\nFirst, we create an intent which reacts to the “start” command and triggers the dialog. In this intent we’ll ask the first question and set the outgoing context as “location-question”. As a result, the preferred intents for the answers to this question will have this as the incoming context.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/tRkGgnXARYeFd5kQlh9I_Screenshot_2.png\",\n        \"Screenshot_2.png\",\n        \"1171\",\n        \"788\",\n        \"#409fd9\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nNext we create intents for each of the four expected response variations, with the incoming context “location-question”. These four questions will work only while this context is active.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/cHxWQcBTRgiYCoyp6Grw_new-intent-with-context.gif\",\n        \"new-intent-with-context.gif\",\n        \"1168\",\n        \"335\",\n        \"#349fe1\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nNote that we marked the action and the parameters we want to receive when these intents are matched. We also added the next question in the Speech Response field, and to match the correct intent for the answers, we set the new outgoing context as “facilities-question”.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/ZnDtOD6aTC2mQO7ctnSP_new-intent-speech.gif\",\n        \"new-intent-speech.gif\",\n        \"1168\",\n        \"335\",\n        \"#30a0e0\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nThen we create four more intents for the possible responses, and we mark “facilities-question” as the incoming context so that these answers will match our new question.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/rxWNnvYuRmHH4j9sSjmb_intents-list.png\",\n        \"intents-list.png\",\n        \"1173\",\n        \"488\",\n        \"#3c9ed7\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nOnce again, we mark the action and parameters we want to receive when these new intents are matched, and add the next question in the Speech Response field.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/XwA31VC2Qz6tKx8pTylH_Screenshot_4.png\",\n        \"Screenshot_4.png\",\n        \"1181\",\n        \"785\",\n        \"#3fa0d9\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"dialogs","type":"basic","title":"Dialogs"}
There are two types of dialogs that we currently consider when building voice interaction scenarios: * **Linear dialogs**, the aim of which is to collect the information necessary to complete the required action (e.g. find the best hotel, turn on the right light bulb, or play the desired song). * **Non-linear dialogs**, which may have several branches, depending on users’ answers. [block:api-header] { "type": "basic", "title": "Linear dialog" } [/block] To build linear dialogs, we use a feature known as **slot filling**. Let’s look at the following example of an agent for a hotel booking app. Since our app understands natural language, our travelers can request a hotel any way they like. Depending on how it is worded, this request may include several different search parameters: * “I need to book a hotel.” * “Find a cheap hotel in Rome.” * “Book a hotel in New York, check in November 10, check out November 15.” Now let’s say our app requires at least three parameters to start the search: * destination * check-in date * check-out date This is where the slot filling feature comes in. Even before you start listing examples in the User Says section, you can list all of the parameters your app can use to perform a search, both required and optional. [block:image] { "images": [ { "caption": "", "image": [ "https://files.readme.io/Zy8IUKoaRyaSuRzf0kNx_Screenshot_5.png", "Screenshot_5.png", "928", "470", "#5b6f8a", "" ] } ] } [/block] When you mark a parameter as “Required”, you’ll be asked to write prompts that your app will address to your user when they make a request that does not include that parameter. [block:image] { "images": [ { "image": [ "https://files.readme.io/A61Z45WgQYWN5itgjgam_image00.gif", "image00.gif", "886", "393", "#354f77", "" ] } ] } [/block] You can define the order in which your app will ask these questions by dragging and dropping the parameters in the list. [block:image] { "images": [ { "image": [ "https://files.readme.io/MKqC0utTeKrjrzKRJyNQ_image03.gif", "image03.gif", "881", "372", "#35608b", "" ] } ] } [/block] Your agent will continue to ask these questions until it has collected information for all required parameters. At any time, users can ask to cancel and start from the beginning. [block:image] { "images": [ { "image": [ "https://files.readme.io/QCAsf4U5TIyM8Tws3CbF_image02.png", "image02.png", "356", "456", "#308ace", "" ] } ] } [/block] [block:api-header] { "type": "basic", "title": "Non-linear dialogs" } [/block] Now let’s look at an example of a non-linear dialog – in this case, a customer satisfaction survey for a hotel. It starts with these two questions: * How would you rate the location of the property? * How would you rate the facilities at the hotel? For each question, there are four types of answers: * poor * fair * good * excellent To build this dialog we’ll need to use contexts. Here’s how it’s done: First, we create an intent which reacts to the “start” command and triggers the dialog. In this intent we’ll ask the first question and set the outgoing context as “location-question”. As a result, the preferred intents for the answers to this question will have this as the incoming context. [block:image] { "images": [ { "image": [ "https://files.readme.io/tRkGgnXARYeFd5kQlh9I_Screenshot_2.png", "Screenshot_2.png", "1171", "788", "#409fd9", "" ] } ] } [/block] Next we create intents for each of the four expected response variations, with the incoming context “location-question”. These four questions will work only while this context is active. [block:image] { "images": [ { "image": [ "https://files.readme.io/cHxWQcBTRgiYCoyp6Grw_new-intent-with-context.gif", "new-intent-with-context.gif", "1168", "335", "#349fe1", "" ] } ] } [/block] Note that we marked the action and the parameters we want to receive when these intents are matched. We also added the next question in the Speech Response field, and to match the correct intent for the answers, we set the new outgoing context as “facilities-question”. [block:image] { "images": [ { "image": [ "https://files.readme.io/ZnDtOD6aTC2mQO7ctnSP_new-intent-speech.gif", "new-intent-speech.gif", "1168", "335", "#30a0e0", "" ] } ] } [/block] Then we create four more intents for the possible responses, and we mark “facilities-question” as the incoming context so that these answers will match our new question. [block:image] { "images": [ { "image": [ "https://files.readme.io/rxWNnvYuRmHH4j9sSjmb_intents-list.png", "intents-list.png", "1173", "488", "#3c9ed7", "" ] } ] } [/block] Once again, we mark the action and parameters we want to receive when these new intents are matched, and add the next question in the Speech Response field. [block:image] { "images": [ { "image": [ "https://files.readme.io/XwA31VC2Qz6tKx8pTylH_Screenshot_4.png", "Screenshot_4.png", "1181", "785", "#3fa0d9", "" ] } ] } [/block]