The display name of the DialogFlow agent. Default to 'sociably-agent'
The default time zone of the DialogFlow agent. Default to 'GMT'
The constructor options of a GCP client. Omit this if you already set the GOOGLE_APPLICATION_CREDENTIALS
env. Check https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#constructor-options
The environment to be used by the module. Default to 'sociably-entry'
Set to true to prevent the package from editing DialogFlow data, i.e. you have to mangage the DialogFlow project on your own
The id of dialogflow project
The intents data for training.
If it's set to true, the default agent is used to detect intent instead under the environment.
Generated using TypeDoc
DialogFlow Module
This module implement the
IntentRecognizer
interface with DialogFlow ES API.Install
Docs
Check the Recognizing Intent document and the API references.
Setup
You can use this module in two different modes:
Delegated Mode
In this mode, the DialogFlow project is managed by the package. You maintain the training data along with the codes, and delegate the configuring procedures to the package.
First you need to create a GCP project and a service account to access the API. Follow this guide and set the
GOOGLE_APPLICATION_CREDENTIALS
environment variable when running your app.Then add
@sociably/dialogflow
module like this:Finally you have to call
DialogFlowRecognizer.train()
method every time you update the intents data. Like:It's recommended to run this every time you deploy a new version of your app. It'll not retrain if the intents data remain the same, so it's really cheap to call.
Manual Mode
In this mode, you have to manage the DialogFlow project on your own. The package only works as a client for detecting intents.
First you have to prepare a ready-to-use DialogFlow agent. You can follow this guide to create one and add the intents in the DialogFlow console.
Next follow this section to create a service account and set the
GOOGLE_APPLICATION_CREDENTIALS
environment variable.Then add
@sociably/dialogflow
module like this:If you call
DialogFlowRecognizer.train()
method under manual mode, it creates a snapshot version on the environment. You can do it every time you deploy a new version of app, so the DialogFlow agent would have a revertible version along with the version of app.