Hi! I’m relatively new to Rasa and I’m finding difficult to recreate a fairly easy use case. The use case is the following:
- User: Hi! I'd like to transfer some money to Joe!
- Bot: You are going to send money to Joe
- Bot: How much do you want to transfer?
- User: How much money do I have in my bank account?
- Bot: You have X amount of money
- Bot: How much do you want to transfer?
- User: I want to transfer money to Mark instead.
- Bot: You are going to send money to Mark
- Bot: How much do you want to transfer?
- User: 100 dollars.
- Bot: Great! You will send 100 dollars to Mark.
So, If i’m not mistaken, the best way to deal with a use case similar to this one is by using forms. More particularly, a form that would fill the slot “value”. As far as I know, I can extract the entity “person” in the first sentence and associate it with a slot with the same name, without having to have a form.
This is my domain.yml.
**intents**:
- transfer
- balance
- inform
**entities**:
- person
- value
**slots**:
person:
type: text
mappings:
- type: from_entity
entity: person
value:
type: float
mappings:
- type: from_entity
entity: value
**forms**:
amount_form:
required_slots:
- value
**responses**:
utter_transfer:
- text: "You are going to send money to {person}"
utter_ask_value:
- text:"How much do you want to transfer?"
utter_balance:
- text:"You have X amount of money"
utter_submit:
- text:"Great! You will send {value} dollars to {person}"
This is my nlu.yml:
intent: transfer
examples: |
- Hi! I'd like to transfer some money to [Joe](person)!
- I want to transfer money to [Mark](person) instead.
- I want to send money to [John](person)
- Please, help me transfer to [Sophie](person).
intent: balance
examples: |
- How much money do I have in my bank account?
- How much money do I have?
- Do I have money?
intent: inform
examples: |
- [100](value) dollars
- [10](value)
- [200](value) euros
And finally, this is my rules.yml:
- rule: amount form activation
steps:
- intent: transfer
- action: utter_transfer
- action: amount_form
- active_loop: amount_form
- rule: submit amount form
condition:
- active_loop: amount_form
steps:
- action: amount_form
- active_loop: null
- action: utter_submit
- rule: ask for balance
steps:
- intent: balance
- action: utter_balance
Probably, there is something missing. This is the execution that I’m getting from my chatbot.
- User: Hi! I'd like to transfer some money to Joe!
- Bot: You are going to send money to Joe
- Bot: How much do you want to transfer?
- User: How much money do I have in my bank account?
- Bot: You have X amount of money
- Bot: How much do you want to transfer?
- User: I want to transfer money to Mark instead.
- Bot: You are going to send money to **Joe**
- Bot: How much do you want to transfer?
- User: 100 dollars.
- Bot: Great! You will send 100 dollars to **Joe**.
I didn’t change the default config.yml file. Thank you so much in advance!