3
votes

I am building a chatbot that asks the user a question with a wide range of possible responses, for example:

Bot: "What do you want your user bio to say?"

UserA: "My name is Bob. #chatbots are cool!!!"

or

UserB: "123"

I want Lex to accept virtually any user response. Currently, it will keep repeating the same question if the user response is not compatible with the existing slot.

Is there a built-in slot for this, or a way to build a custom slot that behaves this way?

3
is your problem solved if yes then please thell me how @jeffD23suraj rawat

3 Answers

1
votes

Within a Lambda initialization and validation hook you can call elicit slot in order to get back the entire user response as a parameter.

Have a look at some of the sample Lex lambda functions for an example of how to use elicit slot.

1
votes

You can create a slot without any value for the intent and uncheck the required checkbox. Then in Lambda initialization and validation hook, just grab the input of user from event['inputTranscript'] and assign that value to the slot.

Hope it helps.

1
votes

Lex does not have AMAZON.SearchQuery but one way to approach it is to include a lot of dissimilar values in the SlotType enumeration as is done in the Lex bot created by the CloudFormation stack from this blog post. The custom slot type in this case has 81 enumerated values including -

  • "is working in support good for my career"
  • "1234567890"
  • "Two"
  • "C"
  • "e"
  • "start the quiz"
  • "quit"

The slot value in this bot's case is used to search within an Elasticsearch instance.

You can try following that path. A custom slot type can have unto 10,000 enumerated values. Also note that the 'Expand Values' option has to be enabled.