-
Notifications
You must be signed in to change notification settings - Fork 478
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
Allow LuisRecognizer
to handle textless messages
#1566
Conversation
Pull Request Test Coverage Report for Build 52947
💛 - Coveralls |
Please include a note regarding the JS behavior. We need to keep the two aligned. |
While the Node SDK does not have this bug, it does behave slightly differently compared to this PR. In Node, the empty utterance is sent to the LUIS endpoint, resulting in a needless endpoint call. Then the returned value is different in that there are no intents in Node, whereas this PR creates a fake intent like V3 did. It's uncertain whether these differences warrant changing the behavior of the Node SDK. In luisRecognizer.test.js there was already a test that accounts for empty utterances, which confirms the need for this .NET PR since in Node an empty utterance produced no error. I will amend this PR with your requested change ASAP. |
Curiously, the test I referred to in luisRecognizer.test.js reflects inaccurate behavior. The LUIS recognizer tests in both SDK's work using a mock HTTP client and so they're not actually calling any real LUIS endpoint. The tests just load files with fake LUIS results that are already built into the projects and then test to see if those fake results are what they've already been made to be. So even though the test says an empty utterance should return a None intent, that's not what really happens when an actual endpoint is used. |
|
@cleemullins - You can see in my commits that I've made no changes to the |
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 like a good solution to this issue.
Fixes #1349
With this change,
LuisRecognizer.RecognizeAsync
will no longer throw an exception when the turn context's activity has no text. Instead it will bypass the LUIS endpoint (saving the expense of an API call) and create a fakeRecognizerResult
with astring.Empty
intent. This will allow bots to handle textless messages gracefully when they're not designed to explicitly check if the text is null or empty before callingRecognizeAsync
. If the bot has aswitch
statement with adefault
clause then that will be triggered, probably responding the same as a None intent. Otherwise, nothing will happen.