-
Notifications
You must be signed in to change notification settings - Fork 281
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
Botbuilder AI QnAMaker scoreThreshold should be between 0 and 100 #1808
Comments
@araver is this where the exception is being thrown from? JS: botbuilder-js/libraries/botbuilder-ai/src/qnamaker-utils/generateAnswerUtils.ts Lines 157 to 163 in aa2723a
|
@araver To confirm, it's throwing the error that tells you explicitly to make score thresholds between 0 and 1, right? (not some other thing that's breaking) While you're right that the QnA Maker API does return its results from 0 to 100, the bot framework QnA Maker handles the score threshold from 0 to 1, using float values, as you've discovered. (Upon receiving the results from QnA Maker service, the framework divides scores by 100.) I mean I guess we could convert with a "if ScoreThreshold is less than 1, multiply by 100" condition--but that doesn't seem graceful. What if someone originally put a ScoreThreshold of 1 in, intending it to be 100% score, and not 1%? We have no way of differentiating the author's intention... Anyways, while conceding that it would be less confusing if both BF and QnA service itself were identical, if we agree that there's no way to gracefully change the input behavior of score threshold in bot framework to align with the scores that the qna service puts out, then this is probably something that's resolved by just a method documenting fix. It's more apparent in the C# code in And the errors thrown also inform users that ScoreThresholds should be 0 to 1, but running into errors shouldn't be the way people discover how to use our framework properly. |
reopening issue, for tracking |
@Zerryth there must have been a change in the api, because it is expecting a value from 0 to 100. |
Also, in my opinion, the SDK should be less opinionated about that sort of thing. If the API has a problem with the developer using a value that is not within its valid range, it should respond with an error. The SDK should document the understood values, but not prevent the developer from using an invalid value. |
ah, I see @araver As you see, it does not. It queries QnA with .9 scoreThreshold, which is by far lower than the 90% threshold I intended.
But, once it sortsAnswersWithinThreshold, it filters against the scoreThreshold specified. Therefore ultimately the answer of score 81% never makes it through, as intended. So the TL;DR is, the SDK scoreThreshold option does work, it just does so inefficiently, as it always queries QnA API with a lower threshold than intended, which leads to more answers being return than intended, before the SDK then goes on to filter the results properly and return the correct results to the bot. We can't change the input value behavior, as not introducing breaking changes to existing customers is a policy we uphold, so that customers have stability in our framework--could you imagine the frustration of your bot working one day, but then not the next, without you making changes? It's unfortunate that in this case the the scoreThreshold value input is different in the SDK than the API, but we can't change that now I'll ask the team what we want to do about the inefficient behavior. |
Versions
What package version of the SDK are you using. 4.7.2
What nodejs version are you using: 10
What browser version are you using: NA
What os are you using: windows
Describe the bug
The sdk throws an exception when the threshold is greater than 1. But QNA Maker's API uses scoring from 0 to 100.
To Reproduce
Use a scoreThreshold greater than 1
Expected behavior
SDK shouldn't throw an exception when scoreThreshold is greater than 1
[bug]
The text was updated successfully, but these errors were encountered: