I am making a script for building a route to a specific object. If the user asks to find a category of a place (a cafe, for example), then one answer should be displayed. If the question contains the name of a place (KFC), then a different answer should be displayed.
It is also important to make sure that the previous values of some slots are reset before starting the work of the state in order to avoid context errors.
Here is what I have now:
nlu.yml:
# LOOKUPS =====
- lookup: placeName
examples: |
- KFC
- Ibis
- ATC
- lookup: placeCategory
examples: |
- Food
- Rest
- Bank
# INTENTS =====
- intent: searchStart #Just a few examples. In fact there are many more
- examples: |
- Find a [Food]{"entity":"placeCategory"}
- Find a [KFC]{"entity":"placeName"}
rules.yml:
- rule: find a place
steps:
- intent: searchStart
- action: utter_search
- action: destination_form
- active_loop: destination_form
- active_loop: null
- slot_was_set:
- requested_slot: null
domain.yml:
# SLOTS =====
slots:
placeName:
type: text
influence_conversation: True
mappings:
- type: from_entity
entity: placeName
placeCategory:
type: text
influence_conversation: True
mappings:
- type: from_entity
entity: placeCategory
# ENTITIES =====
entities:
- placeName
- placeCategory
# FORMS =====
forms:
destination_form:
required_slots:
- placeName
- placeCategory
# RESPONSES =====
responses:
utter_search:
- condition: #The condition must work for any correct and not null value in the slot
- type: slot
name: placeName
value: true
text: "Show a list of places with a name {placeName}"
- condition:
- type: slot
name: placeCategory
value: true
text: "Show a list of places with a category {placeCategory}"
- text: "not found"
There are some problems here:
- The form works only once (none of the answers are displayed).
- Conditions in responses only work if “value” is a specific value in the slot (e.g. “value: ‘KFC’”).
What am I doing wrong?