Inconsistent response between Azure QnAMaker Web App Bot and Cognitive Service - azure

I'm having differences with the responses to my questions (in Spanish language) performed against an Azure Web App Bot service that queries to an instance of QnAMaker and the queries directly performed against the specific QnAMaker service for that instance.
For this specific case I've performed the same questions on the Bot's Web Chat and on the QnAMaker Test Chat. In several responses retrieved by the Bot's Web Chat I get the default message (like if the question does not match an answer) while in the responses retrieved by the QnAMaker Test Chat I get an answer matched in the Knowledge Base.
Find below the screenshots with the results on both chats:
Bot's Web Chat responses:
Bot Chat Screenshot 01
Bot Chat Screenshot 02
QnAMaker Test Chat Responses:
QnAMaker Chat Screenshot 01
QnAMaker Chat Screenshot 01
The entire configuration to integrate the QnAMaker service with the Bot was checked and it looks OK. Even, the QnaThreshold used to perform the queries in Bot's App Settings was set to 0.04 (4% match) to ensure the results are not filtered.
I guess the problem is a configuration difference between the Bot's module that builds the POST request against the QnAMaker service.
Could anyone help me to fix this to ensure the request performed by the Bot is the same than the one performed by the QnAMaker Test Chat and get the same results through both chats.
Thanks

Alternate questions can improve the likelihood of a match with a user query. You can try to add that phrase as alternate question to an existing QnA pair.
the QnaThreshold used to perform the queries in Bot's App Settings was set to 0.04
To troubleshoot the issue, you can try to set the ScoreThreshold to 0, then override RespondFromQnAMakerResultAsync and check the actual QnAMakerResult returned by QnAMaker service.

I see the questions you ask are not exactly the same
"donde comprar entradas" <> "donde compro entradas", this could explain some of the differences.
Then, I think that QnA Maker test chat uses some kind of staging environment whereas Azure Bot Chat uses the last published version of the KB.
Are you sure you have published your last changes ?

The issue is already solved.
The problem was generated by the data type of the App Settings variables. These values are strings encoded in IBM852 into the process.env object and when Javascript convert them into float or integer types the generated values are not correct.
Applying the respective conversion functions like parseFloat() or parseInt() before using the app settings variables in app.js will solve the problem.
Thanks Tyrel Roesler, Web App Support Engineer from Microsoft, for helping me to discover the problem.

Related

How can we log user-bot conversations using the Microsoft Bot Framework?

I am starting to create my first bot with Microsoft Bot Framework with the help of Azure, initially I want to know where all the conversations the user has with the bot are stored, so then get a log of all the conversations that have been held.
I already have some answers stored in knowledge bases using QnA Maker, for certain questions that you can answer, I want to know where the questions that were not answered or better that the bot could not answer are stored.
You can configure QnaMaker to log questions and answers to application insights then use the built-in analytics to query it.
Documentation
Conversation data is not stored by default, but you can configure your Bot to store conversation data using different methods.
One way is using a Cosmos DB - Save conversation history from MS bot to cosmos db
Another is using REST and a SharePoint List - Save question when no answer is available for that question (new question) in QnA Maker Knowledge Base

Azure Bot - communicate through REST APIs

I have to integrate 2 different azure bots into a single azure bot application. So thinking of integrating with the REST api. Will this approach work ?
From this links
https://learn.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-connector-quickstart?view=azure-bot-service-4.0
https://learn.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-connector-api-reference?view=azure-bot-service-4.0
I can get the access token from cloud bot. But there is no example on "sending message from client". It have examples on handling client messages from server as Activity object.
It would be better if any samples on "sending message from client to azure cloud throught REST"
what is different between REST and connectors.?
I believe it will be possible with DirectLine, but wanted to know how to do thorugh REST APIs.
Thanks in Advance !!
I can't tell you whether or not your idea will work for dealing with two separate bots without more information. If you are trying to start conversations with both bots and the sending messages to the different conversations based on some set of criteria than that should work.
The Bot Framework API can essentially split into two sections:
The Connector (primary) API that the bot uses to talk to users and the service.
The DirectLine API that you can use to talk to the bot instead of using one of the built-in connectors like Slack or Teams.
Based on your needs, the DirectLine is indeed what you are looking for. The directline.botframework.com/v3/directline/conversations/abc123/activities endpoint will allow a client app to send a message to the connected bot.

Customise Azure bot framework in NodeJs using DirectLine JS

I am looking for a solution which has Customised Azure bot in website. I am not looking for an iFrame integration, As i have already explored. I need a solution which gives me an option to make UI changes in the bot window and invoke Live agent Chat window(Third party) from the existing Chatbot.
I tried these link below which dint help
https://github.com/Microsoft/BotFramework-WebChat
I understand exactly what you need.
It's true that the github url you pasted won't help but I know you'll get a lot of tips from the Direct Line and DirectLineJS documentation from the Advanced part.
You simply need a way to integrate to the Bot Framework from your existing UI system and hence using the Bot as just an Endpoint.
Your solution lies in the actual implementation methods for various channels that is supported by Bot Framework. Take Skype or Facebook for instance.
You need to study and configure WebHooks, Direct-Line Channels.
First: Use the Azure Portal to add a new website to your Bot in Channel property.
Secret Keys would be generated for you after then you can configure for version 1.1 or 3.0.
Check the Documentation here: https://learn.microsoft.com/bot-framework/rest-api/bot-framework-rest-direct-line-concepts
Now your site can be configured to talk to the Bot Framework via Web Clients and Sockets as API requests.
With these, you have the priviledge to use your own UI with the Bot Framework.

Bot Framework bot randomly doesn't answer messages

I have a bot that consists of a Facebook Messenger connected to my bot code via the Microsoft Bot Framework. The bot works fine in the webchat, however on Facebook Messenger only about 1/3 of my messages get delivered to the bot.
That means that I have to send "hi" three or four times before the bot answers me once. Before it answers, the message shows as undelivered. There is nothing in the Bot Framework log in the web interface at dev.botframework.com, and my bot code (running on Azure) doesn't even receive anything from the bot framework - no HTTPS request whatsoever. When it does receive something (which, again, is about 1/3 of the times), the bot answers properly.
In facebook settings, I am using the standard endpoint (https://facebook.botframework.com/api/v1/bots/[my bot name]).
It just seems that most messages are somehow lost between Facebook and Bot Framework, and never reach my bot code.
There is no logging on the Facebook side so I'm out of ideas how to debug - there are no traces of any errors anywhere.
Update: the problem seems to occur only with bots registered using the Microsoft's new method of registering bots via Azure Portal. Bots registered at dev.botframework.com don't seem to be affected.
In case the application is hosted in an Azure WebApp or Azure Function App, please turn on Always On for the application. Might be when you call the Bot API, it switches it from stand by mode to On, that might come with some latency since Microsoft idles it's WebApp by default. And by default, Always On is kept to OFF.
Refer here to turn On , Always ON.
If you have not hosted the Bot Framework in Azure, then it might be a different issue altogether.

QnA Bot works when tested, but when embedded on a website always replies with "No Match Found!" unless an exact match

So I created a QnA bot using the Azure Portal and when I test the bot in the Azure Portal or embed the bot on a website and ask a variation of a question the bot should be able to answer, I receive the message "No Match Found!"
When I test the bot at the qnamaker.ai site and ask the exact same question, the bot works fine.
The odd thing is if I type the question exactly as it appears in my FAQ list, it works just fine and shows the correct response when tested on the azure portal, the web embed and the qnamaker.ai site.
I've trained and published the bot over and over to no avail. Am I missing something?
Following are screenshots of the various responses I get to the same question:
This is the result of the test at the qnamaker.ai site. The response from the bot is the expected response:
This is the result of the test at the Azure Portal site. The response from the bot is not right:
This is the result of the bot being embedded in a site. The response from the bot is also not right:
Can anyone please help? I'm losing my mind!
You have to set subscription key and knowledgebaseID in azure portal under Application Setting.

Resources