Download presentation
Presentation is loading. Please wait.
1
QALD vs. Chatbot Speaker: 呂瑞麟 國立中興大學資管系教授
URL:
2
Why? Daily life usage: checking on weather, schedule, etc.
Get things done: setup alarm/reminder Easy access to structured data/services: find docs/photos/restaurants Be more productive in managing your work and personal life. Source:
3
Chatbots Two types of chatbots: Chit-chat Bots: Task-Oriented Bots:
No Specific goal, focus on natural response Task-Oriented Bots: Personal assistant, helps users achieve a certain task. Source:
4
Task-Oriented Chatbots
Source:
5
Task-Oriented Chatbots
Source:
6
Task-Oriented Chatbots
Source:
7
Task-Oriented Chatbots
Source:
8
Platforms or Tools Google Api.ai, is now Dialogflow (sign in with your Google account) Microsoft LUIS Facebook Wit.ai
9
Dialogflow The process a Dialogflow agent follows from invocation to fulfillment is similar to someone answering a question, with some liberties taken
10
Dialogflow
11
Dialogflow
12
Dialogflow
13
Dialogflow
14
Dialogflow
15
Dialogflow
16
Dialogflow
17
Dialogflow: 1st agent 基本上,在 Dialogflow 的一個 agent 可以想成是一個 project,而這個 project 至少包含 Entities Intents Responses For simple replies that don't include information gathered outside of the conversation, you can define the responses directly in the intents. More advanced responses can be made using your own logic and webhook for fulfillment
18
Dialogflow: 1st agent
19
Create intent Click on the plus icon + next to Intents.
Enter a name for your intent. This can be whatever you'd like, but it should be intuitive for what the intent is going to accomplish
20
Create intent
21
Create intent In the Training Phrases section, enter examples of what you might expect a user to ask for. Since you're creating a weather agent, you want to include questions about locations and different times. The more examples you provide, the more ways a user can ask a question and the agent will understand. What is the weather like What is the weather supposed to be Weather forecast What is the weather today Weather for tomorrow Weather forecast in San Francisco tomorrow
22
Create intent 假設我們新增一個 training phrases:
Weather forecast in San Francisco tomorrow 請留意畫面中的黃色以及褐色的反白部分
23
Create intent San Francisco 和 tomorrow 就是我們之前所說的 entities
點一下反白區域,會出現如下畫面
24
Create intent 把所有 training phrases 輸入後,畫面如下。請儲存 “Save”!
25
Try it out 雖然我們第一個 agent 還沒全部完成,但是已經可以試跑看看了。請在畫面右上角的 Try it now 輸入 How's the weather in Denver tomorrow
26
Try it out You won't get a conversational response, but you should see data in the following fields of the console: Response - "Not Available" because the agent doesn't have any actual responses set up yet Intent - weather means the request hit the "weather" intent Parameters - date and geo-city have their respective values from the request (e.g. tomorrow's date and "Denver")
27
Add responses Now you'll add basic responses to the intent so the agent doesn't just sit there in awkward silence. 這裡我們先假設我們的回覆不會使用到外部的訊息(例如氣象局的查詢系統之類的) 如下頁畫面,我們點一下 ADD RESPONSE
28
Add responses
29
Add responses add the lines of text below in the Response section:
Sorry I don't know the weather I'm not sure about the weather on $date I don't know the weather for $date in $geo-city but I hope it's nice! You can see the last two responses reference entities by their value placeholders. $date will insert the date from the request, and $geo-city will insert the city.
30
Add responses
31
Try again add the lines of text below in the Response section:
Sorry I don't know the weather I'm not sure about the weather on $date I don't know the weather for $date in $geo-city but I hope it's nice! You can see the last two responses reference entities by their value placeholders. $date will insert the date from the request, and $geo-city will insert the city.
32
Try again The response chosen is based off of the values you provide in the query (e.g. By providing only the date, the agent should respond with the option that only includes the date) 試一下:How’s the weather tomorrow
33
Exercise 請將剛剛的範例改成中文版
34
Fullfillment (Webhook)
使用 Google Cloud Project 看起來似乎需要提供一些信用卡的資料,我不願意試 也有範例使用一個免費的 Firebase,目前不知道限制為何(其中一個是無法呼叫除了 Google 之外的服務)
35
Fullfillment (Webhook)
36
Fullfillment (Webhook)
37
Dialogflow 我們也可以玩玩後端程式開發的可能性 請複製 Try it now 用的 URL (即 COPY CURL)
38
Dialogflow 有了這個,我們應該可以開發一個網站來模擬 chatbot
也可以自行呼叫其他的遠端服務(只是每次可以存取的時間有限,似乎每隔大約一個小時那個 key 就會失效;不付錢,還是只能玩玩而已) 同時享受 Google 的智慧 NLP 由於是自行開發回答的機制,可以將之前的 Fulfillment 中的設定停用
39
Dialogflow 再次強調,那個 Authorization 不是無限有效 簡單寫個 python 或者其他語言皆可
-H 代表 Headers -d 代表 Data passed to server
40
Dialogflow
41
Dialogflow
42
Dialogflow
43
Web Demo
44
Web Demo
45
LINE 需要申請 LINE developer LINE webhook Dialogflow Trial 帳號不需要錢!
訊息的傳遞是以 JSON 的格式
46
LINE 的設定
47
LINE 在 Dialogflow 的設定
48
LINE 記得要取消 Auto-reply messages 會一直收到
49
LINE 測試 第一次需要利用手機掃描 LINE 設定網頁上的 QRCode 即可進行對話
50
其他 Prebuilt Agents Small talk
51
Microsoft LUIS Microsoft 也有平台 讓我們使用同樣的 weather 範例跑一次 喔,目前只支援簡體中文
讓我們使用同樣的 weather 範例跑一次 喔,目前只支援簡體中文
52
Microsoft LUIS
53
Microsoft LUIS 點一下左邊的 entities,並選擇 prebuld entities 以及 prebuilt domain entities
54
Microsoft LUIS
55
Microsoft LUIS
56
Microsoft LUIS 雖然加了其他系統提供的問句,系統還是無法判斷 San Fracisco 是 Weather.Location
請在 san 上點一下,立刻移動滑鼠到 francisco 上,然後立即點一下。最後,設定它為 Weather.Location
57
Microsoft LUIS 請點一下畫面右上角的 Train。訓練成功後,Train 會出現綠色點,且出現 Test。
可惜只能試到這裡,應該如果需要回覆一些比較聰明的回答(甚至制式的回答)都需要建立一個提供信用卡的帳號。放棄! 以下測試的方式,可能隨時會被 Microsoft 停掉。感覺上,可以自行架構“智慧的回答”。
58
Microsoft LUIS 硬要 publish 將 Resources and Keys 下方的 URL 複製
59
Microsoft LUIS 在 q= 之後加上 the weather in Rome tomorrow,在把整個 URL 貼上
請特別留意 subscription-key 的資訊
60
Microsoft LUIS 我們先以 python 3 測試看看。
請到 複製並修改程式碼
61
Microsoft LUIS 執行畫面如下
62
Microsoft LUIS 有了這樣的用法概念後,我們就可以利用 LUIS 來幫我們做 NLP
架構:建立一個 web server (or service) 提供輸入的界面 利用剛剛的 url 就可以呼叫 LUIS LUIS 執行後,就把結果回傳。 我們再根據回傳的資料(json)做必要的處理(例如,根據日期和地點,呼叫遠端的氣象服務)
63
References Google’s Dialogflow 一天搞懂對話機器人,臺大資訊系陳縕儂教授的 Tutorial
一天搞懂對話機器人,臺大資訊系陳縕儂教授的 Tutorial
Similar presentations