Multiple slots with the same name

#1

Hi,

Is there any way to handle Snips responses with multiple slots of the same name with the Snips component?

An example would be a command like “Turn of the light in the office and in the kitchen” which would return 1 slot of type “device” (“light”) 2 slots of type “location” (“office” and “kitchen”).

Thanks!

0 Likes

#2

yes, just add training data with that build up as well and you will get multiple slots in the message.
and as always, there is a article by Psycho:

0 Likes

#3

Thanks Philipp, but my problem is on the Home Assistant side.

If I use the Snips and “Intent Script” components there then I only get one variable for each slot, and it seems that this variable always only contains the first result Snips sends.

I think I would have to write my one function to handle the MQTT response to get multiple slot entries with the same name, but maybe there is some way I didn’t see yet.

0 Likes

#4

Hmm, it is an odd case. Not sure what the best way to handle that would be. Can you provide me the mqtt that is generated when you have multiple slots? Can get it from the snips console.

0 Likes

#5
{
  "input": "das licht im wohnzimmer und in der küche einschalten",
  "intent": {
    "intentName": "rmweiss:LichtEinschalten",
    "probability": 0.70136356
  },
  "slots": [
    {
      "rawValue": "licht",
      "value": {
        "kind": "Custom",
        "value": "Licht"
      },
      "range": {
        "start": 4,
        "end": 9
      },
      "entity": "DeviceLicht",
      "slotName": "Device"
    },
    {
      "rawValue": "wohnzimmer",
      "value": {
        "kind": "Custom",
        "value": "Wohnzimmer"
      },
      "range": {
        "start": 13,
        "end": 23
      },
      "entity": "Location",
      "slotName": "Location"
    },
    {
      "rawValue": "küche",
      "value": {
        "kind": "Custom",
        "value": "Küche"
      },
      "range": {
        "start": 35,
        "end": 40
      },
      "entity": "Location",
      "slotName": "Location"
    }
  ]
}
0 Likes

#6

Sorry I know it has been a long time, but finally got done with some long projects on my end so revisiting. I will poke at this more since I think it is a valuable use case. Will let you know.

0 Likes