} for a, p in zip(agent.domain.action_names, probabilities)] return jsonify({ "scores": scores, "policy": policy, "tracker": tracker.current_state(verbosity) }) return app if __name__ == '__main__': # Running as standalone python application from rasa_core import run arg_parser = run.create_argument_parser() cmdline_args = arg_parser.parse_args() logging.getLogger('werkzeug').setLevel(logging.WARN) logging.getLogger('matplotlib').setLevel(logging.WARN) utils.configure_colored_logging(cmdline_args.loglevel) utils.configure_file_logging(cmdline_args.loglevel, cmdline_args.log_file) logger.warning("USING `rasa_core.server` is deprecated and will be " "removed in the future. Use `rasa_core.run --enable_api` " "instead.") logger.info("Rasa process starting") _endpoints = AvailableEndpoints.read_endpoints(cmdline_args.endpoints)
request_params, agent.domain.slots) policy_ensemble = agent.policy_ensemble probabilities = policy_ensemble.probabilities_using_best_policy(tracker, agent.domain) probability_dict = {agent.domain.action_for_index(idx, agent.action_endpoint).name(): probability for idx, probability in enumerate(probabilities)} return jsonify(probability_dict) return app if __name__ == '__main__': # Running as standalone python application from rasa_core import run arg_parser = run.create_argument_parser() cmdline_args = arg_parser.parse_args() logging.getLogger('werkzeug').setLevel(logging.WARN) logging.getLogger('matplotlib').setLevel(logging.WARN) utils.configure_colored_logging(cmdline_args.loglevel) utils.configure_file_logging(cmdline_args.loglevel, cmdline_args.log_file) logger.warning("USING `rasa_core.server` is deprecated and will be " "removed in the future. Use `rasa_core.run --enable_api` " "instead.") logger.info("Rasa process starting")