I have added the from rasa.core.utils import EndpointConfig and getting the following error. ImportError: cannot import name ‘EndpointConfig’
Also I have written following code for dialogue_management_model.py and this is also not working:
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 import rasa.core.run #from rasa.core.train import online import asyncio from rasa.core.featurizers import (MaxHistoryTrackerFeaturizer, BinarySingleStateFeaturizer) from rasa.core.utils import EndpointConfig
logger = logging.getLogger(name)
def train_dialogue(domain_file = ‘restaurant_domain.yml’, model_path = ‘./models/dialogue’, training_data_file = ‘./data/stories.md’):
featurizer = MaxHistoryTrackerFeaturizer(BinarySingleStateFeaturizer(), max_history=5)
#agent = Agent(domain_file, policies = [MemoizationPolicy(max_history = 5), KerasPolicy(featurizer)])
agent = Agent(domain_file, policies = [MemoizationPolicy(max_history = 5), KerasPolicy(featurizer,epochs = 500,batch_size = 30)])
#loop = asyncio.get_event_loop()
data = asyncio.run(agent.load_data(training_data_file))
agent.train(
data)
#max_history = 3,
#epochs = 300,
#batch_size = 50,
#validation_split = 0.2,
#augmentation_factor = 50)
agent.persist(model_path)
return agent
def run_restaurant_bot(serve_forever=True): interpreter = RasaNLUInterpreter(’./models/nlu/restaurantnlu’) #interpreter = NaturalLanguageInterpreter.create(’./models/nlu/restaurantnlu’)
#from rasa.core.utils import EndpointConfig
action_endpoint = EndpointConfig(url="http://localhost:5056/webhook")
agent = Agent.load('./models/dialogue', interpreter = interpreter,action_endpoint=action_endpoint)
rasa.core.run.serve_application(agent,channel='cmdline')
return agent
if name == ‘main’: train_dialogue() run_restaurant_bot()
Please help in resolving the issue.