Building Conversations with Wit.Ai
The Wit.Ai NLP engine extracts meanings from chatbot input without accumulating data sequentially in a conversation, and without requiring the use of pre-defined parameters. Instead, for each user request the engine provides a single response and then immediately resets its context.
This means that Wit.Ai will not track user requests to build a conversational flow of information and will not perform slot-filling. Instead, you must parse all Wit.Ai responses within your Intent Flow in order to determine which Entity parameters have been provided and which are still missing when you wish to fulfill the current Intent (called a Trait Value in Wit.Ai).
When working with an Intent that requires values for multiple Entities (e.g., a travel bot that requires source and destination, flight dates, price range, etc.), you will need to query for each missing Entity using Intent Flow logic.
An Example Wit.Ai Intent Flow
The following example shows how an Intent Flow can be designed to create a conversation with the user in order to supply multiple required Entity values.
Our example Intent Request Pay Bill requires three Entities:
Bill Type
Bill Period
Payment Amount
![]() |
Stage | Description | |
1 | Initial user request data is parsed using an Allocator step. Because Wit.Ai resets the Session Context Session Variable data with each new request, we create a dedicated User Dynamic Variable (e.g., saved_data in the following example) to store all parsed Entity values for use during the Intent Flow.
When parsing Entities in Wit.Ai you can use the [0] array pointer, as shown in the above example, to access only the value of an Entity without any delimiters. | |
2 | We use a Decision Point step to determine whether a value was found for a specific required Entity in the parsed Wit.Ai response data.
| |
3 | We create a simple loop that asks the user to supply a value for the missing Entity. The user response is again checked using an Allocator and a Decision Point step. When the relevant value is supplied, the Intent Flow proceeds to the next required Entity. | |
4, 5 | For each required Entity, we again use a Decision Point step to check for valid values. As above, an internal loop is used to request and verify each missing value. | |
6 | When all required Entity values have been supplied, the Intent Flow proceeds to the fulfill the current Intent. |
The Intent Flow presented above would produce the following user chatbot conversation:
![]() |
The analyzed user request returned by Wit.Ai is stored only temporarily in the Session Context Session Variable. The Intent Flow parses this JSON data for Entity values and stores these in a Dynamic Variable that will be referenced throughout execution of the Flow.
Whenever a required Entity value is missing, the Flow requests it from the user as shown above. When all required values have been supplied, the Flow can proceed to fulfill the current Intent.
The above example is kept simple for the explanation purposes; your Flow can of course include other steps and elements that may be required to fulfill the Intent.