getting started with smart speakers voice interfaces
play

Getting started with Smart Speakers & Voice Interfaces Ben - PowerPoint PPT Presentation

Getting started with Smart Speakers & Voice Interfaces Ben Teese Darren Cibis What were going to do Demo Amazon Echo Google Home Parting thoughts Demo The Interweb Amazon Echo Lambda Alexa Skill Function The Lambda


  1. Getting started with Smart Speakers & Voice Interfaces Ben Teese Darren Cibis

  2. What we’re going to do •Demo •Amazon Echo •Google Home •Parting thoughts

  3. Demo

  4. The Interweb

  5. Amazon Echo

  6. Lambda Alexa Skill Function

  7. The Lambda Function exports.handler = function(event, context, callback) { const request = event.request; const session = event.session; const type = request.type; if (type === 'LaunchRequest') { … } else if (type === 'IntentRequest') { onIntent(request, session, callback); } else { … } };

  8. Drilling in… function onIntent(request, session, callback) { const intent = request.intent; const intentName = intent.name; if (intentName === 'AMAZON.HelpIntent') { … } else if (intentName === 'AMAZON.StopIntent') { … } else if (intentName === 'SetLampColour') { setLampColor(intent, session, callback); } }

  9. f unction setLampColor(intent, session, callback) { const position = intent.slots.position.value || session.attributes.position; let newSessionAttributes, responseText; if (position) { const colour = intent.slots.colour.value; newSessionAttributes = { position }; responseText = "Setting " + position + " lamp colour to " + colour; // Call Lif-X service with the position and colour … } else { responseText = "I'm not sure which lamp you want to use. Please try again.”; } callback(null, { version: '1.0', sessionAttributes: newSessionAttributes, response: { outputSpeech: { type: ‘PlainText', text: responseText, }, shouldEndSession: false } }); }

  10. Alexa Skill Key Concepts •Intents •Sample Utterances •Slots •Dialog Model

  11. Google Home

  12. Actions on API.AI Cloud Google Agent Function

  13. Cloud Function exports.apiDemo = function apiDemo (req, res) { const http = require(‘https'); var color = req.body.result.parameters.Color; var position = req.body.result.parameters.Position; const options = { protocol: "https:", hostname: "api.lifx.com", path: "/v1/lights/label:" + position + "/state", method: "PUT", headers: {"Authorization": "Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"} }; const httpReq = http.request(options); httpReq.on('error', (e) => { console.log('problem with request: ${e.message}'); }); httpReq.write(JSON.stringify({color: color})); httpReq.end(); res.send(); };

  14. Webhook Responses

  15. API.AI Agent Key Concepts •Intents •User Expressions •Entities •Context

  16. It’s About Conversational Interfaces

  17. Thanks @benteese @darren_cibis

Recommend


More recommend