assistant-conversation-nodejs icon indicating copy to clipboard operation
assistant-conversation-nodejs copied to clipboard

Slot filling transforms parameter to lowercase

Open TheConen opened this issue 4 years ago • 1 comments

When using slot filling for a slot whose name consists of lower and upper cases, the slot name in the conv.intent.params object will be completely lower case when the slot is filled by slot filling (the user didn't specify the slot in his utterance and Assistant asks the user for a value), but it will be as expected when the user specifies the slot value in his utterance.

Example / Steps to reproduce:

  • Create a custom type searchTerm (in my case it's a free form text type)
  • Create an intent SearchIntent with the intent paramater searchTerm of data type searchTerm
  • Add the training phrases search and search for <searchTerm>
  • Create a scene that will call intent SearchIntent when it is matched and then transitions to a slot filling scene, e.g. SearchIntentSlotFilling
  • Customize the prompts (e.g. "What would you like to search for?")
  • Call your webhook when slot filling status is FINAL

Scenario 1:

  • User invokes SearchIntent by saying "Search for cameras"
  • Slot is filled, Assistant calls webhook
  • In webhook, slot is available under conv.intent.params.searchTerm, as expected

Scenario 2:

  • User invokes SearchIntent by saying "Search"
  • Slot is not filled, Assistant asks user "What would you like to search for?"
  • User says "cameras"
  • Slot is now filled, Assistant calls webhook
  • In webhook, slot is available under conv.intent.params.searchterm, which breaks code that expects conv.intent.params.searchTerm

Workarounds:

  • Only use lower cases in slot type names (search_term)
  • Use option "Customize slot value writeback" which seems to work correctly. However, this writes the slot value to a session parameter instead of an intent parameter which might be undesired. It also doesn't offer access to the original and the resolved value.
  • Use conv.scene.slots.searchTerm.value - however, this doesn't offer access to the original and the resolved value

On another note, there is a typo/mistake in the documentation for reading intent parameters, it should be:

conv.intent.params['param_name'].original
conv.intent.params['param_name'].resolved

instead of

conv.intent.params.['param_name'].original
conv.intent.params.['param_name'].resolved

TheConen avatar Jan 20 '21 14:01 TheConen

Thanks for finding this typo. I'll check out your repro case as well.

Fleker avatar Jan 22 '21 21:01 Fleker