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

Fix bug that whether an Orchestrator object can extract entities or n… #5749

Merged
merged 7 commits into from
Jun 30, 2021

Conversation

hcyang
Copy link
Contributor

@hcyang hcyang commented Jun 29, 2021

…ot should not depend on a member variable ScoreEntities.

Fixes #5750

Description

Specific Changes

Testing

…ot should not depend on a member variable ScoreEntities.
@coveralls
Copy link
Collaborator

coveralls commented Jun 29, 2021

Pull Request Test Coverage Report for Build 255773

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 8 unchanged lines in 4 files lost coverage.
  • Overall coverage increased (+0.04%) to 76.202%

Files with Coverage Reduction New Missed Lines %
/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/EntityRecognizers/TextEntityRecognizer.cs 1 85.71%
/libraries/Microsoft.Bot.Builder.Dialogs/Prompts/DatetimePrompt.cs 1 77.5%
/libraries/Microsoft.Bot.Builder/Adapters/TestFlow.cs 2 78.32%
/libraries/Microsoft.Bot.Builder.Dialogs/Memory/DialogStateManager.cs 4 78.76%
Totals Coverage Status
Change from base Build 255298: 0.04%
Covered Lines: 22952
Relevant Lines: 30120

💛 - Coveralls

@tsuwandy
Copy link
Contributor

tsuwandy commented Jun 29, 2021

@hcyang, @daveta and I reviewed the changes again and not sure why we need the extra layer, OrchestratorDictionaryEntry?

@hcyang
Copy link
Contributor Author

hcyang commented Jun 29, 2021

@hcyang, @daveta and I reviewed the changes again and not sure why we need the extra layer, OrchestratorDictionaryEntry?

@tsuwandy, the removed ScoreEntities flag is renamed IsEntityReady and placed in an OrchestratorDictionaryEntry and associated with a static Orchestrator object. If there is no need for the ScoreEntities flag, then we can remove that IsEntityReady flag and remove the whole OrchestratorDictionaryEntry abstraction as well.

@daveta
Copy link
Contributor

daveta commented Jun 29, 2021

Seems like the current code and this fix are equivalent (?). The difference is the new code, you have available the Orchestrator more readily available in the Recognizer instance (but I don't see it being used).

Copy link
Member

@carlosscastro carlosscastro left a comment

Choose a reason for hiding this comment

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

Hello! Some of the general comments I added are me just catching up and asking questions about this codebase and not issues with this PR in particular. I did find 2 things that we should fix before merging as I was learning by reading it, which I wanted to call out:

1- We cannot remove public properties that shipped
2- We should minimize visibility of classes wherever possible. I'm not sure that OrchestratorDictionaryEntry needs to be protected, since as such we'd need to maintain backward compat until V5 at least

Happy to help with these, and we can chat about the other comments offline and not block this PR on them.

The easiest way to fix the 2 most blocking issues is 1) do not remove the public property, instead mark it obsolete with a reasonable explanation of what to do moving forward for developers and 2) make the new entry class private instead of protected

recognizerResult.Entities = new JObject();
}
var results = _resolver.Score(text, LabelType.Entity);
recognizerResult.Properties.Add(EntitiesProperty, results);
Copy link
Member

Choose a reason for hiding this comment

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

Since we are visiting this codebase and adding some restructuring, it would be nice, if possible, to add some comments and explain what is the json format, what we are trying to extract, and other decisions that are not obvious in the code.

Copy link
Contributor

@tsuwandy tsuwandy Jun 29, 2021

Choose a reason for hiding this comment

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

@carlosscastro
Copy link
Member

Hung-chih and I chatted. The Entry class is going away, and we're discussing the backward compat issue. The rest of the comments from pre-existing code can be addressed / analyzed outside of the scope of this PR.

@daveta daveta added this to the R15 milestone Jun 29, 2021
@hcyang
Copy link
Contributor Author

hcyang commented Jun 30, 2021

Hung-chih and I chatted. The Entry class is going away, and we're discussing the backward compat issue. The rest of the comments from pre-existing code can be addressed / analyzed outside of the scope of this PR.

@carlosscastro, after consulting with @daveta, we decided to bring the DictionaryEntry class back, but make it a private class per your suggeston.


var orchestrator = orchestratorMap.GetOrAdd(fullModelFolder, path =>
_orchestrator = orchestratorMap.GetOrAdd(fullModelFolder, path =>
Copy link
Member

Choose a reason for hiding this comment

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

What's the latency of this method on moderate sized models?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The latency for that is just seconds. Loading the models are quick even though they can be up to 1GB. The actual time consuming part is building the resolver consuming some big snapshot file. Perhaps that's the reason the InitializeModel() function is called once inside RecognizeAsync(), which is async.

Copy link
Member

Choose a reason for hiding this comment

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

what is the latency of the entire initializeModel?

Copy link
Member

Choose a reason for hiding this comment

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

Asking because 1) this will get run on the first turn and not when the app service starts. This means that the first turn of the first conversation will be really slow, i.e. as long as this method takes.

Copy link
Member

Choose a reason for hiding this comment

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

Ideally we'd want to transfer this time to application load somehow in the future. We don't need to resolve this now, but it is importnat. I'll create an issue for this.

Copy link
Member

@carlosscastro carlosscastro left a comment

Choose a reason for hiding this comment

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

Thanks for the iteration @hcyang !!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants