ConsoleInputChannel no longer exist

I can not find how to use my bot through the console anymore. The ConsoleInputChannel Class is no longer in rasa_core.channels.console. What is going on here?

What version are you using? https://rasa.com/docs/core/master/migrations/

I am using the latest rasa core. Why are you pointing me to the migration guide if you have not read it? It addresses nothing about the consoleInputChannel.

Also, it is broken on the rasa core documentation guide, so it has not been addressed.

Hi there. Same issue. Migration Guide is no help. I will investigate and post a solution if I find one.

It has changed, look at the run script to see how to run in the command line now: https://github.com/RasaHQ/rasa_core/blob/master/rasa_core/run.py#L260

I’ll update the Migration Guide to make note of how to run the bot on the command line

Akelad, you are amazing. Could you look at this topic as well for me?

http://forum.rasa.com/t/one-conversation-multiple-agents-and-routing/709/2

I would like to know how to implement some sort of routing between agents in the same conversation.

Thank you.

thank you!

So I know you have all already figured this out, but i will share this anyway. I have a python script which wraps common tasks like training running etc. Migrating from core 9 to core 11 caused me a small amount of work to get that going again. My custom “run” method for command line (in my script) in V9 looked like this:

def run(dbug=False):
if dbug:
    init_debug_logging()
from rasa_core.run import create_input_channel
agent = main("models/dialog",nlu_model="models/nlu/current",channel="cmdline")

agent = Agent.load("models/dialog", "models/nlu/current")
input_channel = create_input_channel("cmdline", None, None)
agent.handle_channel(input_channel)

return agent

Now (V11) it looks like this:

def run(dbug=False):
    if dbug:
        init_debug_logging()
    interpreter = NaturalLanguageInterpreter.create("models/nlu/current")
    from rasa_core.utils import EndpointConfig
    action_endpoint = EndpointConfig(url="http://localhost:5056/webhook")
    agent = Agent.load("models/dialog", interpreter=interpreter,action_endpoint=action_endpoint)
    rasa_core.run.serve_application(agent,channel='cmdline')
5 Likes

Similarly, I had code to start interactive training from my script. This broke in V11 because of ConsoleInputChannel. So my V9 Version was:

agent = Agent("domain.yml", policies=[KerasPolicy()])
stories_file = "data\stories.md"
stories_data = agent.load_data(stories_file)
output_path = "models\dialog"
if online:
    import rasa_core.run
    if nlu:
        agent.interpreter = RasaNLUInterpreter("models/nlu/current")
    else:
        agent.interpreter = RegexInterpreter()
    agent.train_online(
            stories_data,
            input_channel=ConsoleInputChannel(),
            epochs=100,
            model_path=output_path)

And my V11 Version now looks like:

from rasa_core.train import online
interpreter = NaturalLanguageInterpreter.create("models/nlu/current")
from rasa_core.utils import EndpointConfig
action_endpoint = EndpointConfig(url="http://localhost:5056/webhook")
agent = Agent.load("models/dialog", interpreter=interpreter, action_endpoint=action_endpoint)
online.serve_agent(agent)

Actually the same as the run code, but with online.serve_agent() instead of rasa_core.run.serve_application()

3 Likes

Thank you very much for this.

1 Like

Saved me a lot of time, thank you!

Hi @jloutz, I am new to Rasa chatbot and have so many questions in my mind for which I am figuring the answers. Can you help me figure out a main question in version 11. My project has to integrate our own messenger with rasa chatbot. For that I just want to make a http request to get the user request and send back the response. Is it necessary to use webhook? Basically I don’t want to use Blueprint as well we webhook. I just want to make few http request and response. Can you help me figure this out?

Regards, Nandhini

Hi there - not really something I have special knowledge about other than the rasa docs. I am sure the rasa team will be able to help. Good luck!

In this line of code -

    rasa_core.run.serve_application(agent,channel='cmdline')

I am getting this error - module ‘rasa_core’ has no attribute ‘run’

@pnandhini you can use the rest input channel: http://rasa.com/docs/core/connectors/#rest-channels

Thanks for your help, I tried your V11 code and I got this error: requests.exceptions.ConnectionError: HTTPConnectionPool(host=‘localhost’, port=5056): Max retries exceeded with url: /webhook (Caused by NewConnectionError(’<urllib3.connection.HTTPConnection object at 0x0000028538A1C9B0>: Failed to establish a new connection: [WinError 10061] Aucune connexion n’a pu ĂȘtre Ă©tablie car l’ordinateur cible l’a expressĂ©ment refusĂ©e’,))

I don’t understand what can cause this error! Can you help please?

Hi jloutz thanks for detail explaination. Is there any change again, because i am getting error below: -

online.serve_agent(agent)

AttributeError: module ‘rasa_core.training.online’ has no attribute ‘serve_agent’

Have you been able to resolve this issue. If yes can you please share code.

Yaaa. Please find it below

from future import absolute_import from future import division from future import print_function from future import unicode_literals

import logging

from rasa_core.agent import Agent from rasa_core.policies.keras_policy import KerasPolicy from rasa_core.policies.memoization import MemoizationPolicy from rasa_core.interpreter import RasaNLUInterpreter from rasa_core.train import online from rasa_core.utils import EndpointConfig

logger = logging.getLogger(name)

def run_weather_online(interpreter, domain_file=“domain.yml”, training_data_file=‘stories.md’): action_endpoint = EndpointConfig(url=“http://localhost:5055/webhook”) agent = Agent(domain_file, policies=[MemoizationPolicy(max_history=2), KerasPolicy()], interpreter=interpreter, action_endpoint=action_endpoint)

data = agent.load_data(training_data_file)
agent.train(data,
                   batch_size=50,
                   epochs=200,
                   max_training_samples=300)
online.run_online_learning(agent)
return agent

if name == ‘main’: logging.basicConfig(level=“INFO”) nlu_interpreter = RasaNLUInterpreter('app/models/nlu) run_weather_online(nlu_interpreter)