How to use DialogFlow or Lex as the NLU for the Web Platform

dialogflow

#1

I’ve been looking for documentation or a tutorial on how to use Dialogflow (jovo-nlu-dialogflow) or Lex (jovo-slu-lex) for the Web Platform —this is in place of NLP.js. I’ve not been able to find relevant content on this.
For example, I’d like to understand if I should still use “jovo build” and “jovo deploy” to generate and upload the voice model to DialogFlow/Lex, or if I have to do some manual steps here.


#2

Hi @Miguelangel_Fernande!

We don’t have a tutorial for those services, but we plan better documentation for v4, which is just around the corner.

The v4 CLI will also include the ability to build and deploy to those platforms. The v3 CLI does not yet. For that, you need to take manual steps to create the language model on Lex. For Dialogflow, you can use the dialogflowAgent files created for googleAssistant: https://www.jovo.tech/tutorials/deploy-dialogflow-agent

For Lex, it might be helpful to use this package: https://www.jovo.tech/marketplace/jovo-model


#3

Thank you @jan. I’ll look into this.


#4

Hi @jan. I’ve been looking into using DialogFlow as you mentioned, but my project already targets Google Assistant via Actions on Google. It seems I can’t set up the same project to build for Actions on Google and Dialogflow, or can I?


#5

That might be correct, but it shouldn’t be a problem to run Dialogflow in a different project


#6

Well… yes, I can script copying everything over to another project just for building Dialogflow, but I would argue this is not ideal.

It would be nice if we could just have all platforms coexist in the same project. I’ve found that if I just comment out googleAction for Actions on Google in project.js and add it again with nlu: 'dialogflow' and build, I can get both models generated in the same project. Maybe the quick fix would be to make the Jovo CLI slightly more flexible to allow building both.

EDIT: To be clear, in my case at least, I’m trying to cover web using DialogFlow, Alexa and Google Assistant with Actions on Google, so ideally I’d like to be able to build all three models in the same project —e.g.:

platforms/
├── alexaSkill
├── googleAction
└── web
    └── dialogFlow

#7

Hi @jan. Circling back on this, is there any way I can have more than one project.js file? I’m thinking I could use one for Alexa and Google Assistant, and another for the Dialogflow NLU.


#8

It sounds like we have similar needs and an app configuration as you. We found the simplest solution is to utilize jovo-cli's environment/stage option so that you can build for google actions with jovo build --stage build_gactions or build for dialogflow with jovo build --stage build_df + similar for deploying.

project.js file:

module.exports = {
  // overwritten using stage values
  googleAction: {
    projectId: 'google-project-id',
  },

  endpoint: '${JOVO_WEBHOOK_URL}',

  // env examples: https://www.jovo.tech/tutorials/staging-examples
  // ex1: "jovo build --stage build_gactions"
  // ex2: "jovo deploy --stage build_df"
  stages: {
    // "actions on google"
    build_gactions: {
      googleAction: {
        projectId: 'google-project-id',
      },
    },
    // for dialogflow nlu to work:
    build_df: {
      googleAction: {
        nlu: 'dialogflow',
        dialogflow: {
          projectId: 'google-project-id',
          keyFile: './src/keys/creds.json'
        },
      },
    },
  }

};

#9

Thank you @spencer. This idea is brilliant! :slight_smile: