Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The following steps will help you get a keyfile, project ID and select a language:

  1. Create a Dialogflow agent by clicking the following link: https://dialogflow.cloud.google.com/

  2. Use the ‘Create Agent' button at the left top to start your first project. Press the settings icon next to your agent's name at the left top to see the Project ID.

  3. Follow the steps here to retrieve your private key file in JSON format. If you don’t have a service account, you can create one by pressing the “Create Service Account” button in the upper part of the screen.

    • Note: the JSON file can be changed in the application at runtime using the BasicSICConnector's set_dialogflow_key(<path to keyfile>) method

  4. Choose a language for the agent from https://cloud.google.com/dialogflow/es/docs/reference/language

    • Note: the language can be changed in the application at runtime using the BasicSICConnector's set_dialogflow_voice(<voice ID>) method

Output

  • sensors: none

  • actuators: none

...

In order to run this service, the following steps must be taken into consideration:

  1. You have the relevant services and drivers running.

  2. To pass your local IP address, Dialogflow key file path, and Dialogflow agent ID, when creating an instance of BasicSIC connector.

  3. A partial function is set up for retrieving a recognized entity from the detection result.

Example

The following file, https://bitbucket.org/socialroboticshub/connectorsexamples/src/mastermain/python/3_speech_recognition_example.py , is available for the purpose of demonstration. Two questions are dealt with in this example. The first is an entity question where the point of interest is the name of the user. The second is a yes, no, or don’t know question.

...

In order to deal with the first question, an intent needs to be set up. An intent is a value recognised from an end-user. In our example, the name of the person. The following steps will set an intent of your Dialogflow agent:

  1. Navigate to the agent’s page to set the intent, training phrases and parameters.

  2. Create an agent intent.

    • It is recommended that the name suggests the kind of answer you are looking for in the audio. In our example, the name of the user (‘answer_name’).

    • the intent defined in the agent should correspond to the intent used in the code

  3. Create a context.

    • the number next to the context corresponds to the number of responses expected from the user in that context. In our example, that number is 0

  4. Create training phrases for the intent

    • the training phrases should be input examples that contain the intent. In our example, 'my name is name`

    • Dialogflow learns from these phrases and matches future user inputs based on them

  5. Create parameters for the intent

    • select words from the training phrases as parameters by double-clicking on them, then match them with their corresponding entity. They automatically appear in the ‘Action and parameters’ section. In our example, we are only interested in the ‘name’ of the user

Our complete intent example thus looks like this (note: using sys.given-name is usually preferred):

...