def main(): random.seed(42) # Get command line arguments parser = ParlaiParser(True, True) RemoteAgentAgent.add_cmdline_args(parser) opt = parser.parse_args() remote = RemoteAgentAgent(opt) if opt.get('task'): world = create_task(opt, [remote]) else: if opt.get('model'): local = create_agent(opt) else: local = LocalHumanAgent(opt) # the remote-host goes **second** agents = [local, remote] if not opt['remote_host'] else [remote, local] world = DialogPartnerWorld(opt, agents) # Talk to the remote agent with world: while True: world.parley() logger.info(world.display())
def main(): random.seed(42) # Get command line arguments parser = ParlaiParser(True, True) RemoteAgentAgent.add_cmdline_args(parser) opt = parser.parse_args() remote = RemoteAgentAgent(opt) if opt.get('task'): world = create_task(opt, [remote]) else: if opt.get('model'): local = create_agent(opt) else: local = LocalHumanAgent(opt) # the remote-host goes **second** agents = [local, remote] if not opt['remote_host'] else [remote, local] world = DialogPartnerWorld(opt, agents) # Talk to the remote agent with world: while True: world.parley() print(world.display())
def _init_chat(self, chat): """ Create new chat for new dialog. Chat consists of new instance of ConvAIAgent, new instance of your own Agent and new instance DialogPartnerWorld where this two agents will communicate. Information about class of your local agent getting from shared data. :param chat: chat id :return: tuple with instances of ConvAIAgent, your local agent, DialogPartnerWorld """ agent_info = self.shared["agents"][0] # Add refs to current world instance and chat id to agent 'opt' parameter if 'opt' not in agent_info.keys() or agent_info['opt'] is None: agent_info['opt'] = {} agent_info['opt']['convai_world'] = self agent_info['opt']['convai_chat'] = chat local_agent = create_agent_from_shared(agent_info) remote_agent = ConvAIAgent({'chat': chat}) world = DialogPartnerWorld({'task': 'ConvAI Dialog'}, [remote_agent, local_agent]) self.chats[chat] = (remote_agent, local_agent, world) return self.chats[chat]