 Welcome back to another my my my my micro sound bites. I'm Stratus, and I'm Gez. And today we are going to be talking about ask selection, which is just another option similar to getResponse. So basically it's a way to have a list of objects that are being read to the user and ask them which one they want to choose. And with that I think we'll get right to it. So we're gonna take a look at the init file here. Unlike last time where we kind of inserted the lines there aren't very many to add this time so we went ahead and added them in advance. The first one that we added is a list of three things to hold your ice cream in whether it's a cup, a regular cone, or a waffle cone. The rest of the toppings validator doesn't change so we're moving down into the handle the shop ice cream. For the keen observers you'll notice that after the toppings that we covered in the last video we now have a speak dialog for the holder request. And then we've got this holder equals ask selection and so that's what we're gonna kind of deal with today. So I don't think we need to talk too much about what's happening with the speak dialog other than to say the holder equals self ask selection. We'll just simply read out the list of the holders that I showed you right at the top and then it will prompt you for which one. So in order to give it some sort of introduction we have Mycroft saying a short dialogue what would you like to have your ice cream in. That I think I'll hand it off to Chris and he can kind of walk us through some of the options for ask selection. So ask selection is a way of getting a response from the user in a very controlled very specific way. So it's probably easiest if we just go through the arguments here. So the first argument is gonna be a list you know in our case it's that that list of three strings as you just said Mycroft is gonna read those that list in order and place an or between the last two. So it's a list of two it'll say red or green if it's if it's our list of three it'll say A comma B or C and if it's only one thing then it will probably just read a single item but I don't know why you would be using it if you're only giving people one option and so once it's read that it's then gonna read the dialogue in the second argument this is an optional argument so if you don't put anything there it just won't say anything it will just read the three options and then open the microphone. The data object is specifically related to that dialogue file if there is any just like we speak dialogue if there's any dynamic data that we want to populate in in the dialogue file then we can do that. If we stopped there that would work in 99 percent of the cases. The remaining two arguments is it fourth one there minimum confidence so the way that our selection works is that whatever the user says it's gonna perform some fuzzy matching to see how likely is it that it's one of these options. If we used it with our toppings example before where we had things like nuts or whipped cream if someone said cream it's not gonna match exactly but there's gonna be a confidence level that it is the same as this other item and so we can we can change how confident we feel we need to be for that to match so obviously if you make that a really big number like closer to one it's gonna require it to be very close to the actual option and closer to zero means it's gonna match anything still gonna return the highest confidence levels so that's that's useful but anyway so that's minimum confidence anything under that like if no option you know meets that minimum confidence level then it will return none because the user didn't make an appropriate selection and finally we have a numeric argument you know by default it's false if you turn it to true it's gonna add a number in front of each of your options so rather than saying cup regular cone or waffle cone it's gonna say would you like one a cup to a regular cone or three a waffle cone that may or may not make sense in different scenarios so we turned it off by default but at a fair if you want to use it it's also a little bit helpful because you know most of the time people are gonna respond to a selection request by using the name of the thing so you know they'll say can I have a cup you know whatever but they can also use what's called an ordinal or you know a number the number of the the item in the list they said which of these options would you like and I said I'll take the second one then you would know that I'm referring to the second option that you read out and and mycrofts understands that as well so it's just gonna take whichever the second item in that list is and select that one the numeric argument is really just about the dialogue that's spoken and whether whether those numbers are added in or not but yeah that's it like it's it's a pretty straightforward one but it's a lot cleaner than get response if it meets your needs it's more constrained but it means that it's a bit easier to use and it's it's certainly cleaner in terms of code but maybe we should go try it out absolutely so through the magic of the internet we're going to trigger the skill and make sure that it works properly and we'll be back with that and you can see here what would you like in that and that's our dialogue file and then it gives us our choice and in this case we're gonna go with cup you get a match and the reason why it matches because we put in the confidence level there so I did put cups but it got close enough to the cup argument that it was able to figure out what it was that we wanted so we end up with a chocolate ice cream cone and a cup with nuts perfect and I mean the confidence level is useful you know in this in this example you look at regular cone verse waffle cone and so if someone just said cone then we wouldn't want to match with one of those we'd want to make sure that we know which type of cone that they want whereas if they said waffle then we could be pretty confident that they're choosing the waffle cone and not the regular cone was ask selection it was pretty simple I don't think there's too much to wrap up here you have a it will read a dialogue file if you need to it has a list that you feed in for the options that you give it and you can specify things like a confidence level to make sure that the match is more or less strict and you can also have it read out as a list so would you like one an apple to an orange three a banana but that's off by default and aside from that it's was pretty straightforward I think we added three lines of code and we got a similar a similar outcome as get response so I think that's kind of it for that unless there's something else you'd like to add now I'm not sure if I mentioned the even the the ore that is placed between the final two options will be translated so it's going to use the localized version of that string for whatever language the user is in but yeah it's pretty it's pretty straightforward hopefully hopefully that's helpful I think I'm really interested to know whether people watching along finding these slightly deeper dives on specific methods useful or if there's some other content that you're more interested in us diving around microsoft development what's going to help you get the most out of your voice assistant did you see Tony's comment from last time he left a comment asking us to cover something specific and I said you know we will definitely take a look at that one once we've cleared our docket so that's a good example of people trying to put things on our on our radar that they'd like us to cover cool thanks Tony all right well until next time until next time ciao