Qnamaker API Replace Alteration - botframework

I have multiple QnA knowledgebases in our Qnamaker. I used QnaMaker API and successfully uploaded alterations data using PUT method
PUT https://westus.api.cognitive.microsoft.com/qnamaker/v4.0/alterations
and I am able retrieve the same using the GET method
GET https://westus.api.cognitive.microsoft.com/qnamaker/v4.0/alterations
But still my bot is not recognizing the alternate keywords. Any thoughts?
Is there any limit on the max number of alternations that we can add.I uploaded around 1000 alternate keyword combinations.
For example:
In my Knowledge Base, here is one example question
What is Variable API?
I want the bot to identify "What is VariableAPI ?" and "What is Variable API" as the same question and respond with the same answer. For this, I uploaded alternations using the Qnamaker API ( PUT) method.
{ "wordAlterations": [
{
"alterations": [
"Variable API",
"VariableAPI"
]
}
] }
Please, anyone, help me understand what I am doing wrong and why my QnAmaker can't identify them as different words

Related

Power Automate Flow Trigger - Microsoft Teams "When keywords are mentioned"

is there a way to get the value of the keyword that is mentioned to trigger the flow?
For example: im using the keyword "Seven", when the keyword is mentioned inside the body of a chat in teams, when it triggered the flow i just wanted to get the keyword "seven" inside the body of chat message and remove other words.
Thank in advance for your help ;)
Here's what i have done so far on my flow:
Flow
Flow Continuation
this is the output i get from the HTML to text action:
Good Morning! The reports have been uploaded for Group7, thank you!  Below are
the homes that were processed: APPV ARBR BTNY BUEN CDHV CTBT EGER FRVW GNV2 JEWH
KMNJ NGLE OZAN PVAL REGL RRAL RURL SACR SAYR SFLD SHHS SNCH TCST VILL The
following had issues with passwords: APPV RRAL SNCH Please review. Group Seven
i want to be able to extract the keyword "Seven" and parse out everything else on the message body.
the purpose is, i will use the keyword seven to trigger another set of flow.
Please note, im using multiple keywords on the trigger action, i have another set of flow i would like to be able to run depending on the keyword

Retrieve multiple questions matching the search keyword in QnA Maker

I have a bot which uses LUIS and QnA Maker.
Now, I am able to send queries and get back response in my bot based on the search keyword. But in case my search keyword is used in multiple questions, QnA Maker just retrieves the first matching QnA pair.
Consider below QnA pair:
What is flexible working? Flexibility to work from home
How to avail flexible working? Get in touch with manager
If the user types the exact question and hits enter, the response would be the answer which matches the question. But, if the user types flexible working in this case the response would be just the first QnA answer. So in this case I would like retrieve both the questions and throw back to the user as a choice of questions to choose from.
I tried overriding the RespondFromQnAMakerResultAsync and also checked the QnA maker APIs. Unfortunately I didn't find any way to do this.
Any help on this please? Let me know if I can rephrase or clarify more on this.
in case my search keyword is used in multiple questions, the QnA maker just retrieves the first matching QnA pair
You can try to specify the top parameter for QnAMakerAttribute, which controls the number of answers to return.
The definition of QnAMakerAttribute:
public QnAMakerAttribute(string subscriptionKey, string knowledgebaseId, string defaultMessage = null, double scoreThreshold = 0.3, int top = 1);
In your QnaDialog, you can specify it like this:
public QnaDialog() : base(new QnAMakerService(new QnAMakerAttribute("{subscriptionKey_here}", "{knowledgebaseId_here}", "Sorry, I couldn't find an answer for that", 0.5, 5)))
{
}
Edit:
The above approach worked for me, it can promote questions and show the answer for selected question.

Correct way to handle entities anytime in middle of conversation

I have started working with the LUIS and bot framework recently, after having some experience also with API AI / Google home development.
In the sample below that, I will use an example (from https://learn.microsoft.com/en-us/bot-framework/nodejs/bot-builder-nodejs-dialog-waterfall) is exemplified a step by step interaction with a user. First, it asks for a date, then a number, then a name for the reserve, and so on.
var bot = new builder.UniversalBot(connector, [
function (session) {
session.send("Welcome to the dinner reservation.");
builder.Prompts.time(session, "Please provide a reservation date and time (e.g.: June 6th at 5pm)");
},
function (session, results) {
session.dialogData.reservationDate = builder.EntityRecognizer.resolveTime([results.response]);
builder.Prompts.text(session, "How many people are in your party?");
},
function (session, results) {
session.dialogData.partySize = results.response;
builder.Prompts.text(session, "Who's name will this reservation be under?");
},
function (session, results) {
session.dialogData.reservationName = results.response;
// Process request and display reservation details
session.send("Reservation confirmed. Reservation details: <br/>Date/Time: %s <br/>Party size: %s <br/>Reservation name: %s",
session.dialogData.reservationDate, session.dialogData.partySize, session.dialogData.reservationName);
session.endDialog();
}]);
In my code, I have a similar multi-parameter dialog, but I want to allow the user to answer with multiple information at the same time in any of the responses it have. For example, after providing the reservation date the user can say "a reserve for Robert for 10 people", so both numbers of people and reservation name are giving at the same time.
To identify these text entities I suppose I have to call LUIS and get the entities resolved from the session context. I notice that the bot object has a recognized method that I think can work for that.
My question is how do I organize the structure of the code and the LUIS utterances and entities? Right now I have an intent with some entities and several utterances samples, but if I send this 'partial' user sentence I think it will not be mapped to the same intent and may not identify the entities with a small sentence like that.
How should I handle this? Do I need to provide samples for the intent with these partial sentences, that may contain only some of the entities?
Thanks
Yes, you should provide samples for all those utterances that you want to your intent to recognize. Not a million of samples, but just as few to get everything trained.
Then, the other problem that you might want to solve next, is asking for the information for those entities missing in the utterance. You can do that manually or you could go one step further and explore the LUIS Action Binding library.

What does MailChimp error code -100 mean?

Had an application using the /lists/subscribe endpoint of the MailChimp API (v1.3 v2.0) that was returning a "-100" error code for a particular address for a time (but it's cleared now.)
This isn't in their list of exceptions – anyone seen this before and know if it might indicate anything useful? Or if it's in that range, but not on the list of "known exceptions", does that just mean an unknown server error?
I'm using this PHP library to talk to the API.
(Of course if I can get an answer MailChimp themselves I'll update this.)
lists/subscribe is actually a v2.0 call. The v1.3 equivalent is listSubscribe. -100 is, IIRC, a validation error and it should come with more description about what specifically the problem was with your submission.
A common validation issue with subscribe calls is passing the email address as a string instead of a JSON Object. This, for example, will return an error:
{
"email": "some.person#somedomain.com"
...
}
Instead, you'd want:
{
"email": { "email": "some.person#somedomain.com" }
...
}
It's a common problem because it's kind of silly to require that format, but that is what's required nonetheless. There are a billion other ways to get validation errors, of course, but that's a good one to double-check.

Google places api restaurant types

When you search for a restaurant in Google places and go to the business profile (i.e.:
https://plus.google.com/107507038669791289691/about?hl=en) the restaurant has a tag (in this case Mexican Restaurant). But when using the Google places api all I can see is a types list
"types" : [ "restaurant", "food", "establishment" ]
Anyone know if it's possible to get the tag "Mexican Restaurant" somehow?
I know about the supported types (https://developers.google.com/places/documentation/supported_types). It is not super helpful.
I was also working in a project which need to get more details about a place using Google Maps and Google Places APIs, and I really spent many hours trying to find something that can help ( Google Places API, Google Maps API, google+ APIs, ... ) but nothing ... the only things that I found is theses 2 issues ( feature requests ) which I hope that Google will add to their APIs someday :
Issue N° 5260 with 13 stars.
Issue N°7878 with 4 stars.
I hope with this SO question that we get more interested persons to get the feature in a soon future version of Google Map or Google Places APIs.
For the Google Places for Work API, I didn't find any information to confirm or not that it contains such feature, but I don't think so.
Hope that can help.
I think you would probably have to revert to the text search method on the api..
https://developers.google.com/places/documentation/search#TextSearchRequests
So your request would end up looking something like the below, restricted down to a specific area
https://maps.googleapis.com/maps/api/place/textsearch/json?query=Mexican+Restaurant&sensor=true&location=40.846,-73.938&radius=20&key=yourKeyHere
However this will return all other Mexican restaurants in the area, so if you just want to return the one result I would use the Place Details request instead.
Separate your place types by PIPE symbol "|"
try like this :
String types = "cafe|restaurant|museum" // Listing places only cafes, restaurants and museums.

Resources