Search code examples
dialogflow-cx

Dialogflow CX: capture a parameter from an annoted training phrase


I'm building a chatbot with the Dialogflow-CX V3 console. The bot allows users, among other things, to place an order for a new project. Each project must have a name, so I define a parameter called projectName that the user must provide. I have defined a custom entity type called projectNameText, a regex. I can capture projectName in a form using a typical Q-and-A format:

 bot: What is the project name?
user: SalesPitch

But that is rather tedious. I want to allow more freeform user input and capture the projectName using an annotation on an intent training phrase.

 bot: What would you like to do?
user: I'd like to make a new project called SalesPitch

When I define a training phrase for an intent like

I'd like to make a new project called Annabel

I can highlight Annabel in the console's intent editor and annotate that as an entity of type @projectNameText as described here. But that instantly creates a parameter with Parameter id projectNameText. And I cannot edit that Parameter id. I can't require that when Dialogflow matches that training phrase and extracts an entity of type projectNameText, it puts it into the parameter projectName. Dialogflow demands that it goes into a parameter called projectNameText. When I run the simulator and type input that matches that training phrase, Dialogflow does indeed correctly extract the entity, but will only create a parameter named projectNameText - I can see the name and value in the simulator.

This answer implies that I can send the matched entity into any parameter I want. That would be sensible. But how do I do it? I can't find any way to edit the parameter name in the Intent editor. All it gives me is this: Intent editor list and I cannot change the Parameter Id.

I must be missing something really basic. Hints, please?


Solution

  • It is indeed not possible to edit the Parameter Id in the Intent Editor directly.

    Instead, in the Intent Editor from the Build tab, accept the default Parameter Id, and Save the modified intent.

    Then go to the tabs on the left of the Dialogflow CX console and choose the Manage tab. Choose Intents from the menu and find the intent you have just edited from the menu. Click the intent name to be given a different version of the Intent Editor. Same fields, same data, different functionality. In this different Intent Editor, click the Parameter Id you want to edit. It is now editable. Do not forget to hit Save after editing it.

    From start to end, that took thirteen days to find. I posted here and received no answer. I finally subscribed to Google Cloud paid support and raised a support case and was given the answer in a video call with Google India. Perhaps it should be in the Google Documentation.