Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
minLevel1
maxLevel2
outlinefalse
typelist
printablefalse

...

info
Tip

Before you start: make sure your MARBEL agent is connected to your Dialogflow agent and you completed the Getting [TBU]Your Conversational MARBEL Agent Up and Running step.

Read more about creating intents and entities before you start on the 2025 Dialogflow: Creating Intents and Entities page.

Creating a greeting intent

You will need to create intents for your Dialogflow agent. The first intent we want to create is a greeting intent. When you inspect your Dialogflow agent’s intents, you will see there already is an intent called Default Welcome Intent. As we want you to create your own greeting (or welcoming) intent for your agent, you should remove this intent first. Before you do so, you can still check out the Training Phrases for this intent which you could reuse for creating your own greeting intent.

  • Delete the Default Welcome Intent in your Dialogflow agent.

  • Create a new intent called greeting.

  • Add Training Phrases: Add several expressions (at least 10) as examples of how a user might greet your agent. Be thorough and try to cover as many phrases as you can come up with. For inspiration, you can do a Google search for greeting phrases. You may find, for example, useful phrases here: 20 Greetings in English. You can also ask ChatGPT to generate example phrases.

  • Under Action and parameters make sure the box above the table is filled in with the name of your intent as shown in the image below.

...

Note

Don’t forget to press SAVE!

Warning

Test 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

...

Warning

To test and hear something, you still need to do one more thing: In the dialog_init.mod2g file, add the c10 pattern name also to the agenda of the agent after start that is already in it (separate them by a comma, the agenda is a list!).

You can now 2025 Run your Conversational Agent again to hear your agent say its first opening words.

Note that unless the corresponding c10 pattern and the textual response have also been added to the pattern.pl and responses.pl file, your code will not yet work. Also, make sure you have not already added a name for your agent; the basic greeting pattern c10 assumes that the agent has no name yet!

Finally, you will not yet be able to respond with a greeting yourself without a welcoming page (see Visuals section below). This page should display a microphone icon that you will need to start talking back to the agent.

...

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 2025 Run your Conversational Agent again to hear your agent self-identify itself.

Visuals

Welcoming page

When a user has visited the Start page and clicked on the Start button, your agent should start by greeting its user. But we would also like to show a webpage that welcomes the user and is shown while the greeting pattern c10 is active and ongoing. Additionally, the new page provides the user with the ability to start talking by clicking on the microphone icon.As before, we need to introduce a rule for generating a webpage. The head of this rule should be page(c10, _, Html). We advise you to reuse the same overall structure for the Prolog rule as for the Start page you created in the html.pl file. Add your rule for the welcoming page also to the html.pl file.

The main requirement for this page is that it shows a microphone icon that the user can use to start talking to the agent. All you need to do for this is to create a page with a header. A second requirement is that your page should not have a button for moving on to the next page! Progress should be made by talking from now on! Ideas for this page could be to show a greeting and introduce your agent by showing its name. Next, we provide some suggestions on how you could proceed with creating the welcoming page for your agent:

  1.  As a start, consider the condition that needs to succeed when this page is generated. Hint: look at the rule for the Start page and check out how the first argument of the page/3 head of this rule is reused for defining the condition for showing the page.

  2. Think about the design of your welcoming page. What should the page look like? You can show text that introduces your agent somewhere, using the agentName(Name) fact to retrieve its name, for example (if you do, also take into account what should happen if the agent has no name!). You can use https://www.w3schools.com/bootstrap4/bootstrap_jumbotron.asp, https://www.w3schools.com/bootstrap4/bootstrap_alerts.asp, or other Bootstrap components to display the text. You can add other visual elements using images, or add more advanced layouts for your page. Check out the 2025 Visual Support Guide for more on how to use these components.

  3. As before, try to organize the structure of your page into several segments or rows and organize the code for generating HTML in your rule to reflect this same structure. Then piece together the various parts of the page as you have seen before (if you have more than one part) and, finally, as a last step, use the html/4 predicate to generate the content for the body of your HTML webpage.

Whether you followed our suggestions above or not, make sure your welcoming page looks inviting!

See Visual Requirements for more information.

Run It!

Make sure you have added the c10 pattern to the agent’s agenda in the dialog_init.mod2g file.

...

Check whether your Dialogflow agent understood what you said and classified what you said as a greeting intent by inspecting the terminal in which you launched the SIC server:ran run-dialogflow.

...

Also, pause the MARBEL agent and inspect the session/1 fact. You see that the greeting pattern has been completed and a new empty sequence has been added at the head of the session history (list).

...

Terminate the MARBEL agent and restart it in Debug mode again. Repeat the interaction but this time, when it is your turn to speak, say something that is not remotely close to a greeting instead. Check out the terminal again to see how Dialogflow classified what you said. Pause the MARBEL agent and again inspect the session/1 fact. What is different, and what is the same? To understand what happened, check out the Session updating part at the top of the dialog_update.mod2g file.

Check out Dialogflow’s Traning Tool

Throughout the development of your agent, it will be useful to (re)visit the Training tool of your Dialogflow agent: https://cloud.google.com/dialogflow/es/docs/training. Simply click Training in the left sidebar menu:

...

Click on some of the conversation phrases that you see listed in the Training view and inspect what intent (if any) the phrase was assigned to.

During the project, try to follow these Training  |  Dialogflow ES  |  Google Cloud | Best practices.

Info

...

Done?

...

Proceed with

...

Request

...

a

...

Recommendation.