Advertisement

More Related Content

Slideshows for you(20)

Advertisement

More from 虎の穴 開発室(20)

Recently uploaded(20)

Advertisement

Alexa-hostedスキルを使って 最速でオウム返しスキルを作る

  1. Copyright (C) 2019 Toranoana Inc. All Rights Reserved. Alexa-hostedスキルを使って 最速でオウム返しスキルを作る 虎の穴ラボ 西志村 友基 2019/04/18 【とらのあな主催】オタクが最新技術を追うライトニングトークイベント6回目
  2. Copyright (C) 2019 Toranoana Inc. All Rights Reserved. 自己紹介 名前:西志村 友基 (ニシシムラ トモキ) 入社:2018年4月 好きなアニメ:きんいろモザイク 備考:わたてん難民 2
  3. Copyright (C) 2019 Toranoana Inc. All Rights Reserved. ‣ Alexa / Alexaスキルとは ‣ Alexa-hostedスキルとは ‣ 最速でアプリを作ってみる ‣ オウム返しをさせる ‣ まとめ 話すこと 3
  4. Copyright (C) 2019 Toranoana Inc. All Rights Reserved. Alexa: Amazon Echoなどのデバイスの中枢となる、音声サー ビスです Alexa スキル: Amazon Echo等で使える拡張機能 国内のスキルは2,000個突破! Alexa / Alexaスキルとは 4
  5. Copyright (C) 2019 Toranoana Inc. All Rights Reserved. ‣ AlexaスキルのバックエンドサービスにAWSのリソ ースを自動的にプロビジョニングして管理するこ とのできる新しい機能。 ‣ 2019/01/24、Alexa Blogにて発表。 ‣ 現在はベータ版。 Alexa-hostedスキルとは 5
  6. Copyright (C) 2019 Toranoana Inc. All Rights Reserved. 通常: バックエンドの開発はAWS Lambdaコンソールへのア クセスが必要。 Alexa-hosted スキル: バックエンド含めた全ての開発が「alexa developer console」上で完結。 AWS アカウントが不要。 通常のスキルとの違い 6
  7. Copyright (C) 2019 Toranoana Inc. All Rights Reserved. 通常のスキルとの違い 通常 Alexa-hosted スキル Alexa スキル以外に もやることが多い… Alexa だけ考えれば いい!! 実装、テスト、公開 7 実装(インテント) テスト 公開 実装(バック エンド)
  8. Copyright (C) 2019 Toranoana Inc. All Rights Reserved. ‣ 現在はNode.jsのみ ‣ AWSの無料利用枠内のみで利用可能。 ‣ AWS Lambda:月100万件のリクエスト ‣ CloudWatch など ※AWSの無料枠については以下を参照ください https://aws.amazon.com/jp/free/ 制約 8
  9. Copyright (C) 2019 Toranoana Inc. All Rights Reserved. ‣ Alexa-hostedスキルを個人のAWSアカウントに移 行しなければいけない。 ‣ 移行猶予は30日。 無料枠を超えたらどうなる? 9
  10. Copyright (C) 2019 Toranoana Inc. All Rights Reserved. alexa developer console にて、新しいスキルを作成す る際、「Alexaがホスト-ベータ」を選択 ※すでに開発中のスキルは変更不可。1分くらいかか ります。 早速作ってみる 10
  11. Copyright (C) 2019 Toranoana Inc. All Rights Reserved. 呼び出し名の設定からエンドポイントの設定まですべ て終わってます!(通常は1から設定が必要) 作成したスキルを確認 11
  12. Copyright (C) 2019 Toranoana Inc. All Rights Reserved. カスタムインテント「HelloWorldIntent」がすでに作 成済みです。 インテント 12
  13. Copyright (C) 2019 Toranoana Inc. All Rights Reserved. すでにAWS Lambdaがエンドポイントとして設定され ています。 ※AWS コンソールで確認することはできません。 エンドポイント 13
  14. Copyright (C) 2019 Toranoana Inc. All Rights Reserved. コードエディタタブを選択するとエディタが表示され ます。 自動生成されたソース確認 Alexa-hosted スキルではない場合、 ↓のような文字表示され、エディタは利用できません。 14
  15. Copyright (C) 2019 Toranoana Inc. All Rights Reserved. 手順は以下のとおり 1. カスタムインテントを設定 1. スロットを設定 1. ソースの修正 オウム返しを実装 15
  16. Copyright (C) 2019 Toranoana Inc. All Rights Reserved. 最速 ↓ ほとんど弄らない 最速で実装 16
  17. Copyright (C) 2019 Toranoana Inc. All Rights Reserved. カスタムインテントの設定 スロット 17
  18. Copyright (C) 2019 Toranoana Inc. All Rights Reserved. Alexaがユーザーの発話した単語を受け取れるように します。 スロットの設定 18 スロットタイプは必須
  19. Copyright (C) 2019 Toranoana Inc. All Rights Reserved. 最も手っ取り早くオウム返しさせるには Alexa Skills Kitが提供するスロットタイプをスロット タイプに設定 スロットタイプの設定 19
  20. Copyright (C) 2019 Toranoana Inc. All Rights Reserved. Alexa Skill Kit が提供するスロットタイプのうち リストタイプ(AMAZON.CityやAMAZON.Colorなど) を使用。 本当はカスタムスロットタイプを作成した方がいいです… (詳細はAlexa Skill Kit - スロットタイプリファレンス https://developer.amazon.com/ja/docs/custom- skills/slot-type-reference.html 参照) スロットタイプの設定 20
  21. Copyright (C) 2019 Toranoana Inc. All Rights Reserved. const HelloWorldIntentHandler = { canHandle(handlerInput) { return handlerInput.requestEnvelope.request.type === 'IntentRequest' && handlerInput.requestEnvelope.request.intent.name === 'HelloWorldIntent'; }, handle(handlerInput) { const speechText = 'Hello World!'; return handlerInput.responseBuilder .speak(speechText) //.reprompt('add a reprompt if you want to keep the session open for the user to respond') .getResponse(); } }; }; ソースの修正 ▼ 修正前 21 こ れ を 修 正
  22. Copyright (C) 2019 Toranoana Inc. All Rights Reserved. const HelloWorldIntentHandler = { canHandle(handlerInput) { return handlerInput.requestEnvelope.request.type === 'IntentRequest' && handlerInput.requestEnvelope.request.intent.name === 'HelloWorldIntent'; }, handle(handlerInput) { const speechText = handlerInput.requestEnvelope.request.intent.slots.message.value; return handlerInput.responseBuilder .speak(speechText) .reprompt(speechText) // 数秒放置すると前の発話を復唱する .getResponse(); } }; ソースの修正 ▼ 修正後 22
  23. Copyright (C) 2019 Toranoana Inc. All Rights Reserved. 呼び出し名を入力→発話を入力 アレクサが発話を復唱すれば成功 テスト 23
  24. Copyright (C) 2019 Toranoana Inc. All Rights Reserved. ‣ Alexa-hosted スキルでAWS Lambdaの知識がなく ても開発可能。 ‣ 無料枠の制約がありますが、スモールスタートに は充分。 ‣ 無料枠を超えることが目標にもなる。 ‣ たった数行の修正で、独自のスキルが実装可能。 ‣ まだAlexa スキルを作ったことのない方に特におす すめ まとめ 24
  25. Copyright (C) 2019 Toranoana Inc. All Rights Reserved. Alexa Blogs https://developer.amazon.com/ja/blogs/alexa/ Alexa Skills Kit ドキュメント https://developer.amazon.com/ja/docs/ask- overviews/build-skills-with-the-alexa-skills-kit.html 参考 25
  26. Copyright (C) 2019 Toranoana Inc. All Rights Reserved. 本日、「やまびこボット」が公開されました。 https://www.amazon.co.jp/dp/B07QQ4SV6X/ 26 宣伝
  27. Copyright (C) 2019 Toranoana Inc. All Rights Reserved. ご清聴ありがとうございました 27
Advertisement