Rasa Core version:
0.11.7
Python version:
3.5.2
Operating system (windows, osx, ...): ubuntu
Issue: Form Action does not ask to fill required slots
Content of domain file:
slots:
requested_slot:
type: unfeaturized
location:
type: text
PERSON:
type: text
country:
type: text
place:
type: text
address:
type: unfeaturized
entities:
- GPE
- PERSON
- location
- address
intents:
- greet
- goodbye
- search_place
- save_information
actions:
- action_get_information
- utter_ask_field
- utter_submit
templates:
utter_happy:
- text: "I am happy"
utter_ask_address:
- text: "Address please ?"
utter_goodbye:
- "Bye"
- "Tye Tye"
- "Bye bye, see you soon :)"
utter_submit:
- text: "thanks for your information. "
forms:
- action_get_information
Content of story file:
## request information
* save_information
- action_get_information
- slot{"name": "action_get_information"}
## say goodbye
* goodbye
- utter_goodbye
## find restaurant
* restaurant_search
- action_show_restaurants
Content of actions file:
class UniversityForm(FormAction):
def name(self):
# type: () -> Text
"""Unique identifier of the form"""
return "action_get_information"
@staticmethod
def required_slots(tracker):
# type: () -> List[Text]
"""A list of required slots that the form has to fill"""
return ["address"]
def submit(self, dispatcher, tracker, domain):
# type: (CollectingDispatcher, Tracker, Dict[Text, Any]) -> List[Dict]
"""Define what the form has to do
after all required slots are filled"""
# utter submit template
dispatcher.utter_template('utter_submit', tracker)
return []
Can anyone help me to figure out why form action is not asking for required slots?
you need to add the form to your domain file, and also add a story that actually activates the form. Please refer to the docs here: https://rasa.com/docs/core/slotfilling/
@akelad i have made changes by following example of formbot in github.
In my case, form action is executed, but it directly execute utter_submit rather than filling address slot
@rameshjesswani you're using Rasa Core 0.11.7, documentation is for newer version 0.12.X. Library update should do the trick 馃槃
@marostr thanks . I updated it, but now i am getting this error:
"You have defined a form action, but haven't added the "
rasa_core.domain.InvalidDomain: You have defined a form action, but haven't added the FormPolicy to your policy ensemble.
@rameshjesswani sure! Have you tried adding - name: FormPolicy to your policies.yml?
sorry, i dont know where to create policies.yml , could you please elaborate more or provide relevant sources? I am following formbot example in github, i cannot see any policies.yml
I created policy.yml as:
policies:
- name: KerasPolicy
epochs: 50
max_history: 6
- name: MemoizationPolicy
max_history: 6
- name: FallbackPolicy
nlu_threshold: 0.8
core_threshold: 0.3
- name: FormPolicy
It worked. Thanks :)
I created
policy.ymlas:policies: - name: KerasPolicy epochs: 50 max_history: 6 - name: MemoizationPolicy max_history: 6 - name: FallbackPolicy nlu_threshold: 0.8 core_threshold: 0.3 - name: FormPolicyIt worked. Thanks :)
In the latest version v1.1.4 , this needs to be added to config.yml
Most helpful comment
@rameshjesswani sure! Have you tried adding
- name: FormPolicyto yourpolicies.yml?