Can we pass array data to dispatcher? - Getting Started with Rasa / Tutorials, Resources & Videos - Rasa Community Forum

👋 Introducing the Rasa Playground

Can we pass array data to dispatcher?

post by vishwanathks on Sep 2, 2019

i will get the latest data using this–> input = tracker.latest_message.get(‘text’)

I have an array of data, I need to pass this array data as a bot response. how can I do that? I tried Bot is not responding how can we pass the same array output to bot response using dispatcher ? is there any way i can do this ?

example: patterns = [‘ape’, ‘apple’, ‘peach’, ‘puppy’], input=‘appel’ --> from the latest data from the user. i’m using difflib module to find similar data in the array we get the output as an array as below Output : [‘apple’, ‘ape’] if i use print the output is printed on the console, not as a bot response

please someone help me how can i work on this ?

post by piyush29programmer on Sep 2, 2019

Can you tell me the exact response you wanted to be shown on bot UI? If input => appel then output => apple ape (as a single string) ?

post by vishwanathks on Sep 2, 2019

As an array (apple,ape) two values

post by IgNoRaNt23 on Sep 3, 2019

You can define a template like this in your domain

utter_output:
  - text: Return output this way {output}

Now in your custom action you call the dispatcher via

dispatcher.utter_template('utter_output', tracker, output=<whatever you want>)

with your desired output