class_docstr: Gold knowledge FiD agent for the Wizard of Internet task.
class_docstr_tok: ["Gold","knowledge","FiD","agent","for","the","Wizard","of","Internet","task","."]
code: def get_retrieved_knowledge(self, message: Message):
      retrieved_docs = []
      if not message.get(consts.RETRIEVED_DOCS):
          return retrieved_docs
  
      # First adding the docs with selected sentences.
      selected_sentences = message[consts.SELECTED_SENTENCES]
      n_docs_in_message = len(message[consts.RETRIEVED_DOCS])
      already_added_doc_idx = []
  
      if (
          " ".join(selected_sentences)
          == consts.NO_SELECTED_SENTENCES_TOKEN
      ):
          return (
              retrieved_docs  # `retrieved_docs` is empty at this point
          )
  
      for doc_idx in range(n_docs_in_message):
          doc_content = message[consts.RETRIEVED_DOCS][doc_idx]
          for sel_sentc in selected_sentences:
              if (
                  sel_sentc in doc_content
                  and doc_idx not in already_added_doc_idx
              ):
                  retrieved_docs.append(
                      self._extract_doc_from_message(message, doc_idx)
                  )
                  already_added_doc_idx.append(doc_idx)
                  break
          if len(retrieved_docs) == self._n_docs and doc_idx != (
              self._n_docs - 1
          ):
              logging.warning(
                  f"More than {self._n_docs} documents have selected sentences. Trimming them to the first {self._n_docs}"
              )
              break
  
      # Then adding other (filler) docs.
      # We add them by iterating forward in the __retrieved-docs__ list for repeatability,
      # but we shuffle the order of the final retruned docs, to make sure model doesn't cheat.
      for doc_idx in range(n_docs_in_message):
          if len(retrieved_docs) == self._n_docs:
              break
  
          if doc_idx in already_added_doc_idx:
              continue
  
          retrieved_docs.append(
              self._extract_doc_from_message(message, doc_idx)
          )
  
      if n_docs_in_message > len(retrieved_docs):
          logging.debug(
              f"Trimmed retrieved docs from {n_docs_in_message} to {len(retrieved_docs)}"
          )
      random.shuffle(retrieved_docs)
      return retrieved_docs
  
imports: from abc import abstractmethod
  from copy import deepcopy
  import torch
  import random
  from typing import Tuple, Union, Optional, List, Dict, Any
  from parlai.core.dict import DictionaryAgent
  from parlai.core.opt import Opt
  from parlai.core.message import Message
  from parlai.agents.transformer.transformer import TransformerGeneratorModel
  from parlai.agents.rag.args import RetrieverType
  from parlai.agents.rag.modules import RagModel, Document, T5RagModel
  from parlai.agents.rag.rag import RagAgent
  from parlai.agents.rag.model_types import RagToken, get_forced_decoder_inputs, fix_incremental_state
  from parlai.utils.typing import TShared
  import parlai.utils.logging
  from parlai.tasks.wizard_of_internet import constants
label_desc: Use image node_id 2 for calling the WizIntGoldDocRetrieverFiDAgent obj's underlying member method code with example usage: obj.get_retrieved_knowledge(message) and returns: retrieved_docs, retrieved_docs, retrieved_docs