SPEAKER 1: Want to play the game?
SPEAKER 2: Yes, I do.
SPEAKER 1: Great.
Let's get started.
SPEAKER 2: When I said, "yes, I do," you can probably tell
that I'm agreeing to play the game.
If I said "yep" instead, it would still be the same.
I'm agreeing.
I'm saying yes.
But how did you know what I meant when I said, "yes, I do"?
What does saying yes mean?
How do you know that I'm asking you to question how you process
the words that I'm saying?
Big questions.
But ultimately the likelihood is that you're
able to map my words to other examples
in your experience that are similar
and apply logic, like the fact that the action asked me
if I want to play the game right before.
When building for Google Assistant,
your action needs to do this too.
It needs to map what users are saying
to some type of knowledge and apply logic
so it could generate the right response.
Your action defines what user input is valid,
what you do with intents.
Let's go over what intents are in general
and how they work, then dive into the two categories--
system intents and custom intents.
Intents are general machine learning concepts
that classify users' input or system
events into a structured object that your action can process.
For example, you create intents that
handle users' input with variations like "yes, I do,"
"yes," or "yeah."
An intent maps all of these variations to a single event
so you can handle users' input variation in predictable ways.
Now let's see how intents work.
Here is a diagram of the user, Google Assistant,
and your action.
When a user provides input, Google Assistant
processes the user's input and uses up
the assistance natural language understanding to match
the user's input to an intent.
Then, Assistant passes the intent information
to your actions project.
Then your action can process that and construct a prompt
for the user, which is then given to the Google Assistant.
And then the Assistant delivers that prompt to the user.
Earlier, I mentioned that there are two types of intents--
system intents and custom intents.
Let's dive into each of these.
System intents represent common events
and define the language model for you automatically.
Some examples of system intents are
when a user invokes your action, when
a user says "pause" to pause the media player,
when a user says "cancel," or when the user doesn't even
provide input, and more.
Some system intents also provide default prompts.
But you should change the prompts
to fit your use case when appropriate.
System intents will not cover all the functionality you want.
So you may be able to create custom intents.
Custom intents will let you extend the assistant's
natural language understanding with your own conversation
model to handle your use case.
To create custom intents, you need
to identify types of things your user could
say, and define those things as training phrases in an intent.
These training phrases generate an intent's language model.
That language model augments the assistance natural language
understanding, increasing its ability
to understand even more.
For example, earlier the action asked me a yes/no question of
"want to play the game?"
This action has two custom intents, named Yes and No.
Each intent contains their own training phrases.
When a user says something that matches those events,
you need to process them with scenes.
Scenes define the logic of your conversation and construct
prompts to respond to your users with.
By adding the custom intents to a scene,
you associate the intent matching to the scene,
allowing the scene to process Yes or No events based
on the question, "want to play the game?"
You can add intents to several scenes.
So for this example, if there was another scene
with a Yes or No option, the Yes and No intents
could be added to it.
Like for a Play Again scene, if the user loses or completes
the game, the action can have a scene
to ask the user if they want to play again.
The Play Again scene can use the same Yes and No intents.
You can also set custom intents to be
matched at any time in the conversation, not just
within the scene.
These are called global intents.
Global intents are custom intents
that can be matched at any time in the conversation.
A good use case to use this is a global Help intent for a game.
That way, when a user says "help"
at any point of the game, they'll
be matched with the global Help intent.
You'll want to be mindful of this
and only have global intents on items that are truly global.
However, your scene intents can take precedence
over global intents, letting you control
intent matching when needed.
Global intents are also eligible for invocation,
called deep link invocation.
Finally, custom intents can also use parameters.
Parameters are a way to extract particular data
from the user's input.
This functionality can be demonstrated with another
fictional action that has two styles of games--
style A and style B. If a user says, "Play A game"
or "new B game," it'll understand the intent is
the same--
to start a new game.
But that's for a particular style of game.
You can identify the game style with parameters.
Being able to understand your user
is key to making rich and unique experiences.
Intents help you translate your users' desires into action.
Check out the dots for more requirements and details.
Join our dev community on Reddit,
where you can chat with other Actions on Google
devs, and stay up to date by following us on Twitter.
I'm Jessica.
Thanks for watching.
And I can't wait to see what you build.