1

I have a parameter that is defined as a list. When I reference that parameter in the "Agent Says" box, a la the quick start guide, I get the list with brackets in the agent response text.

Fulfillment Response Text: That's a $session.params.supported_toppings pizza.

Agent Simulator Response: That's a [pepperoni] pizza.

I've been all over the documentation for CX and ES, but I can't seem to find any way to unpack the list outside of creating a webhook (which I'm trying to avoid for reasons). Any ideas?

Jessica Rodriguez
  • 2,899
  • 1
  • 12
  • 27
boristhescot
  • 129
  • 2
  • 11

2 Answers2

3

I have checked today the behavior of static responses when referencing parameters and it seems that we can now display the list of values for a certain parameter without the square brackets in the responses.

Here’s the format: $session.params.parameter-name I’ve used to display the list in the responses. The result of the test is as follows. CX agent isList

Moreover, for Dialogflow ES Edition, it is supported. It returns the list of values for a certain parameter using the format $parameter-name. Here’s an example for ES agent: ES agent isList

Riel
  • 444
  • 2
  • 5
1

Upon checking the session parameter reference, the format should be as follows: $session.params.parameter-id[i] See here for more information: https://cloud.google.com/dialogflow/cx/docs/concept/parameter#session-ref

Here’s an example test done from my end:

  1. isList Parameter enter image description here
  2. Condition for isList Parameter enter image description here
  3. Test in Dialogflow CX Simulator enter image description here

Based on the screenshots above, the format for referencing isList parameters worked.

If you have the an expected number of values for an isList parameter, you can use the static response for fulfillment: https://cloud.google.com/dialogflow/cx/docs/concept/fulfillment#static. You can add multiple responses depending on the parameters to return as seen in the examples provided.

Jessica Rodriguez
  • 2,899
  • 1
  • 12
  • 27
  • That's great, assuming you know how long your list is. However, if the list length is dynamic, your solution would require writing n responses where n is the feasible length of the list. I just want to print the entire list without the brackets regardless of length. I have a hard time believing nobody at google has considered that since ES. – boristhescot Oct 05 '20 at 17:23
  • in your answer where you provided two options list[0] or list[0] and list[1] , do you think CX should be intelligent to choose which reply to use based on the number of items in the list? I know ES used to do this when certain entities were set/not set, but I don't think that works for CX. It will just go through the response list and then keep repeating the last item. – dcsan Dec 15 '20 at 15:54