Exporting and Importing Components7:21 with Ben Jakuben
Dialog models can quickly get pretty complex. Let's review a more detailed example and see how to export components from it and then import them into our own Conversation service.
So at this point, Armin, I could imagine that these dialogs can get pretty complex, 0:00 pretty quickly. 0:03 >> Yes, they can, as complex as you need them to. 0:05 You can build lots of intents, recognize lots of entities, and 0:08 control the dialog with lots of nodes and conditions. 0:12 >> In this car chatbot, 0:16 we have a lot more of those things built out in a more detailed example. 0:17 Let's take a look to see how a more complex bot looks, and 0:20 how we can copy some of it for our own bot. 0:24 So first you'll need to switch back to your Workspaces page. 0:27 We can expand this menu on the left, and click Back to workspaces. 0:30 And then this is the Car Dashboard sample that was created for 0:34 us when we created this workspace. 0:37 So if we click on this, we get a little note that it's being freshened up for us. 0:40 And here we can see lots of different intents. 0:45 And you can see on the right that these have lots of different samples built in. 0:48 So this #capabilities one has over a hundred different samples 0:55 about asking what kind of capabilities the chatbot has. 0:58 Same thing if we switch to the entities. 1:03 We can see there are a number of different entities with lots of values and 1:05 synonyms, and a more complex dialog. 1:08 So here we have an initializer, much like the welcome node that we saw in our own. 1:12 And then there's #turn_off, there's a #turn_up command here, and 1:17 different nodes that respond to different intents in this chatbot. 1:22 Just like our own, we can test this sample out. 1:28 We can say things like hi, what can you do? 1:30 And the bot tells us that it's trained to turn things on or 1:36 off in the car dashboard, cool. 1:39 So we can say yeah, find a nearby gas 1:40 station, and it says there's some gas stations nearby. 1:44 This is very similar to the sample that Arman walked us through earlier. 1:49 So one very cool thing that we can do is export these intents and 1:53 entities from this workspace into another. 1:56 Let's try it with the capabilities. 2:00 So I'm going to switch back to Intents, and I want to click on Export right here. 2:02 Then I can select everything that I want to export, 2:07 I'll just do #capabilities, give it a check box. 2:11 I'm gonna close the tester over here, and click Export. 2:14 And it looks like that was exported in comma separated values. 2:18 Let's take a look at how that looks. 2:22 And yeah, it's just a huge list of different 2:23 sample things that people might say to understand capabilities, interesting. 2:27 Right, I'm gonna close this. 2:33 And now we also want to export the corresponding entities. 2:34 So we have @capabilities_subject, I guess let's take that one. 2:38 Export @capabilities_subject, we'll get another CSV. 2:45 And now we can switch back to our own app. 2:50 So I'm gonna go back to Workspaces, click on the Treehouse Car Chatbot, and 2:53 we can just import the data. 2:58 Again, this is just a way to show how you might wanna do data entry 2:59 in a different format. 3:03 You could have somebody type a bunch of samples in a comma separated value, 3:04 some kind of text document, and then import them just like this. 3:08 So if I click Import, I can choose a file. 3:12 And I'll go to Downloads and I'll get the most recent file. 3:15 And you can see I've got multiple copies because I tried this before, but 3:20 I want the intent first. 3:24 So I'm gonna grab the intents file, click Open and Import. 3:26 After a moment we get a successful window here, 3:31 one new intent with 120 examples added. 3:34 And if I click on Done, 3:37 you can see all the different capabilities similar to what we saw in the sample. 3:39 And for completeness, let's do the same thing for entities. 3:44 We will Import, Choose a file, grab those entities, 3:47 which you can see in the file name here. 3:51 Click on Open, Import, get the success message, and 3:53 we get those @capabilities_subject. 3:57 Now, if we wanted to do dialog as well, then it's a bit further. 4:00 We need to export and import the whole workspace, right Armin? 4:03 >> Very true, at that point, we import a JSON file that would contain, 4:07 most likely, intent entities and a dialog format. 4:13 And that's a good point, we can do it for the whole workspace. 4:18 We could also create a node, I'm just gonna do this for a sample here. 4:22 And here in the response, we haven't looked at this yet, but 4:25 we can switch over to the JSON editor view. 4:29 And we could pick and choose Individual snippets of JSON, if we wanted to, for 4:32 a specific node, is that correct? 4:36 >> Very true, very true. 4:38 In fact, we use Span language in this JSON format to 4:39 build rather complex dialog structures. 4:43 >> Cool, very cool. 4:47 Okay, so I'm going to get rid of this node, because it's not doing anything, 4:50 Delete here. 4:54 [LAUGH] It gives me a nice warning, yes, I do wanna delete it. 4:55 And I'm gonna do the same double test as before. 4:58 First, I'm gonna open up and Watson looks like it's done training. 5:00 So I can ask this bot, what can you do? 5:05 And I should get a response. 5:08 This is because I didn't setup an actual dialog for it. 5:11 >> Very true. >> I would need to go ahead and 5:14 manually do it. 5:15 So let's do that real quick, actually, just to make this example complete. 5:16 We'll name this #capabilities, just like we did before to match the intent. 5:21 If the bot matches the new #capabilities intent, there it is in auto complete, 5:28 we'll enter a response like, I can turn on things like the radio, 5:32 heater, AC, and lights. 5:39 Okay, now I'm gonna close this. 5:45 And let's see, does Watson need to train itself on this one or 5:49 is that a pretty quick change? 5:52 Looks like it was a pretty quick change, so let's try it again. 5:53 What can you do? 5:57 And now, sure enough, it tells us it can turn things on and 6:01 off like the radio, etc. 6:03 >> Interesting to note, Ben, 6:05 the Watson training actually takes place when we build intent and entities. 6:07 >> Okay. >> Those are the two constructs that tap 6:12 into machine learning technologies. 6:16 The dialog really is a Boolean structure, a yes or 6:18 no that we can navigate through the tree. 6:21 >> Okay, that's nice. 6:25 So then when we were importing, it triggered some training, 6:26 which happened behind the scenes. 6:28 And it was already done before we even cared about it, which is great. 6:30 >> Indeed. 6:32 >> This is fantastic, Armin, thank you for walking us through the setup. 6:34 What do you say we take a little break, and then we make this chatbot even more 6:37 useful by adding in another Watson service called Discovery? 6:40 >> Sounds great. 6:44 There are so many meaningful ways to use these services together. 6:45 But discovery is particularly useful, 6:48 because it allows our bot to discover new answers that we don't program. 6:51 In fact, I often like to think of the discovery service as a area where 6:57 you find out things that you don't know that you don't know. 7:02 And I can trust that with a conversation service, that is where 7:06 at least you know what it is that you don't know, and then you may ask it. 7:10 We shall see more as the course progresses. 7:14 >> Sounds great. 7:18 All right, see you shortly. 7:19
You need to sign up for Treehouse in order to download course files.Sign up