Dialogflow Interpreter

The OpenDialog Dialogflow integration allows us to use Dialogflow intent interpretation, entity extraction and the Dialogflow knowledge bases. This means that you can use one or more Dialogflow agents as your NLU interpreters and do all the conversation design in OpenDialog.

Create a Dialogflow ES agent

The first step to using Dialogflow is to create an ES Dialogflow agent. We are using Dialogflow as just an NLU service so we will be focussing on just training intents, extracting entities and (if and when required) setting up knowledge bases.

Create an API access key in the Google cloud console

Once you've created an agent follow the instructions here to generate an API key.

  1. Go to the settings of you Dialogflow agent and click on the project link to go to the Google Cloud project console

2. From within the Google Cloud console project go to the IAM & Admin > Service Accounts.

3. Create a service account and give it the Dialogflow API Admin role. You will need to give it an ID and then grant the Role as shown below.

Creating an service user for the Dialogflow API through the Google Cloud Console

4. Click on the account just created, head to the Keys tab and create a JSON key which will generate a file and download it to your machine.

Generating a JSON key for Dialogflow API access

Create a Dialogflow Interpreter in OpenDialog

We can now create an interpreter in OpenDialog that will connect to that Dialogflow agent.

OpenDialog Interpreter Manager
Dialogflow Interpreter Configuration

Once you've filled in the details you will be able to run a connectivity test to ensure that the API key is working correctly.

With a success message in place you are ready to start using intents in your conversation design.

Mapping Intents

The Dialogflow management screen allows us to map Intents and/or Entities between OpenDialog and Dialogflow. What this means is that you can say things such as the intent calls "Example Intent" in OpenDialog should be compared with the intent called "Another Intent" in Dialogflow.

This makes it simpler to reuse preexisting intents or entities without having to rename things.

Activate the interpreter

The last step is to activate our interpreter so that we can use it from within Scenarios.

Dialogflow example

Ok - let's try out our new NLU interpreter!

We will create two intents in Dialogflow. One for "I need help" and one for "I have a question".

Intents in Dialogflow

The intents just have some example phrases associated with them and nothing else. We will handle the rest from within OpenDialog.

We will create a new scenario and add two open turns, each turn handling one of the intents.

Welcome scene for Dialogflow example
Configuring an intent to use our DF Interpreter

The request intent from the user is set to use the Interpreter that we just created and we've set the confidence level to 60%.

The message is attached to the response intent.

Response to help request intent

A quick try in our WebChat widget shows that our intent is being interpreter successfully by Dialogflow and providing a response.