I am trying to integrate rasa core and nlu. NLU is able to predict the correct intent, but rasa core does not execute correct action. can anyone help me with this? I have tried hard but still unable to figure out, what’s going wrong. My code files are given below:
This is my
## greeting * greet - utter_greet ## sad path 1 * mood_unhappy - utter_cheer_up ## say goodbye * bye - utter_goodbye
This is my
intents: - greet - bye - mood_great - mood_unhappy actions: - utter_greet - utter_cheer_up - utter_goodbye templates: utter_greet: - "Hello, how are you dude?" utter_cheer_up: - "Dont worry mate!!" utter_goodbye: - "Bye Bye"
This is my
## intent:greet - hey - hello - hi - good morning - good evening - hey there ## intent:bye - bye - goodbye - see you around - see you later ## intent:mood_great - perfect - very good - great - amazing - wonderful - I am feeling very good - I am great - I'm good ## intent:mood_unhappy - sad - very sad - unhappy - bad - very bad - awful - terrible - not very good - extremly sad - so sad
This is my python code:
class rasaCore: def __init__(self, domain_path, model_path, stories_path): self.domain_path = domain_path self.model_path = model_path self.train_data_path = stories_path self.interpreter = RasaNLUInterpreter("./nluModels/default/rasa_nlu_model/") def trainCoreModel(self): agent = Agent(self.domain_path, policies = [MemoizationPolicy(), KerasPolicy()], interpreter=self.interpreter) data = agent.load_data(self.train_data_path) agent.train(data, augmentation_factor = 50, epochs = 50, batch_size = 10, validation_split = 0.2) agent.persist(self.model_path) def generateIntentAndEntity(self, message): parsed_nlu_msg = self.interpreter.parse(message) print(json.dumps(parsed_nlu_msg, indent=2)) def talkWithBot(self, message): self.generateIntentAndEntity(message) agent = Agent.load(self.model_path) print ("\n ============================= Core response ============================= \n") print (agent.handle_text(message)) # call rasa nlu training_data = "nlu.md" conf_path = "nlu_config.yml" train = trainModel(training_data, conf_path) # #start training train.startTraining() # core print ("training rasa core started \n") core = rasaCore("./domain.yml","./coreModels/dialogue","./stories.md") core.trainCoreModel() print ("training rasa core completed \n")
Even intent predicted by nlu is
greet, but core gives response with other action or any empty list.
Could anyone please point out what i am doing wrong?
Thanks very much