class_docstr: Drops out '__retrieved-docs__' to only keep a maximum number in each example.
code: def message_mutation(self, message: Message) -> Message:
      if CONST.RETRIEVED_DOCS not in message:
          return message
      new_message = message.copy()
      docs = message.get(CONST.RETRIEVED_DOCS)
      new_docs = []
      max_chunks = self.opt.get("woi_doc_max_chunks", 100)
      if max_chunks > 0:
          keep = torch.randperm(len(docs))[0:max_chunks]
      else:
          keep = torch.randperm(len(docs))
      remove = torch.ones(len(docs))
      remove[keep] = 0
  
      for i in range(len(docs)):
          if remove[i] == 0:
              new_docs.append(docs[i])
          else:
              # We may still keep the doc if it contains the gold checked sentence(s).
              checked_sentences = message.get(
                  CONST.SELECTED_SENTENCES,
                  message.get(
                      "labels", [CONST.NO_SELECTED_SENTENCES_TOKEN]
                  ),
              )
              d = docs[i]
              found = False
              if (
                  " ".join(checked_sentences)
                  != CONST.NO_SELECTED_SENTENCES_TOKEN
              ):
                  for sent in checked_sentences:
                      s = sent.lstrip(" ").rstrip(" ")
                      if s in d:
                          found = True
              if found:
                  new_docs.append(docs[i])
  
      new_message.force_set(CONST.RETRIEVED_DOCS, new_docs)
      return new_message
  
imports: import torch
  from parlai.core.mutators import register_mutator, MessageMutator, ManyEpisodeMutator
  from typing import Optional
  from parlai.core.opt import Opt
  from parlai.core.message import Message
  from parlai.core.params import ParlaiParser
  import parlai.tasks.wizard_of_internet.constants
  from parlai.tasks.wizard_of_wikipedia.mutators import AddLabel, AddLabelLM, CheckedSentenceAsLabel, AddCheckedSentence
label_desc: Use image node_id 2 for calling the WoiDropoutRetrievedDocs obj's underlying member method code with example usage: obj.message_mutation(message) and returns: new_message, message