tinyapps
(Letisoft)
December 1, 2021, 12:55pm
1
Hello,
the problem I have is as follow:
I have a slot from_account. In a form the user will be asked to provide an account to make the payment form. “Please tell me from which account you would like to make the payment”.
tt_from_account:
type: text
influence_conversation: false
mappings:
- type: from_text
conditions:
- active_loop: tt_transfer_form
requested_slot: tt_from_account
the user can answer in many ways:
“from my saving account”
“from XXXX account”
“saving”
“1234”
in nlu data I can detect the account as entity if provided like “from my saving account”
but if provided like “saving” there is no entity detected.
As it is now I always get the slot filled with the text ass user entered it.
Ideally I want a mapping that : if entity is detected, use it as slot value, if not use the text as it is.
Is it possible with custom slot type?
Thanks!
ChrisRahme
(Chris Rahmé)
December 1, 2021, 1:05pm
2
Hello,
tinyapps:
Ideally I want a mapping that : if entity is detected, use it as slot value, if not use the text as it is.
Is it possible with custom slot type?
You can do exactly that with a FormValidationAction ’s extract()
method to get a custom slot mapping by writing some Python code
tinyapps
(Letisoft)
December 1, 2021, 2:00pm
3
Hello,
I already tried the same but seems it is not working, or at least not the way I understand it.
tt_amount:
type: text
influence_conversation: false
mappings:
- type: from_text
conditions:
- active_loop: tt_transfer_form
requested_slot: tt_amount
tt_from_account:
type: text
influence_conversation: false
mappings:
- type: custom
action: action_hello_world
I have another slot right before this one, but the action gets called on the first slot/start of the from. Indeed the custom action is called on every slot instead of being called on when this slot is required?
Thanks again!
ChrisRahme
(Chris Rahmé)
December 1, 2021, 2:40pm
4
Can you show me what you did in the FormValidationAction?
tinyapps
(Letisoft)
December 1, 2021, 3:01pm
5
I am using Action not FormValidationAction as I want only this slot to be custom.
So the action is called all the time and slot even gets overwritten.
Do you know when FormValidationAction is called (one every slot) and where I do declare it - in a custom slot?
Following the custom slot mapping docs:
slots:
day_of_week:
type: text
mappings:
- type: custom
action: action_calculate_day_of_week
ChrisRahme
(Chris Rahmé)
December 1, 2021, 4:11pm
6
Then you should use a FormValidationAction and implement its extract()
method for this slot only. You don’t need to implement all methods for all slots.
1 Like