-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom and dynamic slots #329
Conversation
@samsucik I imagined something along these lines. What do you think? |
b3887a6
to
a9f8d70
Compare
Looks good to me at a high level :-) Would |
I thought about it and decided that this would be something they should implement themselves. I want to avoid to change something for users who are just using this to validate their slots. |
That's fair. Though I think we should in some way communicate that the intended pattern (when one wants to change the required slots dynamically) is to call |
Also, I think that with |
Makes sense 👍 We can fill |
Hmmm, this is an interesting idea. While it hides the "meta layer" even more, I think it also makes it very clear to the user how |
How about we only return a |
Sounds good to me! Together with an explanatory comment in |
a9f8d70
to
2c70b51
Compare
6a1f1b2
to
1b61035
Compare
@samsucik Could you please have another look? I split it up in |
1b61035
to
b41b82e
Compare
b41b82e
to
01be28e
Compare
tracker: "Tracker", | ||
domain: "DomainDict", | ||
) -> Optional[List[Text]]: | ||
return ["my slot"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in which situations would you need to fill this out? you can specify slots without a slot mapping in the domain right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok i just realised why, in case you want to dynamically change the list of requested slots :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you'd override for two use cases:
- dynamic slots
- custom slot mappings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok so the custom slot mapping part i'm confused about: if you specify your slots without a slot mapping in the domain file, shouldn't it just use the extract_
method for that slot?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean that we would just try to extract every slot for which we have an extract_
function defined? I think that would work fine if the slot mappings are static. It would become tricky in case your required_slots
change dynamically
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok i'm super confused now - the way to extract the slot changes? how would that even work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think "my" users wanted to dynamically change how slots are extracted. They wanted to dynamically change the list of required slots, but extraction was either given right in the domain or implemented using extract_{slot}
(in either case, the implementation didn't change). The way I understand it is that this new implementation should use extract_{slot}
whenever it exists for the given slot, and use the "default" extraction approach otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good for you @akelad ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, that makes sense for me! So just to summarise, for the requested slot method that means you only need to fill it out if you want to dynamically change requested slots, correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly. This includes the case that you want to ignore / override slot mappings defined in the domain (ideally they just leave the slot mappings empty in the domain)
@wochinge anything in particular you want me to review? the example in the changelog looks good to me |
@akelad I mainly wanted your feedback on the overall approach and as you requested this feature multiple times. |
looks great to me, aside from the discussion we're having in one of the comments now :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Co-authored-by: Alexander Pantiukhov <alwxndr@gmail.com>
Proposed changes:
required_slots
to specify slots which should be filled by the form. TheFormValidationAction
will look for a methodextract_<slot_name>
to extract these slots.required_slots
, theFormValidationAction
will automatically set therequested_slot
to the nextrequired_slot
which is currently not filled. Users can override this behavior by customizingrequest_next_slot
. By defaultrequest_next_slot
also considers slots which were mapped in the domain (if there were any mapped ones).utils.call_potential_coroutine
to get rid of our checksif is coroutine ... else ...
I will update the Rasa Open Source documentation in a separate Rasa Open Source PR.
Status (please check what you already did):
black
(please check Readme for instructions)