Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to Actions on Google

Ben Wicks
September 07, 2018

Introduction to Actions on Google

I presented this at AIM HDC 2018. http://sched.co/FEzu

Ben Wicks

September 07, 2018
Tweet

More Decks by Ben Wicks

Other Decks in Programming

Transcript

  1. CRi Employs Passionate, Driven Professionals who… It’s Not Only Our

    Motto, It’s Our Culture ▪ Customer Service ▪ Initiative ▪ Flexibility ▪ Technical Expertise ▪ Professionalism
  2. Intent Matching — Match and categorize user input to an

    intent Entity Extraction — Identify key words and phrases spoken by the user Fulfillment — Connect to your business logic to make things happen ” @ >
  3. Webhook (optional) “Ok Google, talk to personal chef” Dialogflow Agent

    Invoke “personal chef” action “Well, it’s kind of cold outside, so I’d like something to …” “Sure, here’s personal chef.
 Hi, I’m your personal chef, what are you in the mood for?” “What protein would you like to use?” Speech to Text Text to Speech APP Knowledge Graph ML Ranking User Profile
  4. Cowabunga, dude! What flavors do you crave? The bus is

    approaching your stop now. Your trip will take 45 minutes.
  5. Buy a pizza Getting there soon Purchase a ticket Arriving

    soon Look at your order Review your schedule
  6. code code code code code code code code code code

    code “dialog string” code code code code code code code code code code “dialog string” code code code code code code code code code code code code code code code code code code code code code code code “dialog string” code code code code code
 code code code
 code code code code code code code code code code code code code code code code code STRUCTURE CODE
  7. code code code code code code code code code code

    code “dialog string” code code code code code code code code code code “dialog string” code code code code code code code code code code code code code code code code code code code code code code code “dialog string” code code code code code
 code code code
 code code code code code code code code code code code code code code code code code STRUCTURE CODE
  8. real life user conditions { interrupted self correction cut off

    too soon side speech confused no way out too many choices valid but not in grammar don’t speak the language background noise ask a question back none of the choices match coughs connection cuts out didn’t understand hesitate knows options by other terms stutter start too quiet talked too long
  9. When a so-called “error” occurs
 in a conversation, it should

    be treated simply as a new turn in the dialog.
  10. Use the context Environmental Where is the user? What are

    they doing? What type of device are they using?
  11. Use the context Environmental Where is the user? What are

    they doing? What type of device are they using? Situational What’s their intent? Where is the user’s frame of mind?
  12. Use the context Environmental Where is the user? What are

    they doing? What type of device are they using? Situational What’s their intent? Where is the user’s frame of mind? Temporal What happened right before? What’s happening next? How is the experience influenced over time?
  13. Use the context Environmental Where is the user? What are

    they doing? What type of device are they using? Situational What’s their intent? Where is the user’s frame of mind? Temporal What happened right before? What’s happening next? How is the experience influenced over time? Behavioral What do users know going in? What data can you use to predictively enrich the experience or to cut out unnecessary steps?
  14. Best Practices: Starting & Ending Kick off the conversation: introduce

    your brand,
 provide a list of available high level intents.
  15. Best Practices: Starting & Ending Kick off the conversation: introduce

    your brand,
 provide a list of available high level intents. Kick off the conversation: if given the context.
 Example: Talk to <agent_name> about <subject_one> to avoid menu listening.
  16. Best Practices: Starting & Ending Kick off the conversation: introduce

    your brand,
 provide a list of available high level intents. Kick off the conversation: if given the context.
 Example: Talk to <agent_name> about <subject_one> to avoid menu listening. Use graceful goodbyes: both after success & if the user needs to leave early.
  17. Best Practices: Along the Way Guide user through the conversation:

    If you expect users to speak, make sure to ask a clear question. Don’t leave mic open without a prompt.
  18. Best Practices: Along the Way Guide user through the conversation:

    If you expect users to speak, make sure to ask a clear question. Don’t leave mic open without a prompt.
  19. Best Practices: Along the Way Guide user through the conversation:

    If you expect users to speak, make sure to ask a clear question. Don’t leave mic open without a prompt. Stay on topic
  20. Best Practices: Along the Way Guide user through the conversation:

    If you expect users to speak, make sure to ask a clear question. Don’t leave mic open without a prompt. Stay on topic Use conversational markers:
  21. Best Practices: Along the Way Guide user through the conversation:

    If you expect users to speak, make sure to ask a clear question. Don’t leave mic open without a prompt. Stay on topic Use conversational markers: • Timelines - “first”, “halfway there”, “finally”
  22. Best Practices: Along the Way Guide user through the conversation:

    If you expect users to speak, make sure to ask a clear question. Don’t leave mic open without a prompt. Stay on topic Use conversational markers: • Timelines - “first”, “halfway there”, “finally” • Acknowledgements - “thanks”, “got it”, “sorry, about that”
  23. Best Practices: Along the Way Guide user through the conversation:

    If you expect users to speak, make sure to ask a clear question. Don’t leave mic open without a prompt. Stay on topic Use conversational markers: • Timelines - “first”, “halfway there”, “finally” • Acknowledgements - “thanks”, “got it”, “sorry, about that” • Positive feedback -”good job”, “nice to hear”
  24. Sample Dialogs What to include: 1. Canonical “Happy path” 2.

    First time experience 3. Return experience 4. Repair
  25. Sample Dialogs USER Ok Google, let me talk to Number

    Genie. GOOGLE ASSISTANT Sure, Here's Number Genie. NUMBER GENIE Welcome to Number Genie! I'm thinking of a number from 0 to 100. What's your first guess? USER (says nothing) NUMBER GENIE I didn't hear a number. USER (silent or muffled) NUMBER GENIE If you're still there, what's your guess? Conversation repair for timeouts
  26. USER Hey Google, let me talk to Number Genie. GOOGLE

    ASSISTANT Sure, Here's Number Genie. NUMBER GENIE Welcome to Number Genie! I'm thinking of a number from 0 to 100. What's your first guess? USER 21 NUMBER GENIE It’s higher than 21. What’s your next guess? USER I give up. [LOGIC: catch ending intent] NUMBER GENIE Sure, I’ll tell you the number anyway. It was 90. Sample Dialogs User gives up & ends the game
  27. How to recover a conversation? Key #1 Error cannot be

    eliminated Key #2 Give a broader explanation when re-prompting
  28. How to recover a conversation? Key #1 Error cannot be

    eliminated Key #2 Give a broader explanation when re-prompting Key #3 Never blame the user
  29. How to recover a conversation? Key #1 Error cannot be

    eliminated Key #2 Give a broader explanation when re-prompting Key #3 Never blame the user Key #4 Don’t repeat prompts in error cases
  30. Rapid reprompt “What was that?” “Say that again?” Reframe the

    question “What time is this for?” " “Sorry, what time?” “For when?” " “What time would you like to book this for?” Strategies to have ready
  31. Rapid reprompt “What was that?” “Say that again?” Reframe the

    question “What time is this for?” " “Sorry, what time?” “For when?” " “What time would you like to book this for?” Ask another way “If it helps, we can do this one piece a time.” Strategies to have ready
  32. Rapid reprompt “What was that?” “Say that again?” Reframe the

    question “What time is this for?” " “Sorry, what time?” “For when?” " “What time would you like to book this for?” Ask another way “If it helps, we can do this one piece a time.” Be ready for questions about the question “I have your name and email from your account, so now all I need is your phone number.” “You can give me the day, the time, or both.” Strategies to have ready
  33. Rapid reprompt “What was that?” “Say that again?” Reframe the

    question “What time is this for?” " “Sorry, what time?” “For when?” " “What time would you like to book this for?” Ask another way “If it helps, we can do this one piece a time.” Be ready for questions about the question “I have your name and email from your account, so now all I need is your phone number.” “You can give me the day, the time, or both.” Be proactive “I could put you down for 6 for now, does that work?” “Do you want to finish this later?” Strategies to have ready
  34. Give users credit They know how to talk Avoid force

    feeding commands. (“to reply to a message, say ‘reply’” or “to hear that again, say ‘repeat’”.) People hardly ever say nonsense. There was a misalignment in meaning.
  35. Give users credit They know how to talk Avoid force

    feeding commands. (“to reply to a message, say ‘reply’” or “to hear that again, say ‘repeat’”.) People hardly ever say nonsense. There was a misalignment in meaning. They know what they want There’s no such thing as a query with no intent. The user wanted to do something, even if they didn’t say so.
  36. Give users credit They know how to talk Avoid force

    feeding commands. (“to reply to a message, say ‘reply’” or “to hear that again, say ‘repeat’”.) People hardly ever say nonsense. There was a misalignment in meaning. They know what they want There’s no such thing as a query with no intent. The user wanted to do something, even if they didn’t say so. They want to help Don’t create dead ends when something doesn’t work. If you ask for them to say something again, they will, but rarely exactly the same way. Honor that they’re invested in outcome of a repair attempt.
  37. Intent • A goal or task that users want to

    do, such as ordering coffee or finding a piece of music. • An Intent in Dialogflow has a unique ID & maps between things a user might say and an action that your agent should take.
  38. Entity • Tool for extracting parameter values from natural language

    inputs. • There are many “system” entities already defined including dates, times, locations, colors, etc. • You should define your own if a system entity doesn’t exist.
  39. Fulfillment • A service, app, or other logic that handles

    an intent and carries out the corresponding Action. • How you connect your Dialogflow agent to code.
  40. const {dialogflow} = require('actions-on-google'); const functions = require('firebase-functions'); const app

    = dialogflow({debug: true}); app.intent('make_name', (conv, {color, number}) => { conv.close(`Alright, your silly name is ${color} ${number}! ` + `I hope you like it. See you next time.`); }); exports.sillyNameMaker = functions.https.onRequest(app);
  41. const { NewSurface, } = require('actions-on-google'); const showLocationOnScreen = (conv)

    => { const capability = 'actions.capability.SCREEN_OUTPUT'; if (conv.surface.capabilities.has(capability) || !conv.available.surfaces.capabilities.has(capability)) { return conv.close(sayLocation()); } conv.ask(new NewSurface({ context: newSurfaceContext, notification: notificationText, capabilities: capability, })); };
  42. const { NewSurface, } = require('actions-on-google'); const showLocationOnScreen = (conv)

    => { const capability = 'actions.capability.SCREEN_OUTPUT'; if (conv.surface.capabilities.has(capability) || !conv.available.surfaces.capabilities.has(capability)) { return conv.close(sayLocation()); } conv.ask(new NewSurface({ context: newSurfaceContext, notification: notificationText, capabilities: capability, })); };
  43. conv.close(new SimpleResponse({ text: json.info, speech: `${data.author}, from Google ` +

    `Developer Relations once said... ${randomQuote}` })); if (conv.screen) { conv.close(new BasicCard({ text: randomQuote, title: `${data.author} once said...` image: new Image({ url: BACKGROUND_IMAGE, alt: 'DevRel Quote' }) })); }
  44. conv.ask('<speak> Here are <say-as interpret-as="characters">SSML</say-as> samples. I can pause <break

    time="3s"/>. I can play a sound <audio src=“https://example.com/SOUND.mp3”/>. I can speak in cardinals. Your number is <say-as interpret-as="cardinal">10</say-as>. Or I can speak in ordinals. You are <say-as interpret-as="ordinal">10</say-as> in line. Or I can even speak in digits. The digits for ten are <say-as interpret-as="characters">10</say-as>. I can also substitute phrases, like the <sub alias="World Wide Web Consortium">W3C</sub>. Finally, I can speak a paragraph with two sentences. <p><s>This is sentence one.</s><s>This is sentence two.</s></p> </speak>');
  45. conv.ask('<speak> Here are <say-as interpret-as="characters">SSML</say-as> samples. I can pause <break

    time="3s"/>. I can play a sound <audio src=“https://example.com/SOUND.mp3”/>. I can speak in cardinals. Your number is <say-as interpret-as="cardinal">10</say-as>. Or I can speak in ordinals. You are <say-as interpret-as="ordinal">10</say-as> in line. Or I can even speak in digits. The digits for ten are <say-as interpret-as="characters">10</say-as>. I can also substitute phrases, like the <sub alias="World Wide Web Consortium">W3C</sub>. Finally, I can speak a paragraph with two sentences. <p><s>This is sentence one.</s><s>This is sentence two.</s></p> </speak>');