softshake 2017 - développer un chatbot alexa

19
Développer un chatbot avec Jérôme Van Der Linden – @jeromevdl . . 1

Upload: jeromevdl

Post on 22-Jan-2018

133 views

Category:

Engineering


5 download

TRANSCRIPT

Page 1: Softshake 2017 - Développer un chatbot Alexa

Développer un chatbot avec

Jérôme Van Der Linden – @jeromevdl

..

1

Page 2: Softshake 2017 - Développer un chatbot Alexa

SOFTSHAKE> CREATION D’UN CHATBOT ALEXA

Chatbot Kezako ?

2

“Un chatbot (ou agent conversationnel) est un programme informatique

capable de simuler une conversation naturelle (écrite ou orale)

avec un humain”

Page 3: Softshake 2017 - Développer un chatbot Alexa

3

Page 4: Softshake 2017 - Développer un chatbot Alexa

Architecture

4

Chatbot

Moteur conversationnel

Utilisateur

Question de l’utilisateur

Texte brut

Intention / entités Réponse

Moteur de langage naturel (NLU)

Interprétation

Formulation de la réponse

SI Métier

Calcul de la meilleure réponse

Moteur de règles

Action ou recherche d’informations

API / base de données

Page 5: Softshake 2017 - Développer un chatbot Alexa

5

Page 6: Softshake 2017 - Développer un chatbot Alexa

SOFTSHAKE> CREATION D’UN CHATBOT ALEXA

Ecosystème AlexaHardware

6

Page 7: Softshake 2017 - Développer un chatbot Alexa

SOFTSHAKE> CREATION D’UN CHATBOT ALEXA7

Ecosystème AlexaSoftware

Source:https://fr.slideshare.net/AmazonWebServices/session-7-byilding-voice-enabled-alexa

Page 8: Softshake 2017 - Développer un chatbot Alexa

SOFTSHAKE> CREATION D’UN CHATBOT ALEXA

Vocabulaire Alexa

8

¤ Skill : « compétence » de l’assistant (avec son lot de “fonctionnalités”)¤ 1 skill ~ 1 application

¤ Intent : intention de l’utilisateur, ce qu’il souhaite obtenir de l’assistant• 1 intent ~ 1 “fonctionnalit锧 Il existe des intents prédéfinis (HelpIntent, YesIntent, CancelIntent, RepeatIntent, …)§ Il est possible d’en écrire des customs§ Ex : “Quelle sera la météo demain à Lausanne ?”

¤ Slot / Slot type : équivalent de l’entité, sous-ensemble de l’intent donnant des éléments de contexte§ 1 slot ~ 1 paramètre§ Il existe des slot types prédéfinis (Artist, Color, Country, Date, Food, Movie, Sport, …)§ Il est possible d’en écrire des customs ou d’en étendre des prédéfinis§ Ex : “demain” (AMAZON.DATE), “Lausanne” (AMAZON.EUROPE_CITY)

¤ Sample Utterance : exemples d’énoncé d’un intent. À décliner autant que possible !§ Ex : “Quel temps fera il demain à Lausanne ?” / “Donne moi la météo pour demain à Lausanne” / “Fera-

il beau demain à Lausanne ?” / “Va-t-il pleuvoir demain à Lausanne ?” / …

Inte

ract

ion

Mo

del

Page 9: Softshake 2017 - Développer un chatbot Alexa

9

Page 10: Softshake 2017 - Développer un chatbot Alexa

10

https://github.com/jeromevdl/alexa-got/

Skill « Game Of Thrones »Code source

Page 11: Softshake 2017 - Développer un chatbot Alexa

Skill « Game Of Thrones »Architecture

11

user Alexa skill

Lambda function Node.js

Moteur de langage naturel (NLU)

Moteur conversationnel

CloudWatchMonitoring

AvailabilityZoneus-east-1

API

JSON

JSON

Voice/Text

https://anapioficeandfire.com/

Page 12: Softshake 2017 - Développer un chatbot Alexa

SOFTSHAKE> CREATION D’UN CHATBOT ALEXA

Skill « Game Of Thrones »Intent Schema

12

: [{

: "WhoIsIntent",: [

{: "characterslot",: "CHARACTER"

}],/* utterances */

: ["give me information about {characterslot}","who is {characterslot}","tell me more about {characterslot}","{characterslot}"

]}

]

: [{

: "CHARACTER",: [

{: {

: "daenerys targaryen",: []

}, {,

: { : "jon snow",

: [] }

}, // ...

}]

Moteur de langage naturel (NLU)

Alexa skill

Page 13: Softshake 2017 - Développer un chatbot Alexa

SOFTSHAKE> CREATION D’UN CHATBOT ALEXA

Skill « Game Of Thrones »Event (JSON)

13

{"session": {"sessionId": "SessionId.Session1","application": {"applicationId": "amzn1.ask.skill.xyz"

},"user": {"userId": "amzn1.ask.account.testaccount1"

},"new": true

},"request": {"type": "IntentRequest","requestId": "615dbc98-b1a6-11e7-b212-e3c588b98480","timestamp": "2016-05-19T01:07:55Z","intent": {"name": "WhoIsIntent","slots": {"characterslot": {"name": "characterslot","value": "Jon Snow"

}}

},"locale": "en-US"

},"version": "1.0"

}

Alexa skill

Lambda function

JSON

Page 14: Softshake 2017 - Développer un chatbot Alexa

SOFTSHAKE> CREATION D’UN CHATBOT ALEXA

Skill « Game Of Thrones »Event Handler

14

Lambda function Node.js

Moteur conversationnel

exports.handler = function (event, context) {var alexa = Alexa.handler(event, context);alexa.registerHandlers(handlers);alexa.execute();

};

var handlers = {'WhoIsIntent' : function () {

var characterSlot = this.event.request.intent.slots.characterslot;this.attributes['character'] = characterSlot.value;

this.response.speak(' Hello '+ characterSlot.value).listen('Do you want more information?');

this.emit(':responseReady');}

}

Page 15: Softshake 2017 - Développer un chatbot Alexa

SOFTSHAKE> CREATION D’UN CHATBOT ALEXA

Skill « Game Of Thrones »Response (JSON)

15

Alexa skill

Lambda function

JSON

{"version": "1.0","response": {"shouldEndSession": false,"outputSpeech": {"type": "SSML","ssml": "<speak> Hello Jon Snow </speak>"

},"reprompt": {"outputSpeech": {"type": "SSML","ssml": "<speak> Do you want more information? </speak>"

}}

},"sessionAttributes": {"character": "Jon Snow"

}}

Page 16: Softshake 2017 - Développer un chatbot Alexa

SOFTSHAKE> CREATION D’UN CHATBOT ALEXA16

Skill « Game Of Thrones »Live Code / Demo

Page 17: Softshake 2017 - Développer un chatbot Alexa

SOFTSHAKE> CREATION D’UN CHATBOT ALEXA17

Skill « Game Of Thrones »Tests avec Echosim.io

Page 18: Softshake 2017 - Développer un chatbot Alexa

OCTO © 2017 - Reproduction interdite sans autorisation écrite préalable THERE IS A BETTER WAY

OCTO RECRUTE

WE NEED

Y U

Expertise Tribes

TrustHonesty

Sharing Employee First

Curiosity

#1

Page 19: Softshake 2017 - Développer un chatbot Alexa

19