botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

[Feature Request] How to associate Bing Spell Check Azure key with LUIS Application?

Open bommareddysandhya opened this issue 8 years ago • 18 comments

Bot Info

  • SDK Platform: NET
  • SDK Version: 4.6.1
  • Active Channels: Any
  • Deployment Environment: Azure App Service

Issue Description

How to associate Bing Spell Check Azure key with Luis Application, Create Cognitive service -Bing spell checker in Azure and In Luis application selected the check box to include big spell checker. In Luis Dialog setting SpellCheck = true for LuisModelAttribute . Where we have to use the Bing Spell Check Azure key or how can use in luis dialog .

bommareddysandhya avatar Jan 24 '18 13:01 bommareddysandhya

You can use LUIS EndPoint API to Get EndPoint Prediction where you can use Bing Spell Check Azure Subscription Key.

The other place to use the Bing Spell Check Azure Subscription Key is to include it the endpoint link which you get it the publish page .

For example: https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/xxxxxxxxxxxxxxxxxxxxxx?subscription-key=xxxxxxxxxxxxxxx&spellCheck=true&bing-spell-check-subscription-key={YOUR_BING_KEY_HERE}&verbose=true&timezoneOffset=0&q=

Hope this helps!!

fanidamj-zz avatar Jan 25 '18 18:01 fanidamj-zz

I'm still unclear. I'm declaring my LUIS Dialog with a LuisModel attribute like so in C#:

[LuisModel("my-app-key", "my-api-key", domain: "westeurope.api.cognitive.microsoft.com", spellCheck: true)]
[Serializable]
public class LUISDialog : LuisDialog<RoomReservation>

Where can I add the "bing-spell-check-subscription-key"? The Code Sample at Get EndPoint Prediction doesn't help me here, since it's assuming constructing the query string manually, which I don't since this is all managed behind the scene by the Microsoft.Bot.Builder.Luis.Model.LuisModel and Microsoft.Bot.Builder.Luis.LuisDialog classes. My understanding is that there is no mechanism to permanently associate a SpellCheck key to a LUIS app (even in LUIS UI Test you need to enter it every time) so it must be something I need to specify on my bot programmatically, but how?... Thanks a lot for any pointer you may be able to give me!

14geronimo avatar Jun 18 '18 12:06 14geronimo

Labeled Feature Request: add BingSpellCheckSubscriptionKey to LuisModelAttribute constructor.

EricDahlvang avatar Jul 18 '18 19:07 EricDahlvang

Currently, you can so something like this to use a Bing Spell Check Subscription Key with the LuisDialog:

[Serializable]
public class CustomLuisDialog : LuisDialog<object>
{

        public CustomLuisDialog()
            : base(new LuisService(GetLuisModelAttribute()))
        {
        }

        private static LuisModelAttribute GetLuisModelAttribute()
        {
            var attribute = new LuisModelAttribute(
                            "LuisAppId",
                            "LuisAPIKey");
            attribute.BingSpellCheckSubscriptionKey = "BingSpellcheckKey";
            return attribute;
        }
}

EricDahlvang avatar Jul 18 '18 19:07 EricDahlvang

Thanks for this @EricDahlvang. But LuisModelAttribute doesn't define a property called "BingSpellCheckSubscriptionKey"–at least not in Microsoft.Bot.Builder 3.15.3. It might become available in 4.0.0-alpha but the API docs for this upcoming release is not published yet. So the code above doesn't compile for me. What am I missing?

14geronimo avatar Jul 19 '18 08:07 14geronimo

Looking at the code I see there was this enhancement made in January, it was tagged with "[email protected]", but doesn't look like it's made it to the final release. I'm not too familiar with the code, I might be getting this wrong.

14geronimo avatar Jul 19 '18 08:07 14geronimo

in \Microsoft.Bot.Builder.3.15.3\lib\net46\Microsoft.Bot.Builder.dll

image

EricDahlvang avatar Jul 19 '18 21:07 EricDahlvang

Oh yes, sorry got muddled up. Thank you @EricDahlvang

14geronimo avatar Jul 20 '18 11:07 14geronimo

@bommareddysandhya I think this can be closed, am I right? A feature request has been raised to add BingSpellCheckSubscriptionKey to LuisModelAttribute constructor, and the workaround shared by @EricDahlvang above is good enough for the immediate future.

14geronimo avatar Jul 20 '18 11:07 14geronimo

@14geronimo We can leave this open until the feature request is implemented.

EricDahlvang avatar Jul 23 '18 23:07 EricDahlvang

@EricDahlvang, when I used your code and implemented it in the production environment, we received an error on the site, I had to use this code:


        public BasicLuisDialog() : base(new LuisService(new LuisModelAttribute(
            ConfigurationManager.AppSettings["LuisAppId"],
            ConfigurationManager.AppSettings["LuisAPIKey"],
            domain: ConfigurationManager.AppSettings["LuisAPIHostName"])))
        {
        }

I also had to use this versions Microsoft.Net.Compiler v1.2.1 and Microsoft.CodeDOM.Providers.DotNetCompilerPlatform v1.0.1

Is any update missing? I must wait?

procmc avatar Jul 26 '18 18:07 procmc

@procmc What you have looks right. I had left the domain empty (defaulting to west us), but of course you are welcome to provide the value if your LUIS model is hosted at a different data center.

Also, 14geronimo wanted to use the BingSpellCheckSubscriptionKey, so I was providing a method for adding that to the LuisModelAttribute.

EricDahlvang avatar Jul 26 '18 19:07 EricDahlvang

@EricDahlvang thank you for responding so fast. Right I want to do the same. I want to use BingSpellCheckSubscriptionKey, but when I do, the azure compiler has errors in the class Microsoft.Net.Compiler

procmc avatar Jul 26 '18 20:07 procmc

I have no idea why that would be. Can you share an example project that reproduces the problem you're seeing @procmc ?

EricDahlvang avatar Jul 26 '18 21:07 EricDahlvang

I use this and work

   var attribute = new LuisModelAttribute(
                            ConfigurationManager.AppSettings["LuisAppId"],
                            ConfigurationManager.AppSettings["LuisAPIKey"],
                            domain: ConfigurationManager.AppSettings["LuisAPIHostName"]);
           attribute.SpellCheck = true;
           attribute.BingSpellCheckSubscriptionKey = ConfigurationManager.AppSettings["BingSpellCheckAPIKey"];
           return attribute;

but using this versions Microsoft.Net.Compiler v1.2.1 and Microsoft.CodeDOM.Providers.DotNetCompilerPlatform v1.0.1

procmc avatar Jul 27 '18 04:07 procmc

@procmc I'd recommend not upgrading the Microsoft.Net.Compiler v1.2.1 and Microsoft.CodeDOM.Providers.DotNetCompilerPlatform v1.0.1 packages if they are causing issues.

EricDahlvang avatar Jul 31 '18 17:07 EricDahlvang

As an alternative, I've created a CustomLuisModelAttribute class that you might find useful: -

using Microsoft.Bot.Builder.Luis; using System;

namespace TestBot.Helpers { [Serializable] public class CustomLuisModelAttribute : LuisModelAttribute { public CustomLuisModelAttribute(string modelID, string subscriptionKey, LuisApiVersion apiVersion = LuisApiVersion.V2, string domain = null, double threshold = 0, string bingSpellCheckSubscriptionKey = "", bool spellCheck = false) : base(modelID, subscriptionKey, apiVersion, domain, threshold) { SpellCheck = spellCheck; BingSpellCheckSubscriptionKey = bingSpellCheckSubscriptionKey; } } }

Wheeldo74 avatar Aug 16 '18 14:08 Wheeldo74

Thank you for opening an issue against the Bot Framework SDK v3. As part of the Bot Framework v4 release, we’ve moved all v3 work to a new repo located at https://github.com/microsoft/botbuilder-v3. We will continue to support and offer maintenance updates to v3 via this new repo.

From now on, https://github.com/microsoft/botbuilder repo will be used as hub, with pointers to all the different SDK languages, tools and samples repos.

As part of this restructuring, we are closing all tickets in this repo.

For defects or feature requests, please create a new issue in the new Bot Framework v3 repo found here: https://github.com/microsoft/botbuilder-v3/issues

For Azure Bot Service Channel specific defects or feature requests (e.g. Facebook, Twilio, Teams, Slack, etc.), please create a new issue in the new Bot Framework Channel repo found here: https://github.com/microsoft/botbuilder-channels/issues

For product behavior, how-to, or general understanding questions, please use Stackoverflow. https://stackoverflow.com/search?q=bot+framework

Thank you.

The Bot Framework Team

cleemullins avatar Oct 01 '18 17:10 cleemullins