Language Understanding (LUIS) V3 doesn't support Bing Spell Check API
Version
"botbuilder": "~4.15.0", "botbuilder-ai": "~4.15.0",
Describe the bug
I try to improve LUIS intents prediction accuracy. Because there is an issue when missing one letter leads LUIS to a wrong intent. I use the tutorial, but still I don't get the expected value "alteredQuery" in the JSON returned form LUIS. this is how I use it:
const luisConfig: LuisApplication = {
applicationId: [APP_ID_GOES_HERE],
endpointKey: [KEY_GOES_HERE],
endpoint: [ENDPOINT_GOES_HERE],
};
const recognizerOptions: LuisRecognizerOptionsV2 = {
apiVersion: 'v2',
bingSpellCheckSubscriptionKey: [KEY_GOES_HERE];
includeAllIntents: true,
log: true,
spellCheck: true,
log: true,
includeInstanceData: true
};
const luisRecognizer = new LuisRecognizer(luisConfig, recognizerOptions, true);
Expected behavior
As per documentation I should get the response as follows:
"query": "bouk me a fliht to kayro",
"prediction": {
"alteredQuery": "book me a flight to cairo",
"topIntent": "book a flight",
"intents": {
"book a flight": {
"score": 0.9480589
}
"None": {
"score": 0.0332136229
}
},
"entities": {}
}
}
But the reality is different - there is no "alteredQuery"
"query": "bouk me a fliht to kayro",
"prediction": {
"topIntent": "book a flight",
"intents": {
"book a flight": {
"score": 0.9480589
}
"None": {
"score": 0.0332136229
}
},
"entities": {}
}
}
Hi @mountju,
The documentation you have linked specifies that the Bing Spell Check key must be passed to LUIS in the header of each call. Is that what you are doing? If you pass it in as part of the request body, it likely will not work.
One thing you might want to try is sending a request to the LUIS endpoint to see if it's working outside of the bot.
Hi @anishprasad01 ! My request to the LUIS endpoint outside of the bot works well with the header! But I still need to use it in SDK (botbuilder-ai). How can I manage adding header to a request which is done by SDK itself?
As a workaround, you could try making the request to LUIS using HttpClient from the .NET standard libraries instead of the Bot SDK LUIS objects. HttpClient will allow you to manually add headers. Once you get back a request, you would then parse the JSON for the alteredQuery.
@anishprasad01
got your idea, but we use node.js in our project. so as I understand you it's impossible to use Bing Spell Check API through the SDK, and I need to use REST API as it is
Not necessarily. I just defaulted to C#, but C# libraries are by no means the only way to interact with LUIS. You know how you interacted with it outside the bot? Similarly, you can use whatever counterpart to HttpClient is available in Node.js. The http or https modules perhaps?
@anishprasad01 thank you for your help! I will use httpClient for js and LUIS REST API
but I very disappointed that LUIS SDK doesn't work well at all.
but I very disappointed that LUIS SDK doesn't work well at all
As per your initial question, the LUIS endpoint did return the correctly recognized intent and score. While getting the altered query back might not be specifically supported, the LUIS SDK is working as expected.
There are special options for the proper work with Bing Spell Check API in SDK (bingSpellCheckSubscriptionKey, spellCheck) but they couldn't be used at all...
Feel free to open a ticket with LUIS and leave your feedback with them. In the meantime, since we have identified a workaround, I am going to go ahead and close this issue. Should you run into further issues, feel free to comment and we can reopen it. If you have new problems in the future, please open a ticket in the appropriate repository.