Custom NLP / NLU

Instead of using the Voiceflow NLU, it's easy to use a preferred custom NLP service.When making an API request, instead of using a TextRequest where the raw string of the user input is provided, use anIntentRequest and the default Voiceflow NLP is skipped.

Example Text Request:

{
  "action": {
    "type": "text", "payload": "can I get a pepperoni pizza?"
  }
}

NLP Resolved Intent Request:

{
  "action": {
    "type": "intent",
    "payload": {
      "query": "can I get a pepperoni pizza?", // (optional) original raw string of user input
      "intent": {
        "name": "order_pizza_intent" // name of the intent, as specified on Voiceflow
      },
      "entities": [ // array of matched entities, can be empty
        {
          "name": "pizza_type", // name of entity
          "value": "pepperoni" // value of entity
        }
      ]
    }
  }
}

So long as the intent generated by the custom NLP service is passed in as the IntentRequest format, Voiceflow will be able to generate the appropriate response.

Entity/Slot filling

If the intent on Voiceflow has required entities (i.e {pizza_size} for order_pizza_intent)
and it is not filled in the initial request, the entity will be prompted for and you can send a subsequent request with the same intent and the entities and Voiceflow will be able to automatically merge the initial entities with the new entities.

For example, on the Voiceflow project for the order_pizza_intent, both {pizza_type} and {pizza_size} are required.

  1. The user says "can I get a pepperoni pizza?",
  2. This gets resolved through the NLP service and sent to Voiceflow as order_pizza_intent with entity {pizza_type} equal to pepperoni
  3. The response will ask "what size pizza do you want?".
  4. The user says "small"
  5. The next request is order_pizza_intent with entity {pizza_size} equal to small
  6. Voiceflow continues the conversation knowing the user wants a small pepperoni pizza.

Note: on Step 5 any intent can be sent and resolved, it just needs to be the same intent to continue the entity filling