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
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
610
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
1k
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
220
Duckdb-Wasmでローカルダッシュボードを作ってみた
nkforwork
0
130
Jakarta EE meets AI
ivargrimstad
0
650
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
260
TypeScriptでライブラリとの依存を限定的にする方法
tutinoko
3
700
よくできたテンプレート言語として TypeScript + JSX を利用する試み / Using TypeScript + JSX outside of Web Frontend #TSKaigiKansai
izumin5210
6
1.8k
レガシーシステムにどう立ち向かうか 複雑さと理想と現実/vs-legacy
suzukihoge
14
2.3k
OSSで起業してもうすぐ10年 / Open Source Conference 2024 Shimane
furukawayasuto
0
110
Jakarta EE meets AI
ivargrimstad
0
190
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
120
Featured
See All Featured
Keith and Marios Guide to Fast Websites
keithpitt
409
22k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Documentation Writing (for coders)
carmenintech
65
4.4k
Making Projects Easy
brettharned
115
5.9k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Docker and Python
trallard
40
3.1k
Speed Design
sergeychernyshev
25
620
Building a Scalable Design System with Sketch
lauravandoore
459
33k
Intergalactic Javascript Robots from Outer Space
tanoku
269
27k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
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