Skip to content
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

slot extractions v2 #338

Merged
merged 6 commits into from
Nov 16, 2020
Merged

slot extractions v2 #338

merged 6 commits into from
Nov 16, 2020

Conversation

wochinge
Copy link
Contributor

@wochinge wochinge commented Nov 13, 2020

Proposed changes:

Status (please check what you already did):

  • made PR ready for code review
  • added some tests for the functionality
  • updated the documentation
  • updated the changelog (please check changelog for instructions)
  • reformat files using black (please check Readme for instructions)

Copy link
Contributor

@samsucik samsucik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, I requested just tiny changes. But I think someone else should also have a look at the code, especially at the tests, because I might've missed something.

changelog/329.feature.md Outdated Show resolved Hide resolved
rasa_sdk/forms.py Outdated Show resolved Hide resolved
Comment on lines +774 to +777
warnings.warn(
f"Cannot extract `{slot_name}`: make sure the extract method "
f"returns the correct output."
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, I think this warning shouldn't be here. For any user utterance, we try to extract all slots from it. So it's natural that in most cases the call to an extractor won't actually extract anything, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They need to return a dict of the form {"slotname": <value>} so the warning makes sense. Will adapt it a bit though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, thanks for correcting me!


async def required_slots(
self,
slots_mapped_in_domain: List[Text],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wochinge what do you think about renaming this to slots_with_predefined_mappings or similar? I'm not 100% certain and would like to get someone else's opinion, but it's true that in the docs I've been trying to remove the mentions of slots "mapped in the domain".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in the documentation it made sense in combination with the link. I think in this case domain makes it clearer for now.

rasa_sdk/forms.py Outdated Show resolved Hide resolved
tests/test_forms.py Outdated Show resolved Hide resolved
tests/test_forms.py Outdated Show resolved Hide resolved
tests/test_forms.py Outdated Show resolved Hide resolved
wochinge and others added 2 commits November 13, 2020 17:29
Co-authored-by: Sam Sucik <s.sucik@rasa.com>
@wochinge wochinge requested review from samsucik and joejuzl and removed request for alwx November 13, 2020 16:37
Copy link
Contributor

@samsucik samsucik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍

)
return []

if not extract_method:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For these conditionals I find it hard to determine which combination of also_mapped_in_domain and extract_method lead to each branch as it requires keeping each previous if in your head. I think it would be clearer if you used either a traditional nested if structure, or re-stated both variables in each flat if statement.

rasa_sdk/forms.py Show resolved Hide resolved
@wochinge wochinge merged commit c655e0a into master Nov 16, 2020
@wochinge wochinge deleted the slot-extractionsv2 branch November 16, 2020 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants