garypretty / botframework

Microsoft Bot Framework helpers and additional dialogs
MIT License
60 stars 51 forks source link

General availability of QnAMaker on nuget #22

Closed 1110770MiguelSilva closed 6 years ago

1110770MiguelSilva commented 6 years ago

When can we expect the newest commit that added changes to QnADialog so it would work with services on Azure to be updated on the nuget package? Wanted to change my code to use that service instead of the preview, but without what was changed on that commit I can't do it.

(I don't know what involves updating on nuget, if it takes much time or effort, asking so I can get a sense of when it will be available).

garypretty commented 6 years ago

I have just returned from a vacation, so I should be able to get this out in the next 24/48 hours.

1110770MiguelSilva commented 6 years ago

Okay, great! Thanks for the answer.

IgnasLabinas commented 6 years ago

Hello, any news about updating nuget package? We are still waiting :)

garypretty commented 6 years ago

@IgnasLabinas @1110770MiguelSilva Sorry for the delay :) I have just pushed the latest package to NuGet https://www.nuget.org/packages/QnAMakerDialog/3.1.0

Let me know if you have any issues with it 👍

IgnasLabinas commented 6 years ago

Super, thanks!

1110770MiguelSilva commented 6 years ago

I don't know why but I get this error when trying to update.

Package 'QnAMakerDialog 3.1.0' is not found in the following primary source(s): 'https://api.nuget.org/v3/index.json'. Please verify all your online package sources are available (OR) package id, version are specified correctly.

I even tried to remove an reinstall the package, couldn't do it, but I could for the 3.0.0 version. @IgnasLabinas You didn't have any problem updating?

garypretty commented 6 years ago

@1110770MiguelSilva Sometime NuGet can take a while to publish the updated packages, but I just got an email saying this was done. Can you try searching using the Package Search in Visual Studio as opposed to the command line and see if you can see it please?

1110770MiguelSilva commented 6 years ago

I can, it's there as the latest stable but I still get the same error.

garypretty commented 6 years ago

@1110770MiguelSilva hmm. ok. I have no idea why that would be. I can only suggest waiting a couple of hours and seeing if it resolves itself. Maybe its something to do with how NuGet propagate newly published packages.

1110770MiguelSilva commented 6 years ago

Error stopped showing, must've been a matter of waiting some time. But now I'm getting a new error when updating.

Could not install package 'QnAMakerDialog 3.1.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

IgnasLabinas commented 6 years ago

I am getting thins error too.

garypretty commented 6 years ago

@1110770MiguelSilva @IgnasLabinas Ok, you will need to leave that one with me. Looks like a NuGet packaging issue. I'll take a look shortly.

garypretty commented 6 years ago

@1110770MiguelSilva @IgnasLabinas Ok, I think I know what's happening here. I have upgraded this package recently to .NET Standard. Therefore, you need to be targeting 4.6.1 and above. However, you should be able to install by ignoring dependencies using the -IgnoreDependencies flag on the NuGet package manager command line. Can you try that please?

1110770MiguelSilva commented 6 years ago

Tried and still failed.

IgnasLabinas commented 6 years ago

Same for me: Install-package QnAMakerDialog -ignoreDependencies Install-package : Could not install package 'QnAMakerDialog 3.1.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6.1', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

garypretty commented 6 years ago

Ok. Leave it with me. Might be tomorrow before I can fully investigate this but will get it done as soon as I can.

1110770MiguelSilva commented 6 years ago

Ok, thank you.

garypretty commented 6 years ago

@1110770MiguelSilva @IgnasLabinas Ok, I think I know what the issue is, so to try and unblock you I have just published 3.1.1 to NuGet - try that when I publishes shortly. If that works, then great. If not then I will need to look again over the weekend. Fingers crossed! 👍

1110770MiguelSilva commented 6 years ago

Worked! Updated it, gonna work on getting it to use the Azure Service details now and I'll comment here afterwards.

1110770MiguelSilva commented 6 years ago

The QnAMakerServiceAttribute is still asking me only for the subscriptionKey and the knowledgeBaseId, I can't seem to even find any reference to the other newer attributes. I built my dialog from the example in the sample, is the construction of it now different?

[Serializable]
[QnAMakerService("subscriptionKey ", "knowledgeBaseId")]
public class QnAMainDialog : QnAMakerDialog<bool>
{
   public override async Task NoMatchHandler(IDialogContext context, string originalQueryText)
        {
            context.Done(false);
        }
    public override async Task DefaultMatchHandler(IDialogContext context, string originalQueryText, QnAMakerResult result)
        {
            (...)
            context.Done(true);
        }
}
garypretty commented 6 years ago

I'll check this. Can you try passing those details into the conductor instead??

garypretty commented 6 years ago

If its not working I'll get a fix in this weekend.

1110770MiguelSilva commented 6 years ago

The class itself doesn't have the attributes, if I go check the metadata it's still like this:

public class QnAMakerDialog<T> : IDialog<T>
    {
        protected Dictionary<QnAMakerResponseHandlerAttribute, QnAMakerResponseHandler> HandlerByMaximumScore;

        public QnAMakerDialog();

        public string SubscriptionKey { get; set; }
        public string KnowledgeBaseId { get; set; }
        public int MaxAnswers { get; set; }
        public List<Metadata> MetadataBoost { get; set; }
        public List<Metadata> MetadataFilter { get; set; }

        protected static IMessageActivity ProcessResultAndCreateMessageActivity(IDialogContext context, ref QnAMakerResult result);
        [AsyncStateMachine(typeof(QnAMakerDialog<>.<DefaultMatchHandler>d__25))]
        [DebuggerStepThrough]
        public virtual Task DefaultMatchHandler(IDialogContext context, string originalQueryText, QnAMakerResult result);
        [AsyncStateMachine(typeof(QnAMakerDialog<>.<NoMatchHandler>d__26))]
        [DebuggerStepThrough]
        public virtual Task NoMatchHandler(IDialogContext context, string originalQueryText);
        [AsyncStateMachine(typeof(QnAMakerDialog<>.<StartAsync>d__21))]
        [DebuggerStepThrough]
        public virtual Task StartAsync(IDialogContext context);
        protected virtual IDictionary<QnAMakerResponseHandlerAttribute, QnAMakerResponseHandler> GetHandlersByMaximumScore();
        [AsyncStateMachine(typeof(QnAMakerDialog<>.<MessageReceived>d__22))]
        [DebuggerStepThrough]
        protected virtual Task MessageReceived(IDialogContext context, IAwaitable<IMessageActivity> item);
    }
garypretty commented 6 years ago

I know, I think, what the problem is. I'll get a fix to NuGet tonight or tomorrow.

garypretty commented 6 years ago

@1110770MiguelSilva @IgnasLabinas ok, 3.1.2 published to NuGet and should hopefully now have the updated dialog :) Let me know how you get on.

1110770MiguelSilva commented 6 years ago

Implemented and tested, working perfectly as far as I can tell. Thank you!

garypretty commented 6 years ago

Fantastic! Great to hear. Glad we got you guys unblocked.