async def get_domain(self) -> Domain: domain = await super().get_domain() self.chitchat_domain = Domain.from_file( self.helper.get_param("domain_data_file", "data/chitchat_domain.yml")) domain = domain.merge(self.chitchat_domain, False) return domain
def user_history(self, *args, **kwargs): json_data = json.load( open("tests/testing_data/history/conversation.json")) domain = Domain.from_file("tests/testing_data/initial/domain.yml") return (DialogueStateTracker.from_dict( "5e564fbcdcf0d5fad89e3acd", json_data['events'], domain.slots).as_dialogue().events)
async def get_response(self, request): """Train the engine. """ if self.config.get('domain') is None: self.config.setdefault( 'domain', Domain.from_file("data/" + self.config['skill-id'] + "/core/model")) self.config.setdefault( 'tracker_store', ArcusTrackerStore(self.config.get('domain'), self.asm)) domain = self.config.get('domain') tracker_store = self.config.get('tracker_store') nlg = NaturalLanguageGenerator.create(None, domain) policy_ensemble = SimplePolicyEnsemble.load("data/" + self.config['skill-id'] + "/core") interpreter = LocalNLUInterpreter(request) url = 'http://localhost:8080/api/v1/skill/generic_action' processor = MessageProcessor(interpreter, policy_ensemble, domain, tracker_store, nlg, action_endpoint=EndpointConfig(url), message_preprocessor=None) message_nlu = UserMessage(request['text'], None, request['user'], input_channel=request['channel']) result = await processor.handle_message(message_nlu) if result is not None and len(result) > 0: return {"text": result[0]['text']} else: _LOGGER.info(result) return {"text": "error"}
def get_tracker_and_domain_data(self, *args, **kwargs): domain = Domain.from_file("tests/testing_data/initial/domain.yml") return domain, MongoTrackerStore( domain, host="mongodb://192.168.100.140:27019")
async def get_domain(self) -> Domain: # domain_as_yaml = self.get_content("domain.yml") # return Domain.from_yaml(domain_as_yaml) return Domain.from_file("domain.yml")