I'm writing an Alexa skill that captures a ticket number from one intent and captures age from different intent. and Basically, these two are of type number.
When I'm trying to enter a number, it is being captured in the first Intent's slot. Here is my intent schema.
{
"intents": [
{
"slots": [
{
"name": "TicketNumber",
"type": "AMAZON.NUMBER"
}
],
"intent": "CheckStatusIntent"
},
{
"slots": [
{
"name": "ageAndCurrency",
"type": "AMAZON.NUMBER"
}
],
"intent": "ClientSuggestIntent"
}
]
}
and my sample utterances are
CheckStatusIntent I want to check on the status of a ticket
CheckStatusIntent {TicketNumber}
ClientSuggestIntent I have a client meeting tomorrow.
ClientSuggestIntent {ageAndCurrency}
ClientSuggestIntent {personName}
In my ClientSuggestIntent, the flow should be as below.
User: I have a client meeting tomorrow.
Alexa: What is the Client's name.
User: Sara John
Alexa: What is Sara John's age
User: 65
Here when I give 65, instead of matching with in the ClientSuggestIntent, it is matching with the TicketNumber of CheckStatusIntent.
This is very confusing, please let me know where am I going wrong and how can I fix this.
Thanks
You need to use "state handlers" do do this. Here is a video I did that explains how to do it. https://youtu.be/ukR0Aw5P3W8.
If you're using the ask-sdk for node you'd use Alexa.CreateStateHandler(...) to create one state handler with your CheckStatusIntent function in it and another state handler with your ClientSuggestIntent function.
Also read https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs#making-skill-state-management-simpler
To elaborate a bit on Steve's answer above, the problem is that Alexa cannot tell the difference between "CheckStatusIntent {TicketNumber}" and "ClientSuggestIntent {ageAndCurrency}" since both are just a number.
You need to either give Alexa a way to differentiate between each of your intents. For example, "ticket {TicketNumber}" and "my age is {age}".
Or alternatively, you can setup a context as described by Steve, and use a single intent to handle either/any number-only input.
I hope this helps clarify things. I know its complicated when your just getting started. I found it easiest to keep things very simple using multiple, unique intents.
Related
My Watson Conversation bots typically have a node where I load some data into context. This usually contains all possible answers, strings, various other data.
So one of my first nodes in any bot looks like this:
{
"type": "standard",
"title": "Load Messages",
"output": {
"text": {
"values": [
""
],
"selection_policy": "sequential"
}
},
"context": {
// A whole bunch of data here
}
...
Is there a limit on how much data I can put there? Currently I have around 70 kilobytes, but potentially I can put a few megabytes there just for the convenience of running the logic inside Conversation. (Yes I am aware that this entire data will be sent back to the client, which is not very efficient)
There is no documented limit. You are more likely to hit network issues before Watson Assistant has any issues.
But storing your whole applications logic in the context object is considered an anti-pattern.
Your context object should only store what is required in Watson Assistant, and then if possible only for the related portion of the conversation.
For one time context values you can store them in the output object.
{
"context": {
},
"output": {
...
"one_time_var": "abc"
}
}
This will be discarded on your next call.
If you have a large volume of data that could be used at different times, then one pattern to use is a context request object.
For example:
"context": {
"request": "name,address,id"
}
Your next response from the application layer would send this:
"context": {
"name" : "Bob",
"address": "123 street",
"id": "1234"
}
You have your returning response update those variables, then clear the context variables again. If you have other context variables that need to stay, then store those in an object and erase just that object.
I would like some help to build something a la https://pokeapi.co/ .
I have a problem when I try to make the following structure:
"forms": [
{
"url": "https://pokeapi.co/api/v2/pokemon-form/1/",
"name": "bulbasaur"
}
],
"stats": [
{
"stat": {
"url": "https://pokeapi.co/api/v2/stat/6/",
"name": "speed"
},
"effort": 0,
"base_stat": 45
},
]
Directus works fine when I have one relation field such as forms (make a new relation field to forms, get Bulbasaur, done)
I would have build monster and the stat table, and I need to give a value to the relation field stat (in that case, speed) of 45.
I tried to fiddle around with Directus with no success.
Hey André – it seems like this is more of a database architecture question. But here is a schema I would use:
monsters
id
name
stats (ALIAS: Many-to-Many interface relationship)
monster_stats (Junction table for the many-to-many)
id
monster_id
stat_id
stats
id
name
effort
base_stat
Hi My intent schema is like this:
{
"intents": [
{
"slots": [
{
"name": "Literalslot",
"type": "AMAZON.LITERAL"
}
],
"intent": "ConverseGenieIntent"
},
{
"intent": "AMAZON.HelpIntent"
},
{
"intent": "AMAZON.StopIntent"
},
{
"intent": "AMAZON.CancelIntent"
}
]
}
And my utterances are:
ConverseGenieIntent {hello|Literalslot}
ConverseGenieIntent {validate payroll|Literalslot}
ConverseGenieIntent {no no|Literalslot}
ConverseGenieIntent {no|Literalslot}
ConverseGenieIntent {no its not correct|Literalslot}
ConverseGenieIntent {no my payroll id is |Literalslot}
ConverseGenieIntent {its not correct|Literalslot}
ConverseGenieIntent {its wrong|Literalslot}
ConverseGenieIntent {no|Literalslot}
ConverseGenieIntent {that's not correct|Literalslot}
ConverseGenieIntent {that is not correct|Literalslot}
ConverseGenieIntent {hi yeah|Literalslot}
ConverseGenieIntent {what is your name|Literalslot}
ConverseGenieIntent {may i know your name please|Literalslot}
ConverseGenieIntent {hey what is your name|Literalslot}
My skill is actually a bot which gives multiple conversations.
Expected converstion:
User: Alexa ask genie to say hello.
Alexa: Welcome to genie.
User: Start session..
Alexa: Please tell me the store number?
User: one two three four
Alexa: Are you calling from BRAYBOOK 1234?
User: Yes
Alexa: Please tell me payroll ID?
User: 5678
(....and continues for at least three more conversations)
But while testing in Echo:
User: Alexa ask genie to say hello.
Alexa: Welcome to genie. Please tell me the store number?
User: one two three four
Alexa: Sorry i couldn't find that
.....ALWAYS THE CONVERSATION STOPS HERE....... I really don't know why... I don't wanna use dialog directives as the response from the lambda function comes from a DialogFlow bot.
I tested the skill in service simulator the skill is working fine!!! This problem happens only why i test my skill in Echo.
AMAZON.LITERAL takes one literal at a time. You can only say one or two or three ... at a time. Plus, if you want a group of literal to do further processing, then you have to use State Management to receive the input one by one.
Proposed Conversation
Alexa: Please tell me the store number?
User: one
Alexa: Next Number?
User: two
Alexa: Next Number?
User: three
Hey it not actually like that. Your answer is wrong. I don't have to give input as "One" then "two" and after it asks "three" ....No not like that. Inputs like "1234" can be given as it worked well in Echo device. Never test your skill in Echosim.io. Always test in an Amazon device.
I set up my intents using this intent schema:
{
"intents": [
{
"intent": "StartIntend"
},
{
"intent": "AMAZON.YesIntent"
},
{
"intent": "AMAZON.NoIntent"
}
]
}
My sample utterances look like this (it's german):
StartIntend Hallo
StartIntend Moin
StartIntend Guten Tag
Why does the Amazon Developer Console generate the following request, when I use the utterance "Yes" or "Ja"?
{
"session": {
"sessionId": "SessionId...",
"application": {
"applicationId": "amzn1.ask.skill...."
},
"attributes": {},
"user": {
"userId": "amzn1.ask.account...."
},
"new": true
},
"request": {
"type": "IntentRequest",
"requestId": "EdwRequestId...",
"locale": "de-DE",
"timestamp": "2017-02-17T21:07:59Z",
"intent": {
"name": "StartIntend",
"slots": {}
}
},
"version": "1.0"
}
Whatever I enter, it always is using the intend StartIntend.
Why is that? What have I forgotten / what have I done wrong?
The schema and utterance look correct.
I tried duplicating what you are seeing by performing the following steps:
Copied them as-is into a new skill on my account
Selected the North America region on the Configuration page.
Set the lambda to point to an existing lambda that I have. For testing purposes, I just need a valid ARN. I'm going to ignore the response anyways.
Then entered "Yes" into the service simulator
It indeed sent the Lambda the AMAZON.YesIntent.
So I conclude that there's nothing with the data you posted.
I tried entering Ja which resulted in the StartIntend, but I guess I would expect that since Ja is not "Yes" in North America.
Have you set the region to Europe, and entered a Lambda for the Europe region?
I talked about it with the Amazon Support. After some experiments it turned out, you have to write "ja" in lowercase. It seems to be a bug in the simulator itself.
When creating the skill in the Alexa Skills Kit, you need to choose the correct language i.e. German, see screenshot below.
Everything else seems to be correct.
I am writing a custom skill for the amazon echo and I need to get a unique device id so I can register then product to my service. Everything I read says that you cannot get the id from the device. Has amazon changed this? Is there a work around to get a device id?
This week Amazon added the Device ID (unique) to the LaunchRequest JSON payload in Alexa Skills.
{
"session": {
"new": true,
"sessionId": "string",
"application": {
"applicationId": "string"
},
},
"context": {
"device": {
"deviceId": "string",
},
"request": {}
}
You can use the context->device->deviceId string to uniquely identify the device from which the request came.
Read more # https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/alexa-skills-kit-interface-reference#request-body-syntax
There is no way to get a unique device ID. All you can do is get a unique User ID. There is no known workaround.
If you're looking for how to get Alexa Device ID?
Use the below snippet, It will work like a charm.
device_id = handler_input.request_envelope.context.system.device.device_id
I hope this helps you.