Not getting input value (entities)

v4

#1

Hello all,

I am new in jovo, I have tried to getting input value, another words not getting dynamic entity value.

Models JSON file
{
“invocation”: “my test app”,
“version”: “4.0”,
“intents”: {
“BuscaIntent”: {
“phrases”: [
“test {name}”,
“test thanks”
],
“type”: “INTENT”,
“intent”: “BuscaIntent”,
“entities”: {
“name”: {
“value”: “max” // I have tried but not get. And need to set dynamic value
}
}
}
}
}

Component code:
@Intents([‘BuscaIntent’])
async busca() {
this.$entities.BuscaIntent;
console.log(this.$entities); //blank array
console.log(this.$entities.name?.value) //undefined
}

Have followed Jovo document URL : https://www.jovo.tech/docs/entities#access-entities
Please suggest how to getting dynamic entities name.
Thank You


#2

Hello,

I have set up the configuration and tried all possible solutions and changes in model JSON but not getting entities value {name}. Tried a lot by finding it in the Jovo document but didn’t get any solution. I have tried this.$input.text but return full search string but I need only {name} only. Please help how to get entities value.
If it is possible please give me an example link for that because more things will be clear from the example.

Thank You


#3

Hey @Ankur_Kumawat

This is an example that worked for me:

models/en.json

{
  "invocation": "my test app",
  "version": "4.0",
  "intents": {
    "MyNameIsIntent": {
      "phrases": [
        "{name}",
        "my name is {name}",
        "i am {name}",
        "you can call me {name}"
      ],
      "entities": {
        "name": {
          "type": "nameType"
        }
      }
    }
  },
  "entityTypes": {
    "nameType": {
      "values": ["Max", "John", "joe", "jane"]
    }
  }
}

components/GlobalComponent.ts

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

@Global()
@Component()
export class GlobalComponent extends BaseComponent {
  LAUNCH() {
    return this.$send(`Hey! What's your name?`);
  }

  @Intents(['MyNameIsIntent'])
  nameIsIntent() {
    return this.$send(`Hi ${this.$entities.name?.resolved}`)
  }
}

This is the result:


#4

Hello, Thanks for the reply,

How can I get a dynamic entity name?
Because username can search anything.


#5

https://www.jovo.tech/docs/entities#:~:text=Currently%2C%20this%20feature%20is%20supported%20by%20the%20Alexa%20and%20Google%20Assistant%20platforms

Unfortunately, it’s not possible with nlpjs. However it works on Alexa and Google Assistant


#6

Hello,
Thanks for the reply.
But Alexa and Google Assistant not working in V4 Jovo Debugger.