I am using Rasa 1.0.1, and am attempting to do something similar to the formbot example.
I have created my own custom form, then I run rasa shell
, but when the action for this form is called, I get the following error with no other explanation:
Your input -> hi
Hey! What can I do for you?
Your input -> find me a room
2019-05-30 17:09:26 ERROR rasa.core.processor - Encountered an exception while running action 'hotel_book_form'. Bot
will continue, but the actions events are lost. Make sure to fix the exception in your custom code.
Let me find you a hotel in None from None until None
Here are my files:
stories.md
## happy path
* greet
- utter_greet
* hotel.book
- hotel_book_form
- form{"name": "hotel_book_form"}
- form{"name": null}
- utter_slots_values
* goodbye
- utter_goodbye
domain.yml
%YAML 1.1
---
actions:
- utter_goodbye
- utter_greet
- utter_slots_values
intents:
- affirm
- deny
- goodbye
- greet
- hotel.book
entities:
- location
- checkin-date
- checkout-date
slots:
location:
type: unfeaturized
auto_fill: false
checkin-date:
type: unfeaturized
auto_fill: false
checkout-date:
type: unfeaturized
auto_fill: false
forms:
- hotel_book_form
templates:
utter_goodbye:
- text: Bye
utter_greet:
- text: Hey! What can I do for you?
utter_ask_location:
- text: What city do you need a hotel in?
utter_ask_checkin-date:
- text: What date will you be arriving?
utter_ask_checkout-date:
- text: What date do you want to checkout?
utter_slots_values:
- text: Let me find you a hotel in {location} from {checkin-date} until {checkout-date}
actions.py
from typing import Dict, Text, Any, List
from rasa_sdk.forms import FormAction
from rasa_sdk import Tracker
from rasa_sdk.executor import CollectingDispatcher
class HotelBookForm(FormAction):
def name(self) -> Text:
return "hotel_book_form"
@staticmethod
def required_slots(tracker: Tracker) -> List[Text]:
return ["location", "checkin-date", "checkout-date"]
def submit(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict]:
dispatcher.utter_template('utter_submit', tracker)
return []