Help me on deprecated code

I read a book with title " Building Chatbots with Python: Using Natural Language Processing and Machine Learning" by Sumit Raj and follow the code that written there. And then I came to an example code how to train online the conversation, but then I found out that the code is deprecated. This is the code :

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
from rasa_core import utils, train
from rasa_core.training import online
from rasa_core.interpreter import NaturalLanguageInterpreter
logger = logging.getLogger(__name__)
def train_agent(interpreter):
    return train.train_dialog_model(domain_file="horoscope_domain.yml",
    stories_file="data/stories.md", output_path="models/dialog", nlu_model_path=interpreter, 
    endpoints="endpoints.yml", max_history=2, kwargs={"batch_size": 50,"epochs": 200, 
    "max_training_samples": 300 })

if __name__ == '__main__': 
    utils.configure_colored_logging(loglevel="DEBUG") 
    nlu_model_path = "./models/nlu/default/horoscopebot" interpreter = 
    NaturalLanguageInterpreter.create(nlu_model_path) agent = train_agent(interpreter)
    online.serve_agent(agent)

then the result is “ImportError: cannot import name ‘online’ from ‘rasa_core.training’” . Please help me how the code looks like in the newest version. When i check i use rasa nlu 0.15.1 version.

Many thanks for your help.

@jeruji, read the docs of SDK actions and you’ll write your code. Hope it helps :smiley:

I already have the actions and it works well. But when it comes to train the dialog_model, the code is deprecated. Do you know how to use train_dialog_model in 0.15.1 version?

you can try this command:

python -m rasa_core.train -d domain.yml -s data/stories.md \
  -o models/current/dialogue -c config.yml 

where do I find it? That was similar question on StackOverflow, in case you want to check too.