I am having trouble getting Alexa to understand any synonyms for the words I'm speaking to her. She will always return that she does not know the meaning of the synonym despite having added it as part of the intent schema:
{
"languageModel": {
"types": [
{
"name": "LIST_OF_DEFINITIONS",
"values": [
{
"id": "USER_EXPERIENCE",
"name": {
"value": "user experience",
"synonyms": [
"ux"
]
}
}
]
}
],
"intents": [
{
"name": "AMAZON.CancelIntent",
"samples": []
},
{
"name": "AMAZON.HelpIntent",
"samples": []
},
{
"name": "AMAZON.RepeatIntent",
"samples": []
},
{
"name": "AMAZON.StopIntent",
"samples": []
},
{
"name": "RecipeIntent",
"samples": [
"what is a {Definition}"
],
"slots": [
{
"name": "Definition",
"type": "LIST_OF_DEFINITIONS"
}
]
}
],
"invocationName": "digital dictionary"
}
}
Am I missing something?
Your synonym "ux" isn't going to be understood because the user won't pronounce it like a word but rather they will say two letters. So, try adding "u x" and "U.X.". That should work.
Related
I'm trying to query the Azure Cost Management API and I want to be able to filter the results based off of 2 different types of resource tags but I am having trouble figuring out the format. I can get the single tag filter working, but I'm blanking on the format for multiple. Can anyone throw in their 2 cents?
Working single filter query:
{
"type": "Usage",
"timeframe": "{TimeFrame}",
"dataset": {
"granularity": "None",
"filter": {
"tags": {
"name": "Environment",
"operator": "In",
"values": [
{Environment}
]
}
},
"aggregation": {
"totalCost": {
"name": "PreTaxCost",
"function": "Sum"
}
},
"grouping": [
{
"type": "Dimension",
"name": "{Aggregation}"
}
]
}
}
My attempt at adding more than one filter:
{
"type": "Usage",
"timeframe": "{TimeFrame}",
"dataset": {
"granularity": "None",
"filter": {
"tags": [
{
"name": "Environment",
"operator": "In",
"values": [
{Environment}
]
},
{
"name": "Location",
"operator": "In",
"values": [
{Location}
]
}
]
},
"aggregation": {
"totalCost": {
"name": "PreTaxCost",
"function": "Sum"
}
},
"grouping": [
{
"type": "Dimension",
"name": "{Aggregation}"
}
]
}
}
I am very new to Azure so please don't roast me too hard lol.
Thank you to everyone who took a look at my question, much appreciated even if you don't have an answer for me.
There was an issue with the way my parameters were set causing a bad query. Here is the working code with multiple tag attributes for filtering:
{
"type": "Usage",
"timeframe": "{TimeFrame}",
"dataset": {
"granularity": "None",
"filter": {
"and": [
{
"tags": {
"name": "Location",
"operator": "In",
"values": [{LocationTag}]
}
},
{
"tags": {
"name": "Environment",
"operator": "In",
"Values": [{EnvironmentTag}]
}
},
{
"tags": {
"name": "Integrated-System",
"operator": "In",
"Values": [{IntegratedSystemTag}]
}
}
]
},
"aggregation": {
"totalCost": {
"name": "PreTaxCost",
"function": "Sum"
}
},
"grouping": [
{
"type": "Dimension",
"name": "{Aggregation}"
}
]
}
}
I'm creating a basic calculator skill using ASK-SDK v2. I'm not sure how to get the slot values provided by the user into the Lambda code with the new version. I was able to make it work with the older version.
Conversation
User: Open calculate
Alexa: You can ask me to add, subtract, multiply and divide
User: Add two and three
Alexa: Sum of 2 and 3 is 5
Below is my IntentSchema
{
"interactionModel": {
"languageModel": {
"invocationName": "calculate",
"intents": [
{
"name": "AMAZON.CancelIntent",
"samples": []
},
{
"name": "AMAZON.HelpIntent",
"samples": []
},
{
"name": "AMAZON.StopIntent",
"samples": []
},
{
"name": "AddIntent",
"slots": [
{
"name": "numA",
"type": "AMAZON.NUMBER"
},
{
"name": "numB",
"type": "AMAZON.NUMBER"
}
],
"samples": [
"Sum of {numA} and {numB}",
"add {numA} and {numB}"
]
},
{
"name": "SubIntent",
"slots": [
{
"name": "numA",
"type": "AMAZON.NUMBER"
},
{
"name": "numB",
"type": "AMAZON.NUMBER"
}
],
"samples": [
"difference between {numA} and {numB}",
"subtract {numA} from {numB}"
]
},
{
"name": "ProductIntent",
"slots": [
{
"name": "numA",
"type": "AMAZON.NUMBER"
},
{
"name": "numB",
"type": "AMAZON.NUMBER"
}
],
"samples": [
"multiply {numA} and {numB}",
"product of {numA} and {numB}"
]
},
{
"name": "DivideIntent",
"slots": [
{
"name": "numA",
"type": "AMAZON.NUMBER"
},
{
"name": "numB",
"type": "AMAZON.NUMBER"
}
],
"samples": [
"divide {numB} by {numA}",
"divide {numA} by {numB}"
]
},
{
"name": "ExponentialIntent",
"slots": [
{
"name": "numA",
"type": "AMAZON.NUMBER"
},
{
"name": "numB",
"type": "AMAZON.NUMBER"
},
{
"name": "numC",
"type": "AMAZON.NUMBER"
}
],
"samples": [
"{numA} raised to the power of {numB} by {numC}",
"{numA} raised to the power {numB}"
]
},
{
"name": "AMAZON.NavigateHomeIntent",
"samples": []
}
],
"types": []
}
}
}
I'm adding the addintenthandler here. Please tell me if the approach I'm using to get the slot values from the intent is correct or if I should use sessionattributes
const AddIntentHandler = {
canHandle(handlerInput) {
return handlerInput.requestEnvelope.request.type === 'IntentRequest'
&& handlerInput.requestEnvelope.request.intent.name === 'AddIntent';
},
handle(handlerInput) {
var output1 = "";
var num1 = handlerInput.resuestEnvelope.request.intent.slots.numA.value;
var num2 = handlerInput.resuestEnvelope.request.intent.slots.numB.value;
if((num1)&&(num2)){
output1 = 'The sum of ' +num1+ ' and ' +num2+ ' is ' + (num1+num2);
}
else {
output1 = 'Enter valid number';
}
const speechText = output1;
return handlerInput.responseBuilder
.speak(speechText)
.reprompt(speechText)
.getResponse();
}
};
Alexa responds with "Unable to process requested skill response"
Any help is welcome
Update: there are now built-in functions in the SDK for this:
Alexa.getSlotValue() (returns the string value) and getSlot() (returns Slot object)
Alexa.getSlotValue(handlerInput.requestEnvelope, "someSlotName")
Old answer:
You have a typo, resuestEnvelope should be requestEnvelope. In any case I have created exactly the same skill, a calculator (in Spanish but it's basically the same thing) and I use a helper function called getSlotValues() which I encourage you to reuse. It will also work great when you have to capture custom slots (which are processed differently because the entity resolution structure is different):
https://github.com/germanviscuso/skill-sample-nodejs-mycalculator
I'm trying to migrate my action form Dialogflow, and the most important thing is the intent schema. But after uploading the .json file, the error Intent name must not be empty. Error code: MissingIntentName is thrown. Here is Intent schema.json
{
"intents": [
{
"intent": "SelectedSubjectsYes"
},
{
"intent": "UserIsOk",
"slots": [
{
"name": "okslot",
"type": "OK"
}
]
},
{
"intent": "SelectedSubjectsNo"
},
{
"intent": "UserIsNotOk",
"slots": [
{
"name": "not_okslot",
"type": "NOT_OK"
}
]
},
{
"intent": "DefaultWelcomeIntent"
},
{
"intent": "HowAreYou?"
},
{
"intent": "SelectedSubjects",
"slots": [
{
"name": "subjectslot",
"type": "SUBJECT"
}
]
}
]
}
I've in no way edited it, so why the error? Thanks in advance.
The JSON structure for interaction model is sightly different. This is how it should look now.
{
"interactionModel": {
"languageModel": {
"invocationName": "Your invocation name",
"intents": [
{
"name": "SelectedSubjectsYes",
"slots": [],
"samples": [
"provide sample for SelectedSubjectsYes intent",
"sample for SelectedSubjectsYes intent"
]
},
{
"name": "UserIsOk",
"slots": [
{
"name": "okslot",
"type": "OK"
}
],
"samples": [
"provide other samples for UserIsOk",
"I'm {okslot}",
"{okslot}"
]
},
{
"name": "SelectedSubjectsNo",
"slots": [],
"samples": [
"provide sample for SelectedSubjectsNo intent",
"sample for SelectedSubjectsNo intent"
]
},
{
"name": "UserIsNotOk",
"slots": [
{
"name": "not_okslot",
"type": "NOT_OK"
}
],
"samples": [
"provide other samples for UserIsNotOk",
"i'm {not_okslot}",
"{not_okslot}"
]
},
{
"name": "HowAreYou?",
"slots": [],
"samples": [
"provide sample for HowAreYou intent",
"sample for HowAreYou intent"
]
},
{
"name": "SelectedSubjects",
"slots": [
{
"name": "subjectslot",
"type": "SUBJECT"
}
],
"samples": [
"provide other samples for SelectedSubjects",
"i choose {subjectslot}"
]
}
],
"types": [
{
"name": "OK",
"values": [
{
"name": {
"value": "ok"
}
},
{
"name": {
"value": "yes"
}
}
]
},
{
"name": "NOT_OK",
"values": [
{
"name": {
"value": "not ok"
}
},
{
"name": {
"value": "nope"
}
}
]
},
{
"name": "SUBJECT",
"values": [
{
"name": {
"value": "Physics"
}
},
{
"name": {
"value": "Biology"
}
}
]
}
]
}
}
}
Rather than converting from Dialog flow, it's pretty easy to design one in Alexa skill builder. Also, it is recommended to use predefined AMAZON.YesIntent and AMAZON.NoIntent for "yes" or "no" utterances.
This is the interaction model I am using:
{
"interactionModel": {
"languageModel": {
"invocationName": "greeter",
"intents": [
{
"name": "HelloWorldIntent",
"slots": [
{
"name": "phrase",
"type": "phrase"
}
],
"samples": [
"{phrase}"
]
}
],
"types": [
{
"name": "phrase",
"values": [
{
"name": {
"value": "HelloWorldIntent asdf {phrase}"
}
}
]
}
]
}
}
}
Notice the value of phrase slot type. When I set it this way, whatever I say to alexa, whole of the raw query is getting populated in value field of phrase slot of the request object.
Ex:
"Launch greeter" ==> LaunchIntent (obvious)
"No matter what I say it triggers Hello world intent" ==>
"intent": {
"name": "HelloWorldIntent",
"confirmationStatus": "NONE",
"slots": {
"phrase": {
"name": "phrase",
"value": "no matter what I say it triggers hello world intent",
"resolutions": {
"resolutionsPerAuthority": [
{
"authority": "amzn1.er-authority.echo-sdk.amzn1.ask.skill.6c1d0991-f895-45fa-ba37-6880d3cc95f1.phrase",
"status": {
"code": "ER_SUCCESS_NO_MATCH"
}
}
]
},
"confirmationStatus": "NONE"
}
}
}
I am not able to figure out how this interaction model is giving me the raw query in "value" field of phrase slot.
I am creating custom Alexa skill, with custom slots. I have created predefined values for the slot and assigned an ID to each. During my tests I can see that in the service request there is no ID key-value pair:
"request": {
"type": "IntentRequest",
"requestId": "EdwRequestId.xXxxxxXXXx-xxXX-xXXx-xXXX-xxxXXXXXXxxx",
"intent": {
"name": "HowToIntent",
"slots": {
"action": {
"name": "action",
"value": "clear cache"
}
}
},
Is there any possibility to pass slot ID in the request?
"languageModel": {
"types": [
{
"name": "action",
"values": [
{
"id": "1",
"name": {
"value": "clear cache",
"synonyms": [
"flush cache",
"clean cache"
]
}
},
{
"id": "2",
"name": {
"value": "perform reindex",
"synonyms": [
"reindex",
"do reindex"
]
}
},
{
"id": "3",
"name": {
"value": "create a product",
"synonyms": [
"add product",
"make product"
]
}
},
{
"id": "4",
"name": {
"value": "create a category",
"synonyms": [
"add category",
"make category"
]
}
}
]
},
{
"name": "element",
"values": [
{
"id": "1",
"name": {
"value": "category tree",
"synonyms": [
"category structure",
"categories"
]
}
},
{
"id": "2",
"name": {
"value": "simple product",
"synonyms": []
}
},
{
"id": "3",
"name": {
"value": "gift card",
"synonyms": []
}
}
]
}
],
"intents": [
{
"name": "AMAZON.CancelIntent",
"samples": []
},
{
"name": "AMAZON.HelpIntent",
"samples": []
},
{
"name": "AMAZON.StopIntent",
"samples": []
},
{
"name": "HowToIntent",
"samples": [
"how to {action}"
],
"slots": [
{
"name": "action",
"type": "action"
}
]
},
{
"name": "WelcomeIntent",
"samples": [],
"slots": []
},
{
"name": "WhatIsIntent",
"samples": [
"what is {element}"
],
"slots": [
{
"name": "element",
"type": "element"
}
]
}
],
"invocationName": "my assistant"
}
}