class_docstr: Basic tests on the util functions in TorchAgent.
class_docstr_tok: ["Basic","tests","on","the","util","functions","in","TorchAgent","."]
docstr: Test temp_history when provided via a field in the observation.
docstr_tok: ["Test","temp_history","when","provided","via","a","field","in","the","observation","."]
code: def test_temp_history_observe(self):
      """
      Test temp_history when provided via a field in the observation.
      """
      agent = get_agent(
          dict_file="zoo:unittest/transformer_generator2/model.dict"
      )
      obs = agent.observe(
          {
              "text": "1 2 3",
              "temp_history": "4 5 6",
              "episode_done": False,
          }
      )
      assert len(obs["text_vec"]) == 6
      assert obs["full_text"] == "1 2 34 5 6"
      obs = agent.observe(
          {"text": "1 2 3", "temp_history": "6", "episode_done": False}
      )
      assert len(obs["text_vec"]) == 7
      assert obs["full_text"] == "1 2 3\n1 2 36"
      obs = agent.observe({"text": "1 2 3", "episode_done": False})
      assert len(obs["text_vec"]) == 9
      assert obs["full_text"] == "1 2 3\n1 2 3\n1 2 3"
  
      # make sure temp history is forgotten after a reset
      obs = agent.observe(
          {"text": "1 2 3", "temp_history": "4", "episode_done": True}
      )
      assert len(obs["text_vec"]) == 13
      assert obs["full_text"] == "1 2 3\n1 2 3\n1 2 3\n1 2 34"
      agent.act()  # get that self-observe in
  
      obs = agent.observe({"text": "1 2 3", "episode_done": True})
      assert len(obs["text_vec"]) == 3
      assert obs["full_text"] == "1 2 3"
      agent.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 11 for calling the TestTorchAgent obj's underlying member method code with example usage: obj.test_temp_history_observe() without return types