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
480
用 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
Amazon Bedrock Multi Agentsを試してきた
tm2
1
280
chibiccをCILに移植した結果 (NGK2025S版)
kekyo
PRO
0
210
富山発の個人開発サービスで日本中の学校の業務を改善した話
krpk1900
4
370
Linux && Docker 研修/Linux && Docker training
forrep
23
4.5k
CNCF Project の作者が考えている OSS の運営
utam0k
5
690
Lottieアニメーションをカスタマイズしてみた
tahia910
0
120
Pythonでもちょっとリッチな見た目のアプリを設計してみる
ueponx
1
480
AWS Organizations で実現する、 マルチ AWS アカウントのルートユーザー管理からの脱却
atpons
0
130
Domain-Driven Transformation
hschwentner
2
1.9k
『GO』アプリ バックエンドサーバのコスト削減
mot_techtalk
0
130
Flutter × Firebase Genkit で加速する生成 AI アプリ開発
coborinai
0
150
『GO』アプリ データ基盤のログ収集システムコスト削減
mot_techtalk
0
110
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
40
2.5k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7.1k
How STYLIGHT went responsive
nonsquared
98
5.3k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
120k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
20
2.4k
A better future with KSS
kneath
238
17k
Building Adaptive Systems
keathley
40
2.4k
4 Signs Your Business is Dying
shpigford
182
22k
Designing for Performance
lara
604
68k
KATA
mclloyd
29
14k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5.2k
A Modern Web Designer's Workflow
chriscoyier
693
190k
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