You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
shihxuancheng
4d2ece053c
|
5 years ago | |
---|---|---|
back_end | 5 years ago | |
front_end | 5 years ago | |
resources | 5 years ago | |
.gitignore | 5 years ago | |
README.md | 5 years ago |
README.md
QA Bot
Table of Contents
[TOC]
Startup
All source code can be found on GitHub
- Use back_end/run.py to launch backend app
- front_end/detect_intnt.py is a demo code demostrate that how to detect intents by python api
Intent-Based NLU
Google Dialogflow
Example of Restful API for Fulfillment
==Request==
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": {}
}
==Response==
{
"fulfillmentText": "This is a text response",
"fulfillmentMessages": [
{
"card": {
"title": "card title",
"subtitle": "card text",
"imageUri": "https://assistant.google.com/static/images/molecule/Molecule-Formation-stop.png",
"buttons": [
{
"text": "button text",
"postback": "https://assistant.google.com/"
}
]
}
}
],
"source": "example.com",
"payload": {
"google": {
"expectUserResponse": true,
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "this is a simple response"
}
}
]
}
},
"facebook": {
"text": "Hello, Facebook!"
},
"slack": {
"text": "This is a text response for Slack."
}
},
"outputContexts": [
{
"name": "projects/${PROJECT_ID}/agent/sessions/${SESSION_ID}/contexts/context name",
"lifespanCount": 5,
"parameters": {
"param": "param value"
}
}
],
"followupEventInput": {
"name": "event name",
"languageCode": "en-US",
"parameters": {
"param": "param value"
}
}
}
Reference
- DialogFlow Offical Site
- DialogFlow client api for Python
- DialogFlow v2 rest api reference
- Voice App 開發實務:使用Diagflow+firebase開發Google home App (google assistant action)
Microsoft (bot service + LUIS)
Microsoft QnA Maker
Example of Restful API
==Request==
{
"question": "Is the QnA Maker Service free?",
"top": 3
}
==Response==
{
"answers": [
{
"questions": [
"How do I embed the QnA Maker service in my website?"
],
"answer": "Follow these steps to embed the QnA Maker service as a web-chat control in your website:\n\n\n1. Create your FAQ bot by following the instructions [here](https://docs.microsoft.com/azure/cognitive-services/qnamaker/tutorials/create-qna-bot).\n2. Enable the web chat by following the steps [here](https://docs.microsoft.com/azure/bot-service/bot-service-channel-connect-webchat)",
"score": 70.95,
"id": 16,
"source": "https://docs.microsoft.com/azure/cognitive-services/qnamaker/faqs",
"metadata": []
},
{
"questions": [
"Do I need to use Bot Framework in order to use QnA Maker?"
],
"answer": "No, you do not need to use the Bot Framework with QnA Maker. However, QnA Maker is offered as one of several templates in Azure Bot Service. Bot Service enables rapid intelligent bot development through Microsoft Bot Framework, and it runs in a server-less environment.",
"score": 46.94,
"id": 14,
"source": "https://docs.microsoft.com/azure/cognitive-services/qnamaker/faqs",
"metadata": []
},
{
"questions": [
"How can I create a bot with QnA Maker?"
],
"answer": "Follow the instructions in [this](https://docs.microsoft.com/azure/cognitive-services/qnamaker/tutorials/create-qna-bot)documentation to create your Bot with Azure Bot Service.",
"score": 43.25,
"id": 15,
"source": "https://docs.microsoft.com/azure/cognitive-services/qnamaker/faqs",
"metadata": []
}
]
}
Reference
- 利用 MS Bot framework 與 Cognitive Service 建構自用智慧小秘書 系列
- 使用 Microsoft Conversational AI Tools - 打造新时代的UI界面 系列
- Bot Framework SDF for Python
- QnA Maker
- LUIS
Demo
Agent1 - Wanhai_QABot
qa_bot
Agen2 - Wanhai_ServiceBot
system_pic
whl_report
whl_family
Slide
{%slideshare https://www.slideshare.net/RichardShih4/qa-bot %}