0

My code is given below:

async def train_dialogue(domain_file='domain.yml',
                   model_path='models/dialogue',
                         config_file='config.yml',
                   training_data_file='./data/stories/stories.md'):

    policies = policy_config.load(config_file)
    agent = Agent("domain.yml", policies=policies)

    #asyncio.run(agent.load_data(training_data_file))
    #training_data = await agent.load_data(training_data_file)
    #training_data = asyncio.run(agent.load_data(training_data_file))
    #training_data = agent.load_data(training_data_file)

    loop = asyncio.get_event_loop()
    data = loop.run_until_complete(agent.load_data(training_data_file))


    agent.train(training_data)

    agent.persist(model_path)
    return agent

def run_weather_bot(serve_forever=True):
    interpreter = Interpreter.load('./models/nlu/default/chat')
    agent = Agent.load('./models/dialogue', interpreter=interpreter)
    rasa.core.run.serve_application(agent, channel='cmdline')

    return agent

train_dialogue('domain.yml','models/dialogue','config.yml','./data/stories/stories.md')
run_weather_bot()

When I execute this above piece of code to train the rasa core model for the chatbot I am getting the following error:

RuntimeWarning: coroutine 'train_dialogue' was never awaited
  """Entry point for launching an IPython kernel.

I have tried these lines as well after looking at some solutions ftom the web but these are also not resolving he issue:

#asyncio.run(agent.load_data(training_data_file))
#training_data = await agent.load_data(training_data_file)
#training_data = asyncio.run(agent.load_data(training_data_file))
#training_data = agent.load_data(training_data_file)

Also, when I load my model like this:

agent = Agent.load("models/dialogue", interpreter= rasaNLU)

I am getting "no core or NLU model found at models/dialogue", so I believe that the function train_dialogue is not executing properly that's why the model is not being persisted. Any help will be much appreciated!

Asim
  • 1,430
  • 1
  • 22
  • 43

1 Answers1

0

/model/parse is an endpoint to which you can only POST your message. The error you are getting is expected behavior.

You can check out the HTTP API docs here - https://rasa.com/docs/rasa/api/http-api/#operation/parseModelMessage.

msamogh
  • 147
  • 8