Deploying and Testing the Conversation

At this point, for any other skill, all we’d need to do is use the ASK CLI to deploy our skill and then try it out, either with ask dialog, through the developer console, or with an actual device. But skills built with Alexa Conversations require an extra step to prepare the conversation model for upload. So before we can deploy and test our skill, we’ll need to compile the conversation model.

Compiling the Conversation Model

ACDL is designed to be easily understood by developers, making it easy to define a conversation model. But ACDL isn’t so easily understood by Alexa’s AI engine. So, before we can deploy the skill, we need to compile the conversation model, transforming it from ACDL to a JSON format known as Alexa Conversations Intermediate Representation (ACIR).

To compile a project’s ACDL files to ACIR, use the askx compile command:

 $ ​​askx​​ ​​compile

ACDL compilation only takes a few seconds and usually catches most common errors before the skill is deployed. Even if you’re still working on the Conversation model and aren’t ready to deploy the skill yet, it can be helpful to run the compiler every so often to make sure you haven’t made any syntactic mistakes in your ACDL files. If there is an error, it’ll be clearly displayed in the response from the compiler.

Once compilation is complete, you can find the ACIR files in the project’s /skill-package/build directory. There will be one ACIR file (each with a .json file extension) for each ACDL file in the conversation model. Feel free to explore the ACIR files, but there’s no need to change, understand, or edit them. But what you will no doubt notice is that ACIR files are significantly longer and more cryptic than the ACDL source that they were created from. Aren’t you glad that you didn’t have to define the conversation model in ACIR?

Once the compilation is complete and all other elements of your skill are ready, it’s time to deploy the skill.

Deploy the Skill

Deploying a skill built with Alexa Conversations is the same as with any other AWS Lambda-hosted skill—using the deploy command with the ASK CLI. But since Alexa Conversations is (at this time) only supported by the beta version of the ASK CLI, only the beta version is aware of the ACIR files and knows to deploy them along with other skill artifacts. Therefore, you’ll want to be sure to use askx deploy instead of ask deploy when deploying the skill.

 $ ​​askx​​ ​​deploy

Eventually, when Alexa Conversations support in the ASK CLI moves out of beta, you’ll be able to use the standard ASK CLI to deploy your skill.

At this point, you may be asked “Skills with ACDL are not yet compatible with the https://developer.amazon.com, hence this skill will be disabled on the Developer Console. Would you like to proceed?” All that this is saying is that, at this time, you won’t be able to change anything about your skill from the developer console and must make and deploy all edits locally. Just agree and the skill will be deployed. Despite this warning and limitation, you can still test your skill in the developer console.

After initiating deployment, it’s probably a good idea to step away for a bite to eat, mow the lawn, or some other task to kill the time. That’s because deployment of an Alexa Conversations-based skill can take anywhere from 20-60 minutes while the conversation model is run through the AI engine. If your changes only involve the fulfillment code, then it is much faster. But if you’ve made any changes to the conversation model, then be prepared to wait awhile.

Although the compile step catches most common mistakes, it is still possible that you’ll encounter an error when deploying the skill. So even if you step away for awhile, be sure to check in on it every so often in case there’s a problem that needs to be corrected.

Testing the Skill

Once the skill has been successfully deployed, you’re ready to test it. As with any Alexa skill, you have several options for testing. Unfortunately, automated testing tools like BST and the Alexa Skills Testing Framework have not yet caught up to Alexa Conversations. But you can still do manual testing with the ASK CLI, the developer console, or an actual device.

If you are planning to test with the ASK CLI, be sure to use the askx dialog command instead of the ask dialog command. The non-beta version of the ASK CLI isn’t Alexa Conversations-aware and won’t behave as you’d expect when interacting with a skill built with Alexa Conversations.

Using the ASK CLI as the testing tool, here’s an example of how to test an Alexa Conversations skill:

 $ ​​askx​​ ​​dialog​​ ​​--locale=en-US
 
 User > open star port seven five travel
 Alexa > Welcome to the Star Port 75 Travel.
  I can schedule an out-of-this-world trip for you.
  Just say "Plan a trip."
 User > plan a trip
 Alexa > where do you want to go?
 User > Jupiter
 Alexa > When will your trip start?
 User > June 9th
 Alexa > When will your trip end?
 User > June 21st
 Alexa > I've got you down for a trip to Jupiter. Is that right?
 User > yes
 Alexa > Enjoy your trip to jupiter!
 User >

As you can see, the conversation plays out in the ASK CLI almost identical to how it was described at the beginning of this chapter. Well done!

Now, let’s see how well our conversation model handles detours in the dialog path. Let’s test it with a case where the user changes their mind about where they want to go:

 $ ​​askx​​ ​​dialog​​ ​​--locale=en-US
 
 User > open star port seven five travel
 Alexa > Welcome to the Star Port 75 Travel.
  I can schedule an out-of-this-world trip for you.
  Just say "Plan a trip."
 User > plan a trip
 Alexa > where do you want to go?
 User > Jupiter
 Alexa > When will your trip start?
 User > June 9th
 Alexa > When will your trip end?
 User > June 21st
 Alexa > I've got you down for a trip to Jupiter. Is that right?
 User > Make that Neptune
 Alexa > I've got you down for a trip to Neptune. Is that right?
 User > yes
 Alexa > Enjoy your trip to Neptune!
 User >

Even though Alexa had already gathered all of the trip details and only needed confirmation, the user was able to specify a different destination. Alexa accepted the new destination, applied it to the conversational context, and then asked for confirmation of the new destination. This demonstrates one of the benefits of Alexa Conversations as compared to standard dialogs.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset