使用 serverless 技術打造支援 alexa 的物聯網服務

26
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved. January 2017 使用 Serverless 技術打造支援 Alexa 的物聯網服務 John Chang (張書源)

Upload: amazon-web-services

Post on 19-Jan-2017

73 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: 使用 Serverless 技術打造支援 Alexa 的物聯網服務

© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

January 2017

使用 Serverless 技術打造支援 Alexa

的物聯網服務

John Chang (張書源)

Page 2: 使用 Serverless 技術打造支援 Alexa 的物聯網服務

Today’s agenda

• Skill building fundamentals

• Voice User-Interface

• Advanced skill building

• Idea Challenge

Page 3: 使用 Serverless 技術打造支援 Alexa 的物聯網服務

70s 80s 90s 00s Present

mode

GUI

web

mobile

character

VUI

Page 4: 使用 Serverless 技術打造支援 Alexa 的物聯網服務
Page 5: 使用 Serverless 技術打造支援 Alexa 的物聯網服務
Page 6: 使用 Serverless 技術打造支援 Alexa 的物聯網服務

Skill Building Fundamentals

Before we code

1. developer.amazon.com

2. aws.amazon.com

Page 7: 使用 Serverless 技術打造支援 Alexa 的物聯網服務

8

The Alexa Service

Alexa

Skills

Kit

Alexa

Voice

Services

© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Page 8: 使用 Serverless 技術打造支援 Alexa 的物聯網服務

9

Alexa Skills Kit: Processing a request

© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Audio

Request

Response

Your

service

Speech Recognition

Machine Learning

Natural Language Understanding

Text to Speech

Cards

Page 9: 使用 Serverless 技術打造支援 Alexa 的物聯網服務

10© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Cards

Alexa Skills Kit: Utterances and Intents

Response

Your

service

Audio

Speech Recognition

Machine Learning

Natural Language Understanding

Text to Speech

RequestIntents

Utterances

Page 10: 使用 Serverless 技術打造支援 Alexa 的物聯網服務

ASR – Automatic Speech Recognition

for tē tīmz

• Forty Times?

• For Tea Times?

• For Tee Times?

• Four Tee Times?

Page 11: 使用 Serverless 技術打造支援 Alexa 的物聯網服務

Alexa, ask Anime Facts for a fact

wake word utteranceskill namelaunch

Utterances and Intents

Page 12: 使用 Serverless 技術打造支援 Alexa 的物聯網服務

One more please

utterance

Utterances and Intents

Alexa, ask Anime Facts for a fact

wake word utteranceskill namelaunch

Page 13: 使用 Serverless 技術打造支援 Alexa 的物聯網服務

GetFactIntent

Intent

utterance slot value

Utterances and Intents

One more please

utterance

Alexa, ask Anime Facts for a fact

wake word utteranceskill namelaunch

Page 14: 使用 Serverless 技術打造支援 Alexa 的物聯網服務

15© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Audio

Speech Recognition

Machine Learning

Natural Language Understanding

Text to Speech

Cards

Alexa Skills Kit: Requests and Responses

Request

Response

Your

service

Page 15: 使用 Serverless 技術打造支援 Alexa 的物聯網服務

16

Alexa Skills Kit: Request and Response

© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

“Help”

Page 16: 使用 Serverless 技術打造支援 Alexa 的物聯網服務

17

Using Lambda for Processing the

Request & generating the response

© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Page 17: 使用 Serverless 技術打造支援 Alexa 的物聯網服務

18

Time to code: Build a fact of the day skill

© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

developer.amazon.com

Skill information

Interaction model

End to end testing

aws.amazon.com

Skill logic

Lambda

Lamdba testing

Check in for the event:

Bit.ly/alexacheckin – event name #Re:Invent

Page 18: 使用 Serverless 技術打造支援 Alexa 的物聯網服務

AnswerIntent {value: “one”}

slot valueIntent

one is the answerslot value

Slots in the utterances

The answer is oneslot value

oneslot value

Page 19: 使用 Serverless 技術打造支援 Alexa 的物聯網服務

21

Utterances and Intent Schema

Utterances Intent Schema

Page 20: 使用 Serverless 技術打造支援 Alexa 的物聯網服務

22

Utterances and Intent Schema

Utterances Intent Schema

Page 21: 使用 Serverless 技術打造支援 Alexa 的物聯網服務

23

Built-in and Custom Slot Types

Page 22: 使用 Serverless 技術打造支援 Alexa 的物聯網服務

24

Session Attributes

© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Page 23: 使用 Serverless 技術打造支援 Alexa 的物聯網服務

25

Session Persistence

© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

exports.handler = function (event, context, callback) {

var alexa = Alexa.handler(event, context);

alexa.appId = appId;

alexa.dynamoDBTableName = 'YourTableName'; // That's it!

alexa.registerHandlers(State1Handlers, State2Handlers);

alexa.execute();

};

this.attributes['yourAttribute'] = 'value';

var yourVariable = this.attributes['yourAttribute']

Add dynamoDB

table name in

your index.js

put

get

Page 24: 使用 Serverless 技術打造支援 Alexa 的物聯網服務

26

State Management

Define states

Event handlers

for “Trivia” state

Event handlers

for “Help” state

Page 25: 使用 Serverless 技術打造支援 Alexa 的物聯網服務

27

Time to code: Build a local search skill

© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

developer.amazon.com

Skill information

Interaction model

End to end testing

aws.amazon.com

Skill logic

Lambda

Lamdba testing

Check in for the event:

Bit.ly/alexacheckin – event name #Re:Invent

Page 26: 使用 Serverless 技術打造支援 Alexa 的物聯網服務

Thank you!