Can't get the entity to return a user-entered value using Alexa slot type

amazon-alexa

#1

Hi there!

I am a super new user of Jovo and am trying out your new version 4. I can’t seem to use the Alexa slot type AMAZON.NUMBER in my seemingly simple entity.

Interaction model:

{
   "invocation": "jovo test",
   "version": "4.0",
   "intents": {
     "YesIntent": {
       "phrases": [
         "yes",
         "yes please",
         "sure"
       ]
     },
     "NoIntent": {
       "phrases": [
         "no",
         "no thanks"
       ]
     },
     "SetBudgetIntent": {
       "phrases" : [
         "{budget}",
         "set budget to {budget}",
         "set to {budget}"
       ],
       "entities": {
         "budget" : {
           "type": { "alexa": "AMAZON.NUMBER" }
         }
       }
     },
     "AMAZON.StopIntent" : {
       "phrases" : []
     }
   }
 }

The component: SetBudgetComponent:

import { BaseComponent, Component, Intents } from '@jovotech/framework';

import { YesNoOutput } from '../output/YesNoOutput';
import { BudgetValueOutput } from '../output/BudgetValueOutput';

@Component()
export class SetBudgetComponent extends BaseComponent {
 START() {
   return this.$send(YesNoOutput, { message: 'Welcome to your finance app! Do you want to set a budget ?' });
 }

 @Intents('YesIntent')
 // method to save the budget here 
 whatBudget() {
    return this.$send({ message: 'Ok, what do you want to set your budget to?' });
   // const budget = this.$entities.budget.value;
   // return this.$send({ message: 'Budget value is ' + budget })
 }

 @Intents('SetBudgetIntent')
 setBudget() {
   const budget = this.$entities.budget.value;
   console.log(budget)
   return this.$send({ message: 'Budget value is ' + budget })
 }

 @Intents('NoIntent')
 dontSetBudget() {
   this.$entities.budget = '200';
   return this.$send({ message: `I will continue with the current budget: ` + this.$entities.budget });
 }

 // UNHANDLED() {
 //   return this.START();
 // }
}

#2

Hey @sania_dsouza, welcome to the Jovo community :tada:

A few questions:

  • Where are you testing it?
  • What error are you getting?
  • Could you log this.$entities.budget?

Also, I’m not 100% sure if the notation you provided works. Could you try this?

return this.$send({ message: `Budget value is ${this.$entities.budget.value}` })

#3

Welcome to the community @sania_dsouza

Same question: Where are you testing? If it’s in the ASK Developer Console try to write out the number.
200 => “two hundred”

I had this issue a few years ago and it took me hours… Maybe they fixed it by now


#4

Hey guys!

Sorry for the delay!
I made that change @jan : printed ‘undefined’

@jan and @AlexSwe : Testing on the Jovo debugger. Entities is empty. I would expect entities to have a budget value?

Am I missing something?

Thank you!


#5

Thank you!

The Jovo Debugger uses NLP.js as NLU integration. This means that it can’t use custom Alexa slot types and that overall, the NLU results from the Debugger could differ from the actual live experience.

To solve this, there are a few different options that you can try:

  • Additionally test this the app in the Alexa Developer Console simulator (which uses the Alexa NLU and is closer than
  • For this entity, add an additional type for NLP.js
  • Test this portion of the app using buttons instead of text input. Learn more here: https://www.jovo.tech/docs/debugger-config
  • Use a different NLU for the Debugger, for example AWS Lex which is closer to the Alexa NLU. You can learn more here: https://www.jovo.tech/docs/debugger#nlu