class_docstr: World for recording a person's question and answer given a context.
  
  Assumes the context is a random context from a given task, e.g. from SQuAD, CBT,
  etc.
class_docstr_tok: ["World","for","recording","a","person","'s","question","and","answer","given","a","context",".","Assumes","the","context","is","a","random","context","from","a","given","task",",","e.g",".","from","SQuAD",",","CBT",",","etc","."]
code: def parley(self):
      # Each turn starts from the QA Collector agent
      self.turn_index = (self.turn_index + 1) % 2
      ad = {"episode_done": False}
      ad["id"] = self.__class__.collector_agent_id
  
      if self.turn_index == 0:
          # At the first turn, the QA Collector agent provides the context
          # and prompts the person to ask a question regarding the context
  
          # Get context from SQuAD teacher agent
          qa = self.task.act()
          context = "\n".join(qa["text"].split("\n")[:-1])
  
          # Wrap the context with a prompt telling the person what to do next
          ad["text"] = (
              context
              + "\n\nPlease provide a question given this context."
          )
  
          self.agent.observe(validate(ad))
          self.question = self.agent.act()
          while self.question is None:
              self.question = self.agent.act()
          # Can log the person's question here
  
      if self.turn_index == 1:
          # At the second turn, the QA Collector collects the person's
          # question from the first turn, and then prompts the
          # person to provide the answer
  
          # A prompt telling the person what to do next
          ad[
              "text"
          ] = "Thanks. And what is the answer to your question?"
  
          ad["episode_done"] = True  # end of episode
  
          self.agent.observe(validate(ad))
          self.answer = self.agent.act()
          while self.answer is None:
              self.answer = self.agent.act()
          # Can log the person's answer here
  
          self.episodeDone = True
  
file_path: ParlAI/parlai/chat_service/tasks/qa_data_collection/worlds.py
imports: from parlai.core.worlds import World, validate
  from parlai.chat_service.services.messenger.worlds import SimpleMessengerOverworld, OnboardWorld
  import importlib
label_desc: Use image node_id 4 for calling the QADataCollectionTaskWorld obj's underlying member method code with example usage: obj.parley() without return types