Using hierarchical entity as an action filter in LUIS

350 Views Asked by At

I added an action to an intent.

That action requires a parameter of type Fruit.

Fruit is a hierarchical entity [banana, orange, apple].

I expected when I passed in an apple then it would trigger that action but it doesn't and I'm not sure why?

enter image description here

The intent is successfully matched but not the action:

{
  "query": "eat an apple",
  "topScoringIntent": {
    "intent": "Eat",
    "score": 0.999997139,
    "actions": [
      {
        "triggered": false,
        "name": "Eat",
        "parameters": [
          {
            "name": "FruitType",
            "type": "Fruit",
            "required": true,
            "value": null
          }
        ]
      }
    ]
  },
  "intents": [
    {
      "intent": "Eat",
      "score": 0.999997139,
      "actions": [
        {
          "triggered": false,
          "name": "Eat",
          "parameters": [
            {
              "name": "FruitType",
              "type": "Fruit",
              "required": true,
              "value": null
            }
          ]
        }
      ]
    },
    {
      "intent": "None",
      "score": 0.04917145
    }
  ],
  "entities": [
    {
      "entity": "apple",
      "type": "Fruit::apple",
      "startIndex": 7,
      "endIndex": 11,
      "score": 0.916528642
    }
  ],
  "dialog": {
    "prompt": "FruitType missing",
    "parameterName": "FruitType",
    "parameterType": "Fruit",
    "contextId": "1b4333e4-4a00-4714-8041-4b9bacb1feb4",
    "status": "Question"
  }
}

Instead I have to specifically use parameter type of fruit::apple - which to me defeats the magic of the intent.

enter image description here

{
  "query": "eat an apple",
  "topScoringIntent": {
    "intent": "Eat",
    "score": 0.999997139,
    "actions": [
      {
        "triggered": true,
        "name": "Eat",
        "parameters": [
          {
            "name": "FruitType",
            "type": "Fruit::apple",
            "required": true,
            "value": [
              {
                "entity": "apple",
                "type": "Fruit::apple",
                "resolution": {}
              }
            ]
          }
        ]
      }
    ]
  },
  "intents": [
    {
      "intent": "Eat",
      "score": 0.999997139,
      "actions": [
        {
          "triggered": true,
          "name": "Eat",
          "parameters": [
            {
              "name": "FruitType",
              "type": "Fruit::apple",
              "required": true,
              "value": [
                {
                  "entity": "apple",
                  "type": "Fruit::apple",
                  "resolution": {}
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "intent": "None",
      "score": 0.04917145
    }
  ],
  "entities": [
    {
      "entity": "apple",
      "type": "Fruit::apple",
      "startIndex": 7,
      "endIndex": 11,
      "score": 0.916528642,
      "resolution": {}
    }
  ],
  "dialog": {
    "contextId": "93839bc8-a26a-436b-90c4-842891344ac6",
    "status": "Finished"
  }
}

Essentially this limitation means I could not have an EatFruit intent.

Instead I would have to have EatApple, EatBanana, EatOrange intents which is not really what I thought this was all about.

Am I doing it wrong or is this just how it's done? And if this is how it's done then whats the point of a hierarchical entity?

I may as well just use a plain old entity and then I can pass it anything [apple, banana, orange] but then it will also match on [pear] which I don't want.

0

There are 0 best solutions below