Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
用 Python + Azure 建立你的聊天機器人
Search
Andy Dai
August 27, 2016
Programming
2
470
用 Python + Azure 建立你的聊天機器人
Andy Dai
August 27, 2016
Tweet
Share
More Decks by Andy Dai
See All by Andy Dai
Analyzing Chinese Lyrics with Python
daikeren
4
1.2k
Other Decks in Programming
See All in Programming
Vue.js学習の振り返り
hiro_xre
2
130
プロジェクト新規参入者のリードタイム短縮の観点から見る、品質の高いコードとアーキテクチャを保つメリット
d_endo
1
1k
カスタムしながら理解するGraphQL Connection
yanagii
1
1.3k
Java ジェネリクス入門 2024
nagise
0
630
Content Security Policy入門 セキュリティ設定と 違反レポートのはじめ方 / Introduction to Content Security Policy Getting Started with Security Configuration and Violation Reporting
uskey512
1
440
破壊せよ!データ破壊駆動で考えるドメインモデリング / data-destroy-driven
minodriven
16
4.1k
CSC509 Lecture 08
javiergs
PRO
0
110
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
150
WEBエンジニア向けAI活用入門
sutetotanuki
0
310
僕がつくった48個のWebサービス達
yusukebe
18
17k
Dev ContainersとGitHub Codespacesの素敵な関係
ymd65536
1
130
Progressive Web Apps für Desktop und Mobile mit Angular (Hands-on)
christianliebel
PRO
0
110
Featured
See All Featured
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
7
160
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
231
17k
Intergalactic Javascript Robots from Outer Space
tanoku
268
27k
Imperfection Machines: The Place of Print at Facebook
scottboms
264
13k
Speed Design
sergeychernyshev
24
580
Building Flexible Design Systems
yeseniaperezcruz
327
38k
What's new in Ruby 2.0
geeforr
343
31k
A Tale of Four Properties
chriscoyier
156
23k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Become a Pro
speakerdeck
PRO
24
5k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8k
Designing the Hi-DPI Web
ddemaree
280
34k
Transcript
አ Python + Azure ୌ 缏֦ጱ肗ॠ秚瑊Ո Andy Dai
[email protected]
1
ᛔ౯Օ奧 • Andy Dai • Organizer of Taipei.py • PyCon
பૡ (2012~) • 犋䨝狶獮ᒒጱૡ纷䒍 @GliaCloud 2
Agenda • Introduction to ChatBot • BotFramework • LUIS •
Recap 3
4
य़ Bot 碻դ 5
10000+ CHATBOTS 6
BOTs are the new APPs 7
肗ॠ秚瑊Ո(CHATBOT) ౯మᥝತݣ玖敋ᒊᴫ蜱犋褖碻ጱ߅珹記 ֦অ牧౯ݢ犥䒻֦犚綍讕珌牫 অጱ牧讔簡䒻౯懪犡ॠӥ܌獋讨 2 ֖ ౯വ萃 OOXX Cafe 襑ᥝ䒻眅懪֖㻟
8
CHATBOT 礍䯤墋Օ ChatBot Interface Web Service Business Logic Natural Language
Understanding User Status External Service THE CORE OF YOUR BOT 9
Microsoft Bot Framework • 犡ଙӣ์朰ڊ • ඪൔଘݣ • Skype •
Facebook • Telegram • Slack 10
BotBuilder SDK • BotFramework ChatBot Interface Web Service Business Logic
Natural Language Understanding User Status External Service • LUIS (Language Understanding Intelligence Service) 11
Open Source SDK. But… 12
C# & Node.js Only :( 13
౯మᥝአ Python ! 14
Why Python? • Daily Job - ਁ蒂ቘ牏CSV/XLS牏粖翕殷 • Web -
Django, Flask • DevOps - Ansible, SaltStack, OpenStack • Ӟ犚盄ᄤጱԪ眐 (Deep Learning, Machine Learning, Natural Language Processing, …) • 螭磪ๅग़䛑አ (Raspberry Pi, ᇔቘ秇硈, 䌃 APP ) 15
IEEE Spectrum ranking 16
ᛔ૩ጱ SDK ᛔ૩䌃 17
BotFramework • ࣁ https://dev.botframework.com/ 戢㲘 • 玲 Client ID &
Client Secret 18
19
20
BotFramework REST API • Authentication • Bot Connecter REST API
• Bot State REST API 21
Authentication 22
pip install requests Requests: HTTP for Humans 23
Authentication import requests def get_token(client_id, client_secret): payload = { 'grant_type':
"client_credentials", 'client_id': client_id, 'client_secret': client_secret, 'scope': "https://graph.microsoft.com/.default", } response = requests.post(AUTH_URL, data=payload) token = response.json()['access_token'] return token 24
犋ੜஞ疰Ӟ粚ݢ犥㵕 ጱ SDK ೪蕕ਠԧ... 25
pip install pybotbuilder 26
DEMO - Echo Bot 27
LUIS • Language Understanding Intelligence Service • 墋㻌㬵藯疰ฎ虏襎脲啻薹Ո觊承ࣁ拻ࠨ 28
᯿ᥝݷ扃薹朰 • Intent • 瑽 • ex. 疨ತ߅珹皣牏扇㺔籧禂碻樌 • Entity
• 䋿誢殻ፓ • ex. ֖ᗝ牏碻樌 29
Example • ֺݙ物౯మತݣ玖敋ᒊᴫ蜱磪矠ଷጱ߅珹皣 • Intent: 疨ತ߅珹皣 • Entity: ݣ玖敋ᒊҁ֖ᗝ҂牏磪矠ଷҁ襑穩҂ 30
獺ୌ APP 31
New Entity 32
New Intent 33
秂懿 34
介手 35
Intent 36
Entity 37
磪Ո䌃অ Python Package ԧ pip install luis 38
DEMO 39
碉ݳࣁӞ蚏 • ತ߅珹皣秚瑊Ո • Django + pybotbuilder + luis •
䌃ጱ code 犋᩻螂 200 ᤈ 40
DEMO 41
Recap • አ Python 犖ݢ犥ֵአ BotFramework • LUIS is easy
• Life is short, you need Python 42
Reference • https://github.com/daikeren/pyBotBuilder • https://blogs.msdn.microsoft.com/tsmatsuz/ 2016/08/19/build-skype-bot-with-microsoft-bot- framework-oauth-and-rest-api/ • https://docs.botframework.com/ •
https://www.luis.ai/Help/ 43
ૡ珶๐率 - Taipei.py • ݣ傀磧य़ጱ Python ᐒᗭ • ྯ㮆์盄ग़ၚ㵕 (Talk,
Sprint, 碝ಋ, …) 44
ૡ珶๐率 - Taipei.py 45
THANK YOU
[email protected]
/ 886 2 2752 8851 Unit.3, 11F.,
No.48, Fuxing N.Rd., Zhongshan Dist., Taipei City 104, Taiwan