class_docstr: Methods for agents that return style from their histories.
class_docstr_tok: ["Methods","for","agents","that","return","style","from","their","histories","."]
docstr: Conditionally return a style-token string to temporarily insert into history.
docstr_tok: ["Conditionally","return","a","style-token","string","to","temporarily","insert","into","history","."]
code: def get_temp_history(self, observation: Message) -> Optional[str]:
      """
      Conditionally return a style-token string to temporarily insert into history.
      """
      use_style_rand = random.random()
      if use_style_rand < self.use_style_frac:
          # Use the style
          style = observation.get("personality")
          # This key name is dependent on Image-Chat and will change for other tasks.
          # If obs does not contain 'personality' (i.e. at the end of an epoch during
          # validation), there will be no style
      else:
          style = ""
      if style is not None and style != "":
          return STYLE_SEP_TOKEN + style
  
imports: from parlai.core.params import ParlaiParser
  import random
  from typing import List, Optional
  import numpy
  import torch
  from torch import nn
  from parlai.agents.transformer.modules import TransformerDecoder, TransformerGeneratorModel
  from parlai.core.agents import Agent
  from parlai.core.message import Message
  from parlai.core.opt import Opt
  from parlai.core.torch_classifier_agent import ConfusionMatrixMetric, WeightedF1Metric
  from parlai.utils.misc import warn_once
label_desc: Use image node_id 3 for calling the StyleAgentMixin obj's underlying member method code with example usage: obj.get_temp_history(observation) and returns: unknown