Hi! I am new to Rasa. So, I am having a hard time in using categorical slots for my basic example bot. I have provided my stories.md, action function and domain.yml below.
stories.md
## fallback
- utter_nodata
## Story 1
* greet
- utter_greeting
* inform{"subcategory": "laser"}
- slot{"subcategory":"laser"}
- utter_feature
* inform{"feature": "Google Cloud"}
- slot{"feature":"Google Cloud"}
- utter_price
* inform{"price": "150"}
- action_get_printer
## Story 2
* greet
- utter_greeting
* inform{"subcategory": "inkjet"}
- slot{"subcategory":"inkjet"}
- utter_feature
* inform{"feature": "Air Print"}
- slot{"feature":"Air Print"}
- utter_price
* inform{"price": "200"}
- action_get_printer
## Story 3
* greet
- utter_greeting
* inform{"subcategory": "I don't know"}
- slot{"subcategory":"I don't know"}
- utter_feature
* inform{"feature": "Amazon Dash"}
- slot{"feature":"Amazon Dash"}
- utter_price
* inform{"price": "100"}
- action_get_printer
domain.yml
intents:
- greet
- inform
entities:
- subcategory
- feature
- price
slots:
subcategory:
type: categorical
values:
- Laser
- Inkjet
- I don't know
feature:
type: text
price:
type: float
actions:
- utter_greeting
- utter_feature
- utter_price
- utter_nodata
- action_get_printer
templates:
utter_greeting:
- text: "Hello. Which type of printer do you need?"
utter_feature:
- text: "Any specific feature that you would like in your printer?"
utter_price:
- text: "What is the upper cap of your budget?"
utter_nodata:
- text: "Sorry, we don't have that data"
action
class getPrinterInfo(Action):
def name(self):
return 'action_get_printer'
def run(self, dispatcher, tracker, domain):
sub_category = tracker.get_slot('subcategory')
feature = tracker.get_slot('feature')
price = tracker.get_slot('price')
message = f'The {sub_category} with {feature} and cheaper than {price} is:'
dispatcher.utter_message(message)
return []