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
毎日13時間もかかるバッチ処理をたった3日で60%短縮するためにやったこと
sho_ssk_
1
450
良いユニットテストを書こう
mototakatsu
11
3.4k
採用事例の少ないSvelteを選んだ理由と それを正解にするためにやっていること
oekazuma
2
1.1k
週次リリースを実現するための グローバルアプリ開発
tera_ny
1
120
開発者とQAの越境で自動テストが増える開発プロセスを実現する
92thunder
1
210
為你自己學 Python
eddie
0
480
PHPUnitしか使ってこなかった 一般PHPerがPestに乗り換えた実録
mashirou1234
0
370
iOS開発におけるCopilot For XcodeとCode Completion / copilot for xcode
fuyan777
1
810
PHPで作るWebSocketサーバー ~リアクティブなアプリケーションを知るために~ / WebSocket Server in PHP - To know reactive applications
seike460
PRO
2
700
今年のアップデートで振り返るCDKセキュリティのシフトレフト/2024-cdk-security-shift-left
tomoki10
0
300
見えないメモリを観測する: PHP 8.4 `pg_result_memory_size()` とSQL結果のメモリ管理
kentaroutakeda
0
820
Jaspr Dart Web Framework 박제창 @Devfest 2024
itsmedreamwalker
0
120
Featured
See All Featured
Optimising Largest Contentful Paint
csswizardry
33
3k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.4k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Typedesign – Prime Four
hannesfritz
40
2.4k
It's Worth the Effort
3n
183
28k
Fireside Chat
paigeccino
34
3.1k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
230
52k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
29
2k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
6
470
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Product Roadmaps are Hard
iamctodd
PRO
50
11k
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