How to determine confidence level in DialogFlow - dialogflow-es

When a user is responding to a question in DialogFlow, is there a way to obtain the confidence levels that was achieved for a specific phrase? Example:
Q: What is the capital of Germany?
A: Berlin
I would like to read back how well the AI understood the user, e.g.:
He said: "Boerlin" ---> 87.3% confidence level that he said "Berlin"
Is there a way to read back this kind of information?

Thomas. Have a look at the Google Apis DetectIntent Documentation.
https://cloud.google.com/dialogflow-enterprise/docs/reference/rest/v2beta1/projects.agent.environments.users.sessions/detectIntent
Using the method is as follows:
POST https://dialogflow.googleapis.com/v2/projects/{DialogFlowProjectName}/agent/sessions/{SessionId}:detectIntent
The body:
{
"queryInput": {
"text": {
"text": "{Question You would like to ask}",
"languageCode": "en-EN"
}
}
}
It Uses OAuth2.0 you can use google OAuth Sandbox to generate a temporary token to use
https://developers.google.com/oauthplayground/
In the response there will be a field:
"intentDetectionConfidence": 0.6776556,
"intent": {
"name": "{IntentId}",
"displayName": "{IntentName}"
}

Related

Get full Instagram Messenger API Conversation List

I'm currently building a chatbot for instagram
I'm following this doc : https://developers.facebook.com/docs/messenger-platform/instagram/features/conversation/
In order to get all my conversation threads...
GET <PAGE_ID>/conversations?platform=instagram
{
"conversations": {
"data": [
{
"id": "<THREAD_ID1>"
},
{
"id": "<THREAD_ID2>"
},
...
]
}
This GET is working, but unfortunately I can only see one conversation, which is a facebook test account that followed us to test our chatbot.
Do anyone know why I wan't see the other threads ? I'm really desperate...

Azure DevOps RestAPI to change the User Access Level

I'm working on an automation to update the access level of the user from Basic to stakeholder using an Azure DevOps RestAPI.
I have tried following Rest API as per documentation but getting bad request.
https://vsaex.dev.azure.com/xxxxxxxx/_apis/userentitlements/d42xxxx-xxxxxxxx-xxxxxx-xxxxxxxxxx?api-version=6.0-preview.3
Input Json:
{
"from": "",
"op": "replace",
"path": "/accessLevel",
"value": {
"accountLicenseType": "stakeholder",
"licensingSource": "account"
}
}
As far as I can see, the body of the request you send is a JSON object, but the example in the documentation specifies the body as JSON array. Not sure if it's a strict requirement, but try wrapping the body into [].
Please use the following body which should work as expected.
[
{
"from":"",
"op":"replace",
"path":"/accessLevel",
"value":{
"accountLicenseType":"stakeholder",
"licensingSource":"account"
}
}
]
See: Examples for more details.

I would like to add one more conversation to actions.json

I have an application within watson assistant that consumes many services from other endpoints. and I would like to call this conversation (from watson) within a google assistant conversation in a certain intention. for example i will develop a rich conversation on google assistant and in one of the options i will call watson's conversation.
I tried as follows, but it didn't work. does anyone know any example that can help me?
{"locale": "pt-BR",
"actions": [
{
"description": "Launch intent",
"name": "MAIN",
"fulfillment": {
"conversationName": "mainConversation"
},
"intent": {
"name": "actions.intent.MAIN"
}
},
{
"description": "Direct access",
"name": "BUY",
"fulfillment": {
"conversationName": "ExampleAction"
},
"intent": {
"name": "com.example.ExampleAction.BUY",
"trigger": {
"queryPatterns": [
"teste",
"azul",
"start"
]
}
}
}
],
"conversations": {
"mainConversation": {
"name": "mainConversation",
"url": "https://us-central1-ericanovo-798cc.cloudfunctions.net/webhook",
"fulfillmentApiVersion": 2
},
"BUY": {
"name": "ExampleAction",
"url": "https://orquestrador-sulamerica-teste.mybluemix.net/api/v1/chat/google?externaltoken=574213c0-e904-11e9-9970-ff484aa25334",
"fulfillmentApiVersion": 2
}
}
}
thanks
That won't work because the webhook for everything published under the same project has to be the same URL. You are expected to handle all the Intents and "actions" at that webhook.
In your case, you would also need to make sure the request is formatted the way the Watson API would be expecting it. The Assistant will send it using the Conversation Webhook Format, and it sounds like you would send it using Watson's Analyze Text API.
You're not showing any of your code, so it is difficult to be sure - but the first would be in a JSON format that you can extract. You can then use a library in Node (such as request-promise to make the calls to Watson. Based on the result from Watson, you'd need to format the results as a response and return it to the Assistant.
It isn't clear why you'd need multiple webhooks specifically, although it is certainly possible that some Intents may make different API calls than others.
Keep in mind that your custom Intents will only be valid on invocation. Subsequent Intents will all be TEXT Intents.

Sending JSON Payload to Slack via AWS Lambda

I am trying to build a Slack app by using AWS lambda and NodeJs. The issue I am facing is that I don't understand in what format does the SlackBot need the JSON payload from my AWS lambda code to display it.
I followed the tutorial video suggested on Slack linked here. In the video, the following JSON object is created and returned from the AWS lambda.
const response = {
statusCode: 200,
body: "Sample Response",
};
The SlackBot posts the text entered in the 'body' property (i.e. 'Sample Response' in this case) as a response. This seems to be working well. But, I need some more flair than simple text so I looked into their Block Kit UI builder. But there seems to be no documentation for how to do this with a similar 'response' JSON object like this. How exactly am I supposed to use the JSON object created by the UI builder?
I do not know much about Web development so sorry if this seems like a very basic question. I wish there was a sample Slack app on their website which showed this.
The following may work for you (I use a similar one on the production);
{
"channel": "your-channel-name",
"username": "channel-username",
"attachments": [
{
"title": "some-title",
"fallback": "some message",
"text": "some text",
"fields": [
{
"title": "sub-title",
"value": "sub-title-value",
"short": true
},
{
"title": "some-other-title",
"value": "some-value"
}
],
"color": "red"
}
],
"icon_emoji": "gun"
}
This link or this one may provide some extra information.

Dialogflow Fulfillment URLnot sending any data

I am building a bot for google assistant. I have enabled fulfillment section for some intents. Dialog flow sends the request to the fulfillment url. The url is executed and a hard coded response is returned. I can see the response in the assistant simulator. Everything works fine except one thing. The request is empty.I can't access fields that are supposed to be present in the request.
I have accessed the same url using post request from a python code and it displays the parameters. So, there are no issues in the code. I think I am missing some configuration option.
I was expecting the post body in the following format:
POST body:
{
"responseId": "ea3d77e8-ae27-41a4-9e1d-174bd461b68c",
"session": "projects/your-agents-project-id/agent/sessions/88d13aa8-2999-4f71-b233-39cbf3a824a0",
"queryResult": {
"queryText": "user's original query to your agent",
"parameters": {
"param": "param value"
},
"allRequiredParamsPresent": true,
"fulfillmentText": "Text defined in Dialogflow's console for the intent that was matched",
"fulfillmentMessages": [
{
"text": {
"text": [
"Text defined in Dialogflow's console for the intent that was matched"
]
}
}
],
"outputContexts": [
{
"name": "projects/your-agents-project-id/agent/sessions/88d13aa8-2999-4f71-b233-39cbf3a824a0/contexts/generic",
"lifespanCount": 5,
"parameters": {
"param": "param value"
}
}
],
"intent": {
"name": "projects/your-agents-project-id/agent/intents/29bcd7f8-f717-4261-a8fd-2d3e451b8af8",
"displayName": "Matched Intent Name"
},
"intentDetectionConfidence": 1,
"diagnosticInfo": {},
"languageCode": "en"
},
"originalDetectIntentRequest": {}
}
But when I print the post data using print(request.POST), the actual post request shown is
One more thing: Does dialog flow append the action at the end of the fulfillment url? If so, I will have to handle the logic separately. I have done it without considering the action name. But a lot of my stuff is hacked, so I just want to be sure.
On another note, is dialogflow good enough? It has worked fine on a few examples similar to what it was trained on. How many training samples does it need to work properly? What is the underlying algorithm used in dialogflow? Or should I use the fulfillment url and handle everything on my own? I am inclined towards the later. I do not have too much faith in the existing chatbots.
Any help is appreciated.
If the Fallback Intent is the one being triggered, then you wouldn't get any parameters since this means that nothing else matched.
Got it. Used request.body. This solves the problem. Then parsed it using json.loads and accessed the parameters.

Resources