marcoka
(Marco)
September 18, 2018, 4:38pm
1
Hello there,
at the moment I’m starting to learn how to create dialogues with Rasa Core and one thing I couldn’t find in the documentation or anywhere else is how to define multiple agents answers.
I don’t mean variations, I want to present answers in multiple speech bubbles to present the content in smaller bits.
Does anyone have an idea for that?
Best from Berlin,
Marco
You can do something like,
In stories.md file,
Story: smalltalk.greetings.hello
smalltalk.greetings.hello
utter_greetings.hello # Message : Hello
utter_greetings.help # Message : How can I help you today?
In your custom action file,
def run (...)
dispatcher.utter_message(response_1)
dispatcher.utter_message(response_2)
return [...]
marcoka
(Marco)
September 21, 2018, 7:52am
3
oh cool, thanks for the fast answer.
I’ll try that later
smn-snkl
(Simon)
September 26, 2018, 8:33am
4
You can also combine utterances of different types such as:
utter_greetings.hello
action_custom_action
However, these messages will be pushed to the channel within miliseconds. So I tend to add some wait times. E.g. you could do this:
utter_greetings.hello
action_sleep
action_custom_action
With action_sleep looking something like:
class ActionSleep(Action):
def name(self):
# type: () -> Text
return "action_sleep"
def run(self, dispatcher, tracker, domain):
# type: (Dispatcher, DialogueStateTracker, Domain) -> List[Event]
time.sleep(3)
return []
Not sure if there’s a better way though to make the bot pause in between multiple messages.
basque21
(Basque21)
March 22, 2019, 10:57am
5
Hi, I’m receiving in the debug two answers from the Bot, but I don’t know how can I print both of them, because I’m getting only the first:
DEBUG:rasa_core.processor:Predicted next action 'utter_siniestro_auto' with prob 0.81.
DEBUG:rasa_core.processor:Action 'utter_siniestro_auto' ended with events '[]'
DEBUG:rasa_core.processor:Bot utterance 'BotUttered(text: le pasamos con siniestro de automóvil, data: {
"elements": null,
"buttons": null,
"attachment": null
})'
DEBUG:rasa_core.policies.ensemble:Predicted next action using policy_0_KerasPolicy
DEBUG:rasa_core.processor:Predicted next action 'utter_init' with prob 0.94.
DEBUG:rasa_core.processor:Action 'utter_init' ended with events '[]'
DEBUG:rasa_core.processor:Bot utterance 'BotUttered(text: bienvenido a seguros, qué desea?, data: {
"elements": null,
"buttons": null,
"attachment": null
})'
but then when I do:
body = json.dumps({ "message": sentence, "uuid": "{}".format(user_id) })
r = requests.post("http://localhost:5002/webhooks/botHttpServer/chat/Robbie/{}/ask".format(user_id), data=body)
answer = json.loads(r.text)['response']
slots = json.loads(r.text)
print(answer)
I only get the first answer. Any help?
thanks
Hi @kothiyayogesh ,
to have a sequence of multiple answers, i just tested that’s sufficient to have a story that reply to an intent with a sequence of utterances, as you showed in your example.
But, apparently there is need to have a custom action. I’m wrong?
BTW, because this thread is old, there is better solution in RASA now?
Thanks
giorgio