Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Dialogflow

Tip

Before you start: make sure your MARBEL agent is connected to Dialogflow:

Read about How to Make Intents and Entities:

DialogFlow: Create an Agent, Intents and Entities

Note

Make sure the labels (names of intents and entities) you use in your MARBEL agent code are exactly the same as the intents and entity entry names that you have specified in your Dialogflow agent! Small spelling mistakes (e.g., using capitals or not, other misspellings) will cause issues later on! We advise to use Camel case starting with a lowercase letter everywhere (except for the Training phrases that you add).

...

Tip

Check that your ‘greeting’ intent is working by using the microphone button in the test console inside DIalogflow.

Prolog and Patterns

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. If you look at dialog_init.mod2g you can find on line 40 a place to define the name of your agent in a string → insert(agentName('Bellabot').

...

You should then return a sentence including the agent’s name as Txt.

Visuals

Opening Page (visuals for the c10 pattern)

...

  1.  Consider the condition that needs to succeed when you generate this page (Hint: look at the start page rule body and how the first parameter of the page/3 predicate is used in that rule).

  2. Think about what you want to be on this page. It needs somewhere to show text to introduce your agent. For this, you can use a card or an alert, for example. This will be the first atom in your HTML code that we use in Step 3. The second atom should be HTML code with text(formatted) to introduce your agent, i.e. what you want to go on your alert or card. In Step 5 we need to format the HTML code by formating the Prolog string with ‘applyTemplate’. This means that in this second atom there should be a placeholder for the variable with the name of the agent. Read the Visual Support: A Guide for hints on how to do that.

  3. Use a predicate to combine the first atom and second atom you created in the previous step (check out the Visuals Guide for how to do this). What we created in HTML above is our template, and the predicate should return the variable Template.

  4. Now we need to get the agent's name in order to add it to our text. This knowledge should be somewhere in the agent's memory. Hint: Look at line 40 in dialog_init for the applicable predicate. Retrieve the name of the agent in a variable.

  5. Next, you should use the applyTemplate/3 predicate to add the agent’s name to our HTML code atom (which is also explained in the Visual Support Guide).

  6. Lastly, you should use the last variable that you used in the applyTemplate/3 predicate and use the html/2 predicate to convert your code snippet into a completed HTML page. This can be done by using html(YourCompleteHTMLCodeVariableHere, Html). Html is the variable that returns the page as you can see in the head of the rule.

...