Only getting single word parameters from Alexa Skills Kit
Asked Answered
M

4

7

I'm writing an Alexa Skill, and I can only get single word parameters into my code.

Here is the intent schema:

    {
  "intents": [
    {
      "intent": "HeroQuizIntent",
      "slots": [
        {
          "name": "SearchTerm",
          "type": "SEARCH_TERMS"
        }
      ]
    },
    {
      "intent": "HeroAnswerIntent",
      "slots": [
        {
          "name": "SearchTerm",
          "type": "SEARCH_TERMS"
        }
      ]
    },
    {
      "intent": "AMAZON.HelpIntent"
    }
  ]
}

and my sample utterances are:

HeroQuizIntent quiz me
HeroAnswerIntent is it {SearchTerm}

For the HeroAnswerIntent, I'm checking the SearchTerm slot, and I'm only getting single words in there.

So, "Peter Parker" gives "Parker", "Steve Rogers" gives "Rogers", and "Tony Stark" gives "Stark".

How do I accept multiple words into a slot?

Milda answered 7/4, 2016 at 16:34 Comment(4)
Any clues in the json structure you get? Nothing obvious. It might be worth posting the structure.Lette
Good point. Here's the pertinent portion of the request being sent to Lamda.Milda
"request": { "type": "IntentRequest", "requestId": "EdwRequestId.da0c74ea-15bd-45b9-a69e-76c523f08195", "timestamp": "2016-04-08T18:04:45Z", "intent": { "name": "HeroAnswerIntent", "slots": { "SearchTerm": { "name": "SearchTerm", "value": "Parker" } } } }, Milda
So, the SearchTerm slot still has just the last work of the what I'm telling Alexa. Seems like the issue would be in the Alexa voice interpretation then, and the only solution might be to accept multiple slots. That would be sad as it would make for some hellish logic in the lamda function.Milda
M
0

I had to change the Slot type to AMAZON.LITERAL.

The trick was that in the sample utterances, I also had to provide multiple utterances to demonstrate the minimum and maximum sizes of literals that Alexa should interpret. It's wonky, but works.

Here's the reference for it: https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/alexa-skills-kit-interaction-model-reference

Milda answered 11/4, 2016 at 2:58 Comment(0)
R
3

I've had same problem with my skill and that's the only solution which is worked for my skill to use several words, but you need to check are these slots not empty and concatenate them

Intent schema:

{
  "intent": "HeroAnswerIntent",
  "slots": [
    {
      "name": "SearchTermFirst",
      "type": "SEARCH_TERMS"
    },
    {
      "name": "SearchTermSecond",
      "type": "SEARCH_TERMS"
    },
    {
      "name": "SearchTermThird",
      "type": "SEARCH_TERMS"
    }
  ]
},

Sample utterance

HeroAnswerIntent is it {SearchTermFirst} HeroAnswerIntent is it {SearchTermFirst} {SearchTermSecond} HeroAnswerIntent is it {SearchTermFirst} {SearchTermSecond} {SearchTermThird}

And last one you need to put every of your words in separate line in SEARCH_TERMS slot definition

Also using AMAZON.LITERAL sometimes not pass variable into skill at all even if you test it using service simulator (skill console, test tab)

Repurchase answered 7/6, 2016 at 5:56 Comment(0)
B
1

The solution @Xanxir mentioned works equivalently with the newer custom slots format. In this case, you'd just put multiple length examples in your custom list of values for your slot type.

Bobinette answered 23/1, 2017 at 6:32 Comment(0)
M
0

I had to change the Slot type to AMAZON.LITERAL.

The trick was that in the sample utterances, I also had to provide multiple utterances to demonstrate the minimum and maximum sizes of literals that Alexa should interpret. It's wonky, but works.

Here's the reference for it: https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/alexa-skills-kit-interaction-model-reference

Milda answered 11/4, 2016 at 2:58 Comment(0)
S
0

AMAZON.SearchQuery

So you can use this in your utterances, and it will detect all words that the user speaks in between, Its rather accurate

It will solve your problem.

Ref Link: Alexa SearcQuery

Simasimah answered 26/6, 2018 at 4:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.