Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Alexa-SDK-V2基礎講座@大阪
Search
chao2suke
October 19, 2018
Technology
110
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Alexa-SDK-V2基礎講座@大阪
2018/10/17 Alexa Salon vol.3@大阪 登壇資料
chao2suke
October 19, 2018
More Decks by chao2suke
See All by chao2suke
天井カメラで捉えた人物をコンピュータビジョンで解析した3年間のトライアンドエラーとこれから
chao2suke
0
2.5k
結局普通のエンジニアが今SageMaker使うと何ができるのかわかるLT
chao2suke
0
1.8k
機械学習の知識ゼロでも動かせるAIツールキットの世界
chao2suke
0
1.9k
「今」のAI技術と「3年後」のAI技術のご紹介
chao2suke
0
1.2k
Alexaに詳しい人は普段Alexaをどう扱っているか
chao2suke
0
1.1k
奥深きAPLの世界
chao2suke
0
140
Alexaスキル & レジレスCafeにおけるStripe活用の取り組み
chao2suke
0
2.1k
Alexa x 機械学習でスキルをよりリッチにする方法
chao2suke
0
1.8k
#AAJUG vol.2 APL ハンズオン
chao2suke
0
3.1k
Other Decks in Technology
See All in Technology
KPIだけでは評価できないプロダクトが考えるべき Evalsという第二の評価系 / Beyond KPIs: Evals as a Second Evaluation Framework for Products #PdEConf
aki_iinuma
4
3.9k
Sigmaで作る業務アプリ
kazushiro_honma
0
120
2026-09-09 【sigma_ucj#1】Sigma を IaC 管理したい! / IaC for Sigma
civitaspo
0
120
作り直せるコードは迅速に 作り直せないDBは慎重に - AI時代のプロダクトエンジニアが「判断の不可逆性」で開発速度を変える話
kinosuke01
0
310
山手線を徒歩で一周してわかった、 位置情報アプリは「足」が最強のデバッガー
hinakko
0
110
目の前の楽しいが人生を変える - コミュニティの螺旋の歩き方と楽しむコツ / change your life
soudai
PRO
4
470
The Agent Builder Loop from Daily Work to OSS
minorun365
PRO
3
130
Omarchy Quattro の日本語設定周り
simosako
2
150
enechainの内製セルフサービスプラットフォーム
hiyosi
0
160
Redmine 7.0で私が開発した新機能の狙いと背景
vividtone
1
160
WAF 運用改善の承認サイクル/SRE_BizReach_MIXI_1
visional_engineering_and_design
2
470
家のリアーキテクト・リファクタリング
suguruooki
0
120
Featured
See All Featured
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.8k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
680
Heart Work Chapter 1 - Part 1
lfama
PRO
9
36k
Design in an AI World
tapps
1
310
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
BBQ
matthewcrist
89
10k
Leo the Paperboy
mayatellez
9
2.3k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
Speed Design
sergeychernyshev
33
2.1k
Facilitating Awesome Meetings
lara
57
7.1k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
Transcript
Alexa-SDK V2 基礎講座 Alexa-SDK V2 Training course 1 Classmethod, Inc.
せーの
#AlexaSalon 2
!3 ( ) A I A l e x a
& V U I / O /
ί ϛ ϡ χ ς Ο [ A l e
x a S a l o n ] ओ ࠵ A m a z o n ެ ࣜ ϋ ϯ ζ Φ ϯ τ Ϩ ʔ χ ϯ ά ς Ϋ χ Χ ϧ α ϙ ʔ τ A m a z o n ެ ࣜ τ Ϩ ʔ χ ϯ άϖ ʔ δ ੍ ࡞ A l e x a S k i l l A w a r d s ެ ࣜ ϋ ο Χ ι ϯ : ς Ϋ χ Χ ϧ α ϙ ʔ τ ܾ উ ৹ ࠪ һ ॳ ৺ ऀ ͚ A l e x a ຊ ࣥ ච !4
Agenda • コードブロック概要 • Skill Builderについて • インストール⽅法 • Handlerについて
• Response Builderについて • Attribute Managerについて 5
コードブロック概要 6
Hello World 7 const MyHandler = { canHandle(handlerInput) { return
true; }, handle(handlerInput) { return handlerInput.responseBuilder .speak('͜Μʹͪ') .getResponse(); } };
8
9
10
Skill Builder 11
12 Skill Builderとは Skillインスタンスを作るもの
13 Skill Builder Standard Custom
14 Skill Builder Standard Custom 全部⼊り 欲しいところだけ
15 Skill Builder(Custom) Core 基本機能だけ動けばいい Model
16 Skill Builder(Custom) Core DB使いたい Model Persistant Adapter
17 Skill Builder(Custom) Core DBとAPI使いたい Model Persistant Adapter APIClient
18 Skill Builder(Custom) Customコンポーネント Core 基本機能 Model 定義情報 Dynamodb-persistance-adapter DynamoDBによる永続化
S3-peresistance-adapter S3による永続化 Api-client AlexaサービスAPIの使⽤
インストール 19
インストール 20 $ npm install --save ask-sdk
インストール(Coreのみ) 21 $ npm install --save ask-sdk-model $ npm install
--save ask-sdk-core
Customビルダーでの宣⾔ 22 ライブラリのインストール コード冒頭でrequired Skill Builderにメソッド追加
Ex.CustomでDynamoDBを使う 23 ライブラリのインストール $ npm install --save ask-sdk-dynamodb- persistence-adapter $
npm install --save ask-sdk-model $ npm install --save ask-sdk-core
Ex.CustomでDynamoDBを使う 24 'use strict'; const aws = require('aws-sdk-core'); const Adapter
= require('ask-sdk-dynamodb- persistence-adapter'); コード冒頭でrequired
Ex.CustomでDynamoDBを使う 25 const config = {tableName: 'alexa-salon-vol3', createTable: true}; const
DynamoDBAdapter = new Adapter.DynamoDbPersistenceAdapter(config); Skill Builderにメソッド追加
Ex.CustomでDynamoDBを使う 26 const skillBuilder = Alexa.SkillBuilders.custom(); exports.handler = skillBuilder .addRequestHandlers(
LaunchRequestHandler, ) .withPersistenceAdapter(DynamoDBAdapter) .addErrorHandlers(ErrorHandler) .lambda(); Skill Builderにメソッド追加
Handler 27
28 Handler CanHandle Handle
canHandle 29 このHandlerはどのIntentを処理するか True / False
canHandle • このハンドラーはどのIntentを処理するか 30 canHandle(handlerInput) { return handlerInput.requestEnvelope.request.type === 'IntentRequest'
&& handlerInput.requestEnvelope.request.intent.name === 'MenuIntent'; },
31 CanHandle Tips Handlerは登録した順番でCanHandleする exports.handler = skillBuilder .addRequestHandlers( LaunchRequestHandler, OrderProgressIntentHandler,
OrderCompletedIntentHandler, HelpIntentHandler, CancelAndStopIntentHandler, SessionEndedRequestHandler )
handle • 実際の処理内容 32 handle(handlerInput) { return setMenu(handlerInput, null); }
33 Handler Tips Handler-A: 郵便番号がSlotに⼊っている Handler-B: 住所がSlotに⼊っている Handler-C: 何も⼊っていない 近くの店舗をお知らせする
郵便番号を調べて確認する 郵便番号を聞く
Slotのとり⽅ 34 handlerInput.requestEnvelope.request.intent.slots.hand.value
35 Slot Tips requestまでは⼀緒なので変数化する handlerInput.requestEnvelope.request.intent.slots.hand.value var request = handlerInput.requestEnvelope.request; var
slot = request.intent.slots.hand.value;
Response 36
37 Response Builder Tips ResponseBuilderはチェーンで書く return handlerInput.responseBuilder .speak('͢Έ·ͤΜɺΑ͘ฉ͖औΕ·ͤΜͰͨ͠ɻ͏Ұݴͬͯ Β͑·͔͢?') .reprompt('͏ҰݴͬͯΒ͑·͔͢?')
.getResponse();
Response Builder 38 ଟ͗͢Δ
カテゴリに分けてみる。 39
Response Builder 40
Response Builder 41 発話系 speak/response カード系 withXXXcard Dialog Model系 delegate/ElicitXXX/addConfirmXXX
AudioPlayer系 addAudioPlayerXXX Display系 addRenderTemplateDirective Video系 addVideoAppLaunchDirective セッション管理系 withShouldEndSession
Ex.BodyTemplate 42 handlerInput.responseBuilder .speak(speechText) .reprompt(speechText) .addRenderTemplateDirective({ type: 'ListTemplate1', backButton: 'HIDDEN',
backgroundImage: logoImage, listItems: listitems, title: 'ϝχϡʔ', token : gToken, }) .getResponse();
43 Response Builder Tips ResponseBuilderはバラバラに書いて良い
44 Response Builder Tips handlerInput.responseBuilder .speak(‘͜Ε͚ͩͩͱ͚ͩ͢’); if (canReprompt) { .reprompt(‘͜Ε͕ೖΔͱ͍͔͚ʹͳΔ’);
} handlerInput.responseBuilder.getResponse();
Response Builder Tips • じゃんけんであいこの時だけ もう⼀度聞き直す • ディスプレイのついているデバイスからの リクエストのみDisplayRenderをつける 45
Attribute Manager 46
47 Alexa-SDK V2Ͱͷηογϣϯཧ AttributeManager RequestAttributes SessionAttributes PersistentAttributes
͍ํ let attributes = await handlerInput.attributesManager.getPersistentAttributes() handlerInput.attributesManager.setPersistentAttributes(a ttributes); await handlerInput.attributesManager.savePersistentAttributes(
);
͍ํ
͍ํ
None