Interactive learning - interactive.py

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:

from rasa_core.training import interactive

agent = Agent.load(path=agent_path, interpreter=interpreter, action_endpoint=endpoint) interactive.run_interactive_learning(agent=agent, serve_forever=True)

I get the following error:

usage: app.py [-h] -d CORE [-u NLU] [-p PORT] [–auth_token AUTH_TOKEN] [–cors [CORS [CORS …]]] [-o LOG_FILE] [–credentials CREDENTIALS] [–endpoints ENDPOINTS] [-c CONNECTOR] [–enable_api] [–jwt_secret JWT_SECRET] [–jwt_method JWT_METHOD] [-v] [-vv] [–quiet] app.py: error: the following arguments are required: -d/–core

If i run the same command from a python console - not a python file- i get the following:

prompt_toolkit.terminal.win32_output.NoConsoleScreenBufferError: No Windows console found. Are you running cmd.exe?

Am i doing anything wrong?

that error tells you what you need to do: error: the following arguments are required: -d/–core

As for the python console, that’s a windows related error, i guess you need to run it from cmd.exe

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

Thanks!

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.

@Sam can you able to send messages through the channels instead of command line? This is also what i want.Want little help on this topic

Hi,

Have you tried to implement interactive learning through channel