Custom Slot Type with AWS Lambda hook for Amazon Lex

安稳与你 提交于 2019-12-04 21:36:29

AWS exposes an API to dynamically create slot types, and updating the LEX bot. (see: http://docs.aws.amazon.com/lex/latest/dg/API_PutSlotType.html, and http://docs.aws.amazon.com/lex/latest/dg/API_CreateSlotTypeVersion.html)

In theory you could dynamically change this list when your data base has an update (may run into rate limiting issues though.)

However it does not appear that custom slot types limit valid responses like you think they do: http://docs.aws.amazon.com/lex/latest/dg/gl-guidelines.html

Specifically this bit:

Note the following about how Amazon Lex captures slot values from user utterances:

Amazon Lex uses the enumeration values you provide in a slot type definition to train its machine learning models. Suppose you define an intent called GetPredictionIntent with the following sample utterance:

"Tell me the prediction for {Sign}"

Where {Sign} is a slot of custom type ZodiacSign. ZodiacSign has 12 enumeration values (Aries through Pisces). From the user utterance "Tell me the prediction for ..." Amazon Lex understands that what follows is a zodiac sign.

If the user says "Tell me the prediction for earth", Amazon Lex infers that "earth" is possibly another ZodiacSign and passes it to your fulfillment activity. Therefore, your fulfillment activity must validate the slot values.

In other words, it appears to not be a enumeration list that is enforced.

Another example of the docs saying this: https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/migrating-to-the-improved-built-in-and-custom-slot-types#literal

A custom slot type is not the equivalent of an enumeration. Values outside the list may still be returned if recognized by the spoken language understanding system. Although input to a custom slot type is weighted towards the values in the list, it is not constrained to just the items on the list. Your code still needs to include validation and error checking when using slot values.

So even if you did dynamically create this custom slot type, it would only make the input somewhat lean in the direction of your predetermined options. Not restrict it to them.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!