code: def _set_text_vec(self, obs, history, truncate):
      if "text" not in obs:
          return obs
  
      if "text_vec" not in obs:
          fields = []
          dialogue_history = history.get_history_str()
          if "chosen_topic" in obs:
              fields += [obs["title"]]
          if "checked_sentence" in obs:
              fields += [TOKEN_KNOWLEDGE, obs["checked_sentence"]]
          if dialogue_history:
              fields += [TOKEN_DIALOG, dialogue_history]
          obs["text"] = " ".join(fields)
          obs["text_vec"] = self.dict.txt2vec(obs["text"])
  
      # check truncation
      if "text_vec" in obs:
          obs["text_vec"] = th.LongTensor(
              self._check_truncate(obs["text_vec"], truncate, True)
          )
  
      return obs
  
imports: from typing import Optional
  from parlai.core.params import ParlaiParser
  from parlai.core.opt import Opt
  from itertools import chain
  from functools import lru_cache
  import torch
  import numpy
  from parlai.utils.torch import padded_tensor
  from parlai.utils.misc import round_sigfigs
  from parlai.agents.transformer.transformer import TransformerGeneratorAgent
  from .modules import EndToEndModel
  from parlai.tasks.wizard_of_wikipedia.agents import TOKEN_KNOWLEDGE
label_desc: Use image node_id 2 for calling the TwoStageAgent obj's underlying member method code with example usage: obj._set_text_vec(obs, history, truncate) and returns: obs, obs