Return to site

Slot Value Alexa

broken image


Get slot value alexa python

I am trying to get the slot value and access it later but I am not able to get the value. Can you please help me. This is the line i am stuck with. How do i get the response the from slot and save it to the variable. Textoutput = intent'slots'.'slotsname'.'value' code. A separate slot type algorithm predicts the type of slot value from four values ('Yes,' 'No,' 'Don't care,' and 'Span') if the slot carryover model updates the slot name and slot.

Update February 2018 - The new phrase slots are now the recommended way to collect less-predictable input. Learn more.

Value

I am trying to get the slot value and access it later but I am not able to get the value. Can you please help me. This is the line i am stuck with. How do i get the response the from slot and save it to the variable. Textoutput = intent'slots'.'slotsname'.'value' code. A separate slot type algorithm predicts the type of slot value from four values ('Yes,' 'No,' 'Don't care,' and 'Span') if the slot carryover model updates the slot name and slot.

Update February 2018 - The new phrase slots are now the recommended way to collect less-predictable input. Learn more.

Today's post comes from J. Michael Palermo IV, Sr. Evangelist at Amazon Alexa. You will learn why you should use a custom slot instead of the soon to be deprecated AMAZON.LITERAL.

We've been listening to your feedback for Alexa feature requests and questions. As such, this post provides details around the deprecation of literal slots. By the time you finish reading this post, you will see it doesn't matter that the LITERAL slot type is going away because it already has a better replacement: custom slot types.

Before we get into the details, it's clear that the community needs more time to experiment with custom slot types and to make the transition. So, we're moving the LITERAL deprecation date for US skills to Feb 6th 2017. From the beginning, custom slot types (and not LITERAL) have been the solution in the UK or Germany.

Slots let you to build interaction models and pass phrases from the user to your skill. Amazon provides a set of built-in slot types that cover common things like numbers, names, and dates. Custom slot types go beyond these to enable support for the scenarios that you've chosen to build. They are a superset of the LITERAL slot type that we're deprecating.

This post will describe how to support three common LITERAL scenarios we've seen.

Scenario 1: I want to collect an arbitrary word or phrase from what the user said.

Imagine a situation where you want to gather information from users that you don't know when you build your interaction model. Examples include things like lists of wines, items in a game, names of cities, nicknames, etc. It's clear that you could build a custom slot with all the values that you do know but how do you handle the values that you don't or can't know?

First, be sure to check the list of built-in slot types. You may find something that we've already built for you like first names, city names, last names, dates, numbers, and many more.

When you create a custom slot type, a key concept to understand is that this is training data for Alexa's NLP (natural language processing). The values you provide are NOT a strict enum or array that limit what the user can say. This has two implications 1) words and phrases not in your slot values will be passed to you, 2) your code needs to perform any validation you require if what's said is unknown.

Let's look at an example of how to build support for something like nicknames. The custom slot type is named NICKNAMES. The custom slot values are shown here:

The intent schema uses NICKNAMES instead of AMAZON.LITERAL, and the sample utterances don't require any sample slot data.

The following interactions that include nicknames not in the custom slot values yield the same as a LITERAL slot:

UtterancesValue
'to make my nickname super nerd'super nerd
'to address me as master chief'master chief
'to call me head of household'head of household

Notice that in addition to achieving the desired functionality, custom slots also have a couple of extra benefits. Rather than having to add training data directly in the sample utterances like, SetNickname call me {geek|AMAZON.LITERAL} and SetNickname to nickname me {techie| AMAZON.LITERAL}, you can now add training data to improve accuracy once to the custom slots values and that training will apply to all utterances using the Nickname slot. So, it's easier to tune for accuracy and utterance management is simpler.

Scenario 2: I want to instrument what users are trying to do with my skill.

If you expand your use of custom slot types to cover the grammar of your utterances, you can increase the number of variations that you train with the same or simpler utterance list.

Additionally, you can now collect the values for Action, Moniker, and Nickname so you can track how people are making the requests to set their nickname. It's possible that people would say something like 'use Paul as my tag'. With this, you could log an action of 'use' and a moniker of 'tag' and then update your code if those become popular.

You can also pass this data off to post processing, like sentiment analysis, and you can use elements like the Action or the Moniker to tune the response. (Ex: 'ok, I've set your tag to Paul')

To do this, you'd add more custom slots:

You'd also add custom slot values for Actions like:

You'd also add custom slot values for Monikers such as:

Scenario 3: I just want everything.

The new phrase slots, introduced in February 2018 are now the recommended way to collect less-predictable input. Learn more by reading this blog post.

Summary

Yes, a custom slot type can do everything the LITERAL slot type can do, but with simpler management of training data and easier to read sample utterances. Transitioning from LITERAL to custom slot types is primarily done in the Interaction Model section of the developer portal, not in code. There is literally no reason to hesitate using custom slots today!

Special thanks to Paul Cutsinger, Josh Campbell, and Sara Schertz for their technical contributions!

Amazon have released a fabulous new update to the way Alexa works. If a user makes a request without a skill name and Alexa can't handle it, machine learning kicks in and some of the most likely skills to handle it are sent a new kind of request asking if they could handle it. Based on the responses from those skills the most appropriate can then be used to handle the request. This post is showing you how to enable your skill to take advantage of this new functionality with the latest Alexa.NET.

For more details you can always check out the Alexa blog article

Slot Value Alexandria

This feature is currently in Beta with Amazon & Alexa, and as it alters the structure of the core response object – I felt the change required a beta of Alexa.NET until we're sure of the changes. To that end, this post was written after we released Alexa.NET v1.5.5-pre and will hopefully be updated once the feature comes out of Beta

The new request type

So to allow for this new skill discovery process, your skill will receive a new request, of type CanFulfillIntentRequest. The request structure is pretty much the same as an intent request, with all the usual information.

This is on purpose, as Amazon want this extra set of data to require as little alteration as possible to your existing skill code (it's that code that made them pick your skill a a candidate after all!)

Depending on the logic you could handle the same thing with similar logic.

Adding fulfillment information to your response

So you've checked the intent data, you know if you can handle it or not – how do you let Amazon know?

Fulfillment is expressed by use of a new property against the response body, alongside card and output, CanFulfillIntent. This describes whether or not your skill can handle the information, were it sent as part of a real request. The final response in the JSON looks like this

{
'canFulfill': 'YES',
'slots': {
'slotName': {
'canUnderstand': 'YES',
'canFulfill': 'NO'
}
}
}

CanFulfill

This is your confidence on whether or not you can actually handle this request.
Yes: Totally, not a problem, it's an intent I understand and all the slots make sense
Maybe: I get it, it's an intent I get, but maybe the customer would need to answer some more questions, link their account, do some more work to really know.
No: No idea what you're talking about, why are we still talking?

Slots

Each slot has an entry as well, which you can optionally fill in to show what you can and can't handle:
canUnderstand: The confidence your skill has about understanding the slot value. It's a yes/no/maybe situation, but there are a lot of specific rules on this one, so I'd recommend checking out the docs
canFulfill: Just because your skill understands the value, doesn't mean you can deal with it. So this is a yes/no value that says whether or not you can do something with the value to fulfill the intent.

Alexa Slot Value Undefined

So you send this response, using code like the following:

and then Amazon can decide whether or not to use your skill for the real request (yeah, I'm going to try and write a Pull Request to tidy that up a bit, but you see how it maps – right?)

Alexa Skill Slot Value

I think this a great move and should allow well crafted skills to gain more traction by themselves.





broken image