keatontaylor / alexa-actions

A README and associated code to get actionable notifications setup for Alexa devices.
GNU General Public License v3.0
399 stars 187 forks source link

update interactionModels for string intents #181

Closed FreddyTheNut closed 1 year ago

FreddyTheNut commented 1 year ago

This addresses the issues https://github.com/keatontaylor/alexa-actions/issues/177 and https://github.com/keatontaylor/alexa-actions/issues/178

The slot-type AMAZON.SearchQuery can no longer use a space as the carrier phrase. When attempting to import or update an interaction model, the following error message is thrown: Sample utterance " {Strings}" in intent "String" must include a carrier phrase. Sample intent utterances with phrase types cannot consist of only slots.

The cause of this error is the following code: { "name": "String", "slots": [ { "name": "Strings", "type": "AMAZON.SearchQuery" } ], "samples": [ " {Strings}" ] }.

A comment from @marloncarvalho https://github.com/keatontaylor/alexa-actions/issues/177#issuecomment-1529620323 suggests adding a word before {Strings} resulting to: { "name": "String", "slots": [ { "name": "Strings", "type": "AMAZON.SearchQuery" } ], "samples": [ "hi {Strings}" ] }

However, this workaround has the downside of only recognizing a ResponseString with the added word.

To address this issue, the slot-type AMAZON.Person can be used instead. For now, this slot-type does not require a carrier phrase in the samples, which fixes the problems described.

FreddyTheNut commented 1 year ago

I tested this approach with the English and German interaction models. Although it might sound like using AMAZON.Person instead of AMAZON.SearchQuery may break long string recognition, I was still able to communicate full sentences and the Alexa skill matched the response types with the associated values for Home Assistant.