Hi there,
I encounter a problem while running my Python script, which should allow me to chat with the chatbot in a console. I have already heard that ConsoleInputChanel no longer exists. Still, I can’t get any further.
Dialogue_Management_Model.py:
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 interactive
from rasa_core.utils import EndpointConfig
logger = logging.getLogger(__name__)
def train_dialogue(domain_file = 'my_domain.yml', model_path = './models/dialogue', training_data_file = './data/stories.md'):
agent = Agent(domain_file, policies = [MemoizationPolicy(), KerasPolicy(max_history=3, epochs=300, batch_size=50)])
data = agent.load_data(training_data_file)
agent.train(data)
agent.persist(model_path)
return agent
def run_lisa_online(serve_forever=True):
interpreter = RasaNLUInterpreter('./models/nlu/default/mynlu')
action_endpoint = EndpointConfig(url="http://localhost:5055/webhook")
agent = Agent.load('./models/dialogue', interpreter=interpreter, action_endpoint=action_endpoint)
#online.serve_agent(agent)
#online.serve_agent(agent, channel='cmdline')
#agent.handle_channel(ConsoleInputChannel())
rasa_core.run.serve_application(agent ,channel='cmdline')
return agent
if __name__ == '__main__':
logging.basicConfig(level="INFO")
nlu_interpreter = RasaNLUInterpreter('./models/nlu/default/mynlu')
run_lisa_online(nlu_interpreter)
I get the following error message:
import warnings
warnings.simplefilter('ignore', ruamel.yaml.error.UnsafeLoaderWarning)
In most other cases you should consider using 'safe_load(stream)'
data = yaml.load(stream)
2019-02-10 12:00:07.038084: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
Traceback (most recent call last):
File "dialogue_management_model.py", line 40, in <module>
run_lisa_online(nlu_interpreter)
File "dialogue_management_model.py", line 33, in run_lisa_online
rasa_core.run.serve_application(agent ,channel='cmdline')
NameError: name 'rasa_core' is not defined
Which import is missing here? I would be so grateful for your suggestions and solutions. Here are the versions I use:
(base) dejan@rasa:~/chatbot$ pip list | grep rasa
rasa-core 0.12.3
rasa-core-sdk 0.12.1
rasa-nlu 0.13.8
Thank you very much.
