Table of Contents | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Dialogflow
Tip |
---|
Before you start: make sure your MARBEL agent is connected to Dialogflow. |
...
Tip |
---|
Check that your greeting intent is working by using the microphone button in the test console on the DIalogflow console page. Try various phrases also using the test console and check whether what you say is recognized as a greeting intent. |
Prolog and Patterns
Greeting pattern without self-
...
identification
We shall start by considering how a typical greeting pattern looks like. When the agent does not introduce itself, a very common greeting pattern could like look this:
...
We will use the predicate text(Intent, Text)
for specifying how the agent will greet a user. The first argument Intent
of the text/2
predicate should be instantiated with an intent label in a dialog move of the agent, and the second argument Text
should be a string with the text you want your agent to say. For the greeting
intent we thus need to specify at least one phrase by adding a text(greeting, "YOURPHRASEHEREYOUR PHRASE HERE")
fact to the responses.pl
file. Now add such a text/2
fact for the intent label greeting
under the % Intent: greeting
comment.
...
Warning |
---|
To test and hear something, you still need to do one more thing: In the You can now Running Run your Conversational Agent again to hear your agent say its first opening words. Note that unless the corresponding |
Greeting with self-identification
You and your team should think of a name for your agent. Feel free to be creative. We need to tell our agent its name somewhere. In dialog_init.mod2g
, on line 40 you can add the name you came up with for your agent. Change the empty string in insert(agentName('')
, for example, to insert(agentName('Bellabot')
. Now your agent has a
...
name, we would also like the agent to self-identify and be able to use the following greeting pattern:
Pattern C1.1: Opening Self-Identification (Agent)
Example:
A: Hello.
A: I'm My name is _____*.
U: Hi!
* insert your agent’s name here
This pattern will be is quite similar to the one C1.0 pattern above, but should include consists of one more dialog move made by the agent. The second dialog move that is new in the C1.1 pattern we call a self-identification move. We suggest that you use the intent label 'selfIdentification
'. Add a list [_,_]
predicate in the pattern list above for the new rule that tells the agent to self-identify. Also, note that the agent must have a name in order to self-identify for this agent move. Although Moore’s classification has it that this pattern is a c11
, the difference with the c10 pattern is small and can be handled easier by our dialog manager agent if we use the same c10
label again for this only slightly different pattern. You should now be able to add another c10
pattern to the patterns.pl file which adds the self-identification move of the agent as an additional actor-intent pair. Of course, for this pattern to be selected, we should add the condition (as we did before above but now) that the agent has a name: not(agentName(''))
.
Specifying the agent’s self-
...
You and your team should think of a name for your agent. Feel free to be creative. We need to tell our agent its name somewhere. In dialog_init.mod2g
, on line 40 you can add the name you came up with for your agent. Change the empty string in insert(agentName('')
, for example, to insert(agentName('Bellabot')
.
Next, we need to build the rule for selfIdentification.
The head of the rule should be as follows: text(selfIdentification, Txt) :-
...
identification
We still need to specify at least one phrase for the agent’s selfIdentification
intent. We can do this by simply copying the agent’s name we inserted in dialog_init.mod2g
but a more generic approach is to use the agentName(Name)
query to retrieve this name from the agent’s database. This approach will also show you how you can use facts stored in the agent’s database to create text responses for an intent. The basic idea is to introduce a rule defining text(selfIdentification, Txt)
instead of a simple text(selfIdentification, "SOME PHRASE")
fact. For the body of this Prolog rule, you need to specify a query that concatenates two strings: A string such as “My name is” and a string of the agent’s name. To specify this query, the string_concat/3
predicate will be useful. Add the rule under the comment % Intent: self-identification
in the responses.pl
This rule should produce a response that is returned as Txt and should include the agent's name.
Once you have defined your agent you can utilize the predicate that you inserted into its memory.
You should then return a sentence including the agent’s name as Txt file.
Warning |
---|
When you have added a name for your agent, and the new pattern and rule for generating a self-identifying phrase, you can now Run your Conversational Agent again to hear your agent self-identify itself. |
Visuals
Opening Page (visuals for the c10 pattern)
...