def __init__(self, world, opts=None, do_heuristic_perception=False): self.world = world self.chat_count = 0 if not opts: opts = Opt() opts.nsp_model_dir = None opts.nsp_data_dir = None opts.nsp_embedding_path = None opts.model_base_path = None opts.QA_nsp_model_path = None opts.ground_truth_data_dir = "" opts.web_app = False opts.no_ground_truth = True super(FakeAgent, self).__init__(opts) self.do_heuristic_perception = do_heuristic_perception self.no_default_behavior = True self.last_task_memid = None pos = (0, 63, 0) if hasattr(self.world, "agent_data"): pos = self.world.agent_data["pos"] self.pos = np.array(pos, dtype="int") self.logical_form = None self.world_interaction_occurred = False self._held_item: IDM = (0, 0) self._look_vec = (1, 0, 0) self._changed_blocks: List[Block] = [] self._outgoing_chats: List[str] = [] CraftAssistAgent.add_self_memory_node(self)
def controller_step(self): if self.logical_form is None: pass CraftAssistAgent.controller_step(self) else: # logical form given directly: # clear the chat buffer self.get_incoming_chats() # use the logical form as given... d = self.logical_form["logical_form"] chatstr = self.logical_form["chatstr"] speaker_name = self.logical_form["speaker"] self.memory.add_chat( self.memory.get_player_by_name(speaker_name).memid, chatstr) obj = self.dialogue_manager.handle_logical_form( speaker_name, d, chatstr) if obj is not None: self.dialogue_manager.dialogue_stack.append(obj) self.logical_form = None
def test_init_agent(self): opts = Opt() opts.no_default_behavior = False opts.semseg_model_path = None opts.geoscorer_model_path = None opts.nsp_model_dir = None opts.nsp_data_dir = None opts.nsp_embedding_path = None opts.model_base_path = None opts.QA_nsp_model_path = None opts.ground_truth_file_path = "" opts.semseg_model_path = "" opts.geoscorer_model_path = "" # test does not instantiate cpp client opts.port = -1 opts.no_default_behavior = False CraftAssistAgent(opts)
def task_step(self): CraftAssistAgent.task_step(self, sleep_time=0)
def test_init_agent(self): CraftAssistAgent()