Exemplo n.º 1
0
        private static IQnAService CreateQnAService(string subscriptionKey, string knowledgeBaseId, string defaultMessage = null, double scoreThreshhold = 0.3, int top = 1)
        {
            var         qnaAttribute = new QnAMakerAttribute(subscriptionKey, knowledgeBaseId, defaultMessage, scoreThreshhold, top);
            IQnAService qnAService   = new QnAMakerService(qnaAttribute);

            return(qnAService);
        }
Exemplo n.º 2
0
        private static IContainer RegisterDependencies(ContainerBuilder builder)
        {
            builder.Register(c =>
            {
                var kbid = ConfigurationManager.AppSettings["QnaKnowledgeBaseId"];
                var key  = ConfigurationManager.AppSettings["QnaSubscriptionKey"];

                var qnaAttribute = new QnAMakerAttribute(key, kbid, "I don't know what you're talking about!", 0.3);
                return(new QnAMakerService(qnaAttribute));
            }).As <IQnAService>().InstancePerLifetimeScope();

            builder.Register(c =>
            {
                var luisAppId = ConfigurationManager.AppSettings["LuisAppId"];
                var luisKey   = ConfigurationManager.AppSettings["LuisSubscriptionKey"];

                var luisModel = new LuisModelAttribute(luisAppId, luisKey, threshold: 0.8D);
                return(new LuisService(luisModel));
            }).As <ILuisService>().InstancePerLifetimeScope();

            builder.Register(c =>
            {
                var wechatOutgoingUri = ConfigurationManager.AppSettings["WechatOutgoingURI"];
                return(new MessageDispatcher(wechatOutgoingUri));
            }).As <IMessageDispatcher>().InstancePerLifetimeScope();

            return(builder.Build());
        }
Exemplo n.º 3
0
        private static IQnAService[] GetNewService()
        {
            var subscriptionKey = ConfigurationManager.AppSettings.Get("QnaSubscriptionKey");
            var knowledgebaseid = ConfigurationManager.AppSettings.Get("QnaKnowledgebaseId");
            var defaultMessage  = "Buguei aqui, pera!  ¯\(º_o)/¯";
            var qnaModel        = new QnAMakerAttribute(subscriptionKey, knowledgebaseid, defaultMessage);

            return(new IQnAService[] { new QnAMakerService(qnaModel) });
        }
Exemplo n.º 4
0
        private static IQnAService GetQnaService()
        {
            var key  = ConfigurationManager.AppSettings["QnaSubscriptionKey"];
            var kbId = ConfigurationManager.AppSettings["QnaKnowledgebaseId"];

            var qnaMakerAttribute = new QnAMakerAttribute(key, kbId);

            return(new QnAMakerService(qnaMakerAttribute));
        }
Exemplo n.º 5
0
        private static IQnAService GetQnaService()
        {
            var key            = ConfigurationManager.AppSettings["QnaSubscriptionKey"];
            var kbId           = ConfigurationManager.AppSettings["QnaKnowledgebaseId"];
            var defaultMessage = "Sorry, I couldn't find an answer for that";
            var scoreThreshold = 0.5D;


            var qnaMakerAttribute = new QnAMakerAttribute(key, kbId, defaultMessage, scoreThreshold);

            return(new QnAMakerService(qnaMakerAttribute));
        }
Exemplo n.º 6
0
        public override async Task <object> FulfillAsync(IDialogContext context = null, string messageText = "")
        {
            var qnaModels = new QnAMakerAttribute(subscriptionKey: ConfigurationManager.AppSettings["SubscriptionKey"],
                                                  knowledgebaseId: ConfigurationManager.AppSettings["KnowledgeBaseId"],
                                                  defaultMessage: Resources.ChatBot.NoMatchMessage,
                                                  scoreThreshold: 0.2,
                                                  top: 4);

            var qnaMakerDialog = new QnAMakerDialog(new List <IQnAService> {
                new QnAMakerService(qnaModels)
            }.ToArray());
            await context.Forward(qnaMakerDialog, ResumeAfterQnAMakerDialog, context.Activity.AsMessageActivity(), CancellationToken.None);

            return(Task.FromResult((object)""));
        }
Exemplo n.º 7
0
 public CustomQnAService(QnAMakerAttribute qnAMakerAttribute, string qnaHost)
 {
     _qnaHost           = qnaHost;
     _qnAMakerAttribute = qnAMakerAttribute;
 }
Exemplo n.º 8
0
 // Go to https://qnamaker.ai and feed data, train & publish your QnA Knowledgebase.
 public QnADialog(QnAMakerAttribute options) : base(new QnAMakerService(options))
 {
 }
Exemplo n.º 9
0
        private void CreateService()
        {
            var attributes = new QnAMakerAttribute(qnaKnowledgeBaseId, qnaSubscriptionKey, defaultNotFindMessage, precisionScore);

            service = new QnAMakerService(attributes);
        }