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

Deprecate Message method get_combined_intent_response_key #9088

Merged
merged 11 commits into from
Jul 19, 2021

Conversation

kedz
Copy link
Contributor

@kedz kedz commented Jul 9, 2021

Proposed changes:

Status (please check what you already did):

  • [ ] 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)

@kedz kedz requested review from a team and koernerfelicia and removed request for a team and koernerfelicia July 9, 2021 17:47
@kedz kedz linked an issue Jul 9, 2021 that may be closed by this pull request
4 tasks
@kedz kedz requested a review from jupyterjazz July 16, 2021 04:43
@kedz kedz requested a review from a team July 16, 2021 05:55
Copy link
Contributor

@wochinge wochinge left a comment

Choose a reason for hiding this comment

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

🚀

@staticmethod
def separate_intent_response_key(
original_intent: Text,
) -> Tuple[Text, Optional[Text]]:

"""Split intent into main intent name and optional sub-intent name."""
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"""Split intent into main intent name and optional sub-intent name."""
"""Splits intent into main intent name and optional sub-intent name."""

Copy link
Contributor

Choose a reason for hiding this comment

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

should we give a concrete example?

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 (though I see now I was removed as reviewer :) )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@joejuzl adding you since Tobias in on vacation. So I was thinking of adding this example:

        """Splits intent into main intent name and optional sub-intent name.

        For example, `"FAQ/how_to_contribute"` would be split into
        `("FAQ", "how_to_contribute")`. If there is no response delimiter, the
        second tuple item is `None`, e.g. "FAQ" would be mapped to `("FAQ", None)`.
        """

My only hesitation with this is that we don't actually split on "/" but rather the constant RESPONSE_IDENTIFIER_DELIMITER. So there is the risk of this docstring going stale if that delimiter ever changes.

I think this alternative while accurate is somewhat confusing:

        """Splits intent into main intent name and optional sub-intent name.

        For example, `f"FAQ{RESPONSE_IDENTIFIER_DELIMITER}how_to_contribute"` would be split into
        `("FAQ", "how_to_contribute")`. If there is no response delimiter, the
        second tuple item is `None`, e.g. "FAQ" would be mapped to `("FAQ", None)`.
        """

Do you think the first is ok to use or do you have an alternative suggestion?

Copy link
Contributor

@jupyterjazz jupyterjazz Jul 19, 2021

Choose a reason for hiding this comment

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

Does it make sense to do both?

"""Splits intent into main intent name and optional sub-intent name.

For example, `"FAQ/how_to_contribute"` would be split into
`("FAQ", "how_to_contribute")`. The response delimiter can 
take different values (not just "/") and depends on the 
constant - RESPONSE_IDENTIFIER_DELIMITER.
If there is no response delimiter, the second tuple item 
is `None`, e.g. "FAQ" would be mapped to `("FAQ", None)`.
"""

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jupyterjazz yeah I like that. Will make that change.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry just saw this. We've had similar discussion in the past about how to handle constants in docstrings - it's a tricky one :)
The only problem I have with the proposed solution is that this is a docstring for a public method, and RESPONSE_IDENTIFIER_DELIMITER is not really a configurable thing, so it might be slightly confusing.

Is it not possible to fstring the value into the docstrings? That way it would always be up-to-date with the constant.

@kedz kedz requested a review from joejuzl July 16, 2021 21:05
Copy link
Contributor

@joejuzl joejuzl left a comment

Choose a reason for hiding this comment

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

🚀

@kedz kedz merged commit e3a3669 into main Jul 19, 2021
@kedz kedz deleted the deprecate-message-method branch July 19, 2021 15:31
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.0 Deprecation Warning: Remove deprecated Message method
5 participants