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.
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.
Once you've created an agent follow the instructions here to generate an API key.
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.
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.
We can now create an interpreter in OpenDialog that will connect to that Dialogflow agent.
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.
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.
The last step is to activate our interpreter so that we can use it from within Scenarios.
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".
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.
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.
A quick try in our WebChat widget shows that our intent is being interpreter successfully by Dialogflow and providing a response.