I’m trying to connect the interactive learning to http rest. meanwhile I’ve come across the file ‘interactive.py’, found in the master version
If I run the following command:
I do understand the source of the errors. Anyway, the problem is that I am trying to connect slack with the bot through interactive learning - I looked at the interactive.py code and all the endpoints that i need to communicate with the bot for interactive learning are there.
But what i need now is a communication between slack and these endpoints.
For example, user sends message -> perform appropriate endpoint request
endpoint receives a response -> display appropriate text based on the response received
How can this be done? any simple guidelines?
I’m not sure if I understand correctly, but I’m assuming you just want to use interactive training through Slack instead of the command line, is that correct?
If that’s the case, I think the issue is that when you call the interactive.run_interactive_learning, the agent has no registered channels. There’s no native way of doing this I believe, so you’d need to modify / implement your own solution. What you’d need to do is create your own interactive_training file and write your own ‘_serve_application’ function that modifies that line:
_start_interactive_learning_io(endpoint,http_server.stop,finetune=finetune)
Instead, you’d probably need something like this line found in the start_server function in the run.py:
rasa_core.channels.channel.register(input_channels,app,initial_agent.handle_message,route="/webhooks/")
Not sure if this would work out-of-the-box though. There might be other issues popping up as you’d try this approach.
Thanks, that’s exactly what i need, to use slack instead of command line!
i’ll try the approach you mentioned, but if you look at lines where the function prompt is called
e.g. line 233
answers = prompt(questions)
As far as i can tell, this function outputs text to the command line but instead I’ll need to output the answers back to slack
Is there a simple way of doing so assuming i manage to register a slack channel with the call u provided
You’re right, that’s what I thought. Would have been too easy. I guess in that case you’d need to completely rewrite the interactive training yourself and send messages through the channels instead of command line. But that’s quite an effort. Especially because some features like selecting the correct intent using up and down arrow keys won’t be possible on Slack. So you’d need to rewrite a lot of these cases as well.