class_docstr: Basic tests on the util functions in TorchAgent.
class_docstr_tok: ["Basic","tests","on","the","util","functions","in","TorchAgent","."]
docstr: Test if conversation history is destroyed in MTurk mode.
docstr_tok: ["Test","if","conversation","history","is","destroyed","in","MTurk","mode","."]
code: def test_interactive_mode(self):
      """
      Test if conversation history is destroyed in MTurk mode.
      """
      # both manually setting bs to 1 and interactive mode true
      agent = get_agent(batchsize=1, interactive_mode=True)
      agent.observe(Message({"text": "foo", "episode_done": True}))
      response = agent.act()
      self.assertIn(
          "Evaluating 0",
          response["text"],
          "Incorrect output in single act()",
      )
      shared = create_agent_from_shared(agent.share())
      shared.observe(Message({"text": "bar", "episode_done": True}))
      response = shared.act()
      self.assertIn(
          "Evaluating 0",
          response["text"],
          "Incorrect output in single act()",
      )
  
      # now just bs 1
      agent = get_agent(batchsize=1, interactive_mode=False)
      agent.observe(Message({"text": "foo", "episode_done": True}))
      response = agent.act()
      self.assertIn(
          "Evaluating 0",
          response["text"],
          "Incorrect output in single act()",
      )
      shared = create_agent_from_shared(agent.share())
      shared.observe(Message({"text": "bar", "episode_done": True}))
      response = shared.act()
      self.assertIn(
          "Evaluating 0",
          response["text"],
          "Incorrect output in single act()",
      )
  
      # now just interactive
      shared = create_agent_from_shared(agent.share())
      agent.observe(Message({"text": "foo", "episode_done": True}))
      response = agent.act()
      self.assertIn(
          "Evaluating 0",
          response["text"],
          "Incorrect output in single act()",
      )
      shared = create_agent_from_shared(agent.share())
      shared.observe(Message({"text": "bar", "episode_done": True}))
      response = shared.act()
      self.assertIn(
          "Evaluating 0",
          response["text"],
          "Incorrect output in single act()",
      )
  
      # finally, actively attempt to sabotage
      agent = get_agent(batchsize=16, interactive_mode=False)
      agent.observe(Message({"text": "foo", "episode_done": True}))
      response = agent.act()
      self.assertIn(
          "Evaluating 0",
          response["text"],
          "Incorrect output in single act()",
      )
      shared = create_agent_from_shared(agent.share())
      shared.observe(Message({"text": "bar", "episode_done": True}))
      response = shared.act()
      self.assertIn(
          "Evaluating 0",
          response["text"],
          "Incorrect output in single act()",
      )
  
imports: import os
  import unittest
  from parlai.core.agents import create_agent_from_shared
  from parlai.utils.testing import tempdir
  from parlai.utils.misc import Message
label_desc: Use image node_id 16 for calling the TestTorchAgent obj's underlying member method code with example usage: obj.test_interactive_mode() without return types