Bindings to use DialogFlow as the NLU implementation for detecting conversation intents.
The artifacts are available on Maven Central
<dependency>
<groupId>com.conversationkit</groupId>
<artifactId>nlu-dialogflow</artifactId>
<version>2.0.0</version>
</dependency>
To use DialogFlow you will to set up an account and download the JSON file that contains the private access key. You can then include the JSON file with your project and load the credentials.
try (InputStream input = DialogFlowIntentDetectorIT.class.getResourceAsStream("/credentials.json")) {
String projectId = "YOUR_DIALOG_FLOW_PROJECT_ID"
GoogleCredentials credentials = GoogleCredentials.fromStream(input)
.createScoped(Lists.newArrayList("https://www.googleapis.com/auth/cloud-platform"));
DialogFlowIntentDetector instance = new DialogFlowIntentDetector(credentials, projectId);
} catch (IOException ex) {
...
}
To run the integration tests you will need to have an configured agent with DialogFlow and API access credentials as a JSON file.
Update the integration-test.properties
to match your project id and the name
of the file containing the credentials.
projectId=conversation-kit-test-agent-gs
credentialsFile=/dialogflow-it.json
Then run
mvn integration-test