Rasa Core version: 0.9.0a3
Python version: Python 2.7
Operating system (windows, osx, ...): Linux
Issue:
In the below link:
https://core.rasa.com/master/patterns.html
I want to include the below the code into my rasa-bot :
Custom Slots
from rasa_core.slots import Slot
class NumberOfPeopleSlot(Slot):
def feature_dimensionality(self):
return 2
def as_feature(self):
r = [0.0] * self.feature_dimensionality()
if self.value:
if self.value <= 6:
r[0] = 1.0
else:
r[1] = 1.0
return r
I have a slot named 'num_people' in my '.yml' file which has limitations on the value. How do I connect the above class "NumberOfPeopleSlot" to my slot 'num_people' ? I couldn't find how to do that in the documentation ?
Can someone tell me what is the variable 'type_name' in line 14 in the below link ?
https://github.com/RasaHQ/rasa_core/blob/0.9.0/rasa_core/slots.py
if you make this code part of a module, you can refer to it in your domain yml by its path:
you can e.g. save it as a file : my_slots.py and in your yaml write my_slots.NumberOfPeopleSlot
@amn41
Consider the below to be my current 'yaml' file. Can you tell me where to write my_slots.NumberOfPeopleSlot if I want it work on the slot "people" ??
intents:
- greet
- default
- goodbye
- affirm
- thank_you
- change_bank_details
- simple
- hello
- why
- next_intent
entities:
- name
slots:
name:
type: text
people:
type:text
templates:
utter_greet:
- "hey there {name}!"
utter_goodbye:
- "goodbye :("
- "bye bye"
utter_default:
- "default message"
actions:
- utter_default
- utter_greet
- utter_goodbye
Thanks in advance,
you would set the type of the people slot to my_slots.NumberOfPeopleSlot, so:
type: my_slots.NumberOfPeopleSlot
Got it.
It is not intuitive. So, I think you should add it in the documentation as well.
Thanks,
Thanks for the feedback! I'll close this issue for now, let us know if there's other issues.
Can we add this small information into the documentation?
Shouldn't it be possible for the stories to be trained using the class labels rather than individual examples?
If I have 3 classes - 'a' = x < 1000, 'b' = 1000 < x < 5000, 'c' = 5000 < x, I should be able to specify my actions using these class labels instead of giving examples of values x can take like 454, 1023, 6035, etc.
Please post these kind of questions in our forum
Most helpful comment
Can we add this small information into the documentation?