class_docstr: Serving examples for use with projects.style_gen.classifier:ClassifierAgent.
  
  This teacher will replace message['text'] with a concatenation of the last utterance
  in message['text'] and message['labels'][0], and it will replace message['labels']
  with [message['personality']]. This is to allow for training/evaluation of
  projects.style_gen.classifier:ClassifierAgent, which typically classifies the style
  of an utterance given that utterance and the previous one as context.
  
  Because the dialogue history is effectively overwritten by this action, all episodes
  will be flattened into one example each.
class_docstr_tok: ["Serving","examples","for","use","with","projects.style_gen.classifier",":","ClassifierAgent",".","This","teacher","will","replace","message","[","'text","'","]","with","a","concatenation","of","the","last","utterance","in","message","[","'text","'","]","and","message","[","'labels","'","]","[","0","]",",","and","it","will","replace","message","[","'labels","'","]","with","[","message","[","'personality","'","]","]",".","This","is","to","allow","for","training\/evaluation","of","projects.style_gen.classifier",":","ClassifierAgent",",","which","typically","classifies","the","style","of","an","utterance","given","that","utterance","and","the","previous","one","as","context",".","Because","the","dialogue","history","is","effectively","overwritten","by","this","action",",","all","episodes","will","be","flattened","into","one","example","each","."]
docstr: Edit the fields of the action manually.
docstr_tok: ["Edit","the","fields","of","the","action","manually","."]
code: def _edit_action(self, act: Message) -> Message:
      """
      Edit the fields of the action manually.
      """
      if "labels" in act:
          labels = act["labels"]
          if len(labels) != 1:
              raise ValueError(
                  f"{type(self).__name__} can only be used with one label!"
              )
          assert "\n" not in labels[0]
          # Classifier will not expect more than 1 newline in context
          act.force_set(
              "text", act["text"].split("\n")[-1] + "\n" + labels[0]
          )
          act.force_set("labels", [act["personality"]])
      else:
          assert "text" not in act and act["episode_done"] is True
      act.force_set("episode_done", True)  # Clear the dialogue history
      return act
  
imports: import os
  from parlai.core.message import Message
  from parlai.core.opt import Opt
  from parlai.core.teachers import ParlAIDialogTeacher
  from parlai.tasks.style_gen.build import build_personality_list, build_style_labeled_datasets, get_style_labeled_data_folder, TASK_FOLDER_NAME
  from parlai.tasks.wrapper.agents import AbstractWrapperTeacher
label_desc: Use image node_id 1 for calling the PrevCurrUttStyleTeacher obj's underlying member method code with example usage: obj._edit_action(act) and returns: act