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

Remove intent's syntetic ID construct and use name #10013

Merged
merged 10 commits into from
Nov 2, 2021

Conversation

tayfun
Copy link
Contributor

@tayfun tayfun commented Oct 29, 2021

Fixes #8974

Intent IDs were basically hashed from intent's labels (aka names?) and
were in number format. If we change this to a string to make sure
scientific notation does not lose precision, we essentially can use the
label in place. Intent labels are unique and much more human readable.
Does the job in a simpler way.

Proposed changes:

  • Use intent name instead of artificially creating an intent ID by hashing its name.

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)

Fixes #8974

Intent IDs were basically hashed from intent's labels (aka names?) and
were in number format. If we change this to a string to make sure
scientific notation does not lose precision, we essentially can use the
label in place. Intent labels are unique and much more human readable.
Does the job in a simpler way.
@tayfun tayfun requested a review from joejuzl October 29, 2021 15:02
@tayfun tayfun requested a review from a team as a code owner October 29, 2021 15:02
@tayfun tayfun requested review from a team and tttthomasssss and removed request for a team October 29, 2021 15:02
@tayfun tayfun requested a review from wochinge November 1, 2021 09:59
@tayfun
Copy link
Contributor Author

tayfun commented Nov 1, 2021

I don't think a changelog is needed here because it is not a user facing change.

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.

I think it makes sense having a changelog entry as the data that is sent to the action server for custom actions will now be different. And probably worth explaining that they can get the equivalent value by hashing the name too.

Also can you check we don't still have the id in any test events in unit tests? e.g. tests/core/test_actions.py

usc-m and others added 3 commits November 1, 2021 14:53
* Create stubs to start filling out Aciel's snippet

Co-authored-by: Aciel Eshky <a.eshky@rasa.com>

* Sketch out basics of CLI arguments

* Start changing over args to new format

* Make CLI match description from design pass

* Add tests

* Switch over timestamps to event IDs

* Fix tests now event IDs are supported

* Start work on doc comments

* Switch over event_id fix

Also removes otherwise-unused import to stop circularity

* Address PR comments

* Fix incorrect file extension

* Codeclimate

* Update rasa/core/evaluation/marker_base.py

Co-authored-by: Kathrin Bujna <kathrin.bujna@gmail.com>

* Address PR comments

* Move test to marker

* Rename dialogue to session

Co-authored-by: Aciel Eshky <a.eshky@rasa.com>
Co-authored-by: Kathrin Bujna <kathrin.bujna@gmail.com>
@tayfun
Copy link
Contributor Author

tayfun commented Nov 1, 2021

I think it makes sense having a changelog entry as the data that is sent to the action server for custom actions will now be different. And probably worth explaining that they can get the equivalent value by hashing the name too.

Also can you check we don't still have the id in any test events in unit tests? e.g. tests/core/test_actions.py

Thanks, good catch about other tests with ID in it :) Somehow it is not easy to grep them all. I have fixed all I've found and added the changelog now.

Copy link
Contributor

@tttthomasssss tttthomasssss left a comment

Choose a reason for hiding this comment

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

LGTM in general 🤖!

One small thing, wasn't the intent id exposed to users via the Events API in the rasa-sdk (i.e. inside UserUttered)? And if so, this could potentially cause unexpected crashes for any user who - for one reason or another - relies on the intent id for some processing, right?

@tayfun tayfun requested a review from joejuzl November 2, 2021 08:43
@tayfun
Copy link
Contributor Author

tayfun commented Nov 2, 2021

LGTM in general 🤖!

One small thing, wasn't the intent id exposed to users via the Events API in the rasa-sdk (i.e. inside UserUttered)? And if so, this could potentially cause unexpected crashes for any user who - for one reason or another - relies on the intent id for some processing, right?

@tttthomasssss , yes you're essentially right. This will be a backwards incompatible change for version 3. Rasa X may have to change some stuff including this change and as you have said, other users which rely on Intent ID too.

Recommendation is to use intent name and if they can't, they can simply hash the name to get same number as before.

changelog/8974.bugfix.md Outdated Show resolved Hide resolved
changelog/8974.bugfix.md Outdated Show resolved Hide resolved
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.

Looks good! 🚀

@tayfun tayfun merged commit d2eb3a7 into main Nov 2, 2021
@tayfun tayfun deleted the tayfun/8974-remove-intent-id-use-intent-name branch November 2, 2021 10: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.

Update Intent ID Type from Integer to String
4 participants