class_docstr: Knowledge Teacher.
  
  Input is Context. Target is selected __knowledge__.
class_docstr_tok: ["Knowledge","Teacher",".","Input","is","Context",".","Target","is","selected","__knowledge__","."]
docstr: Various F1 metrics for the generated model response.
docstr_tok: ["Various","F1","metrics","for","the","generated","model","response","."]
code: def custom_evaluation(
      self,
      teacher_action: Message,
      labels: Optional[Tuple[str]],
      model_response: Message,
  ) -> None:
      """
      Various F1 metrics for the generated model response.
      """
      if not model_response.get("text"):
          # No response generated by model.
          return
  
      resp = model_response["text"]
      # F1 metric over the *selected* knowledge.
      self.metrics.add(
          "knowledge_f1_docs",
          F1Metric.compute(resp, teacher_action[CONST.SELECTED_DOCS]),
      )
      self.metrics.add(
          "knowledge_f1_sentences",
          F1Metric.compute(
              resp, teacher_action[CONST.SELECTED_SENTENCES]
          ),
      )
  
      # F1 Metrics over the *retrieved* docs.
      self.metrics.add(
          "f1_retrieved_docs",
          F1Metric.compute(
              resp, " ".join(teacher_action[CONST.RETRIEVED_DOCS])
          ),
      )
      self.metrics.add(
          "max_f1_retrieved_docs",
          F1Metric.compute(resp, teacher_action[CONST.RETRIEVED_DOCS]),
      )
  
      selected_doc_senetences = teacher_action[CONST.SELECTED_DOCS][
          0
      ].split("\n")
      all_doc_senetences = []
      for doc in teacher_action[CONST.RETRIEVED_DOCS]:
          all_doc_senetences.extend(doc.split("\n"))
  
      self.metrics.add(
          "exact_copied_sentences",
          ExactMatchMetric.compute(resp, all_doc_senetences),
      )
      self.metrics.add(
          "max_substring_copied_sentences",
          CopiedSubstringMetric.compute(resp, all_doc_senetences),
      )
      self.metrics.add(
          "max_substring_copied_docs",
          CopiedSubstringMetric.compute(
              resp, teacher_action[CONST.RETRIEVED_DOCS]
          ),
      )
      self.metrics.add(
          "substring_copied_docs",
          CopiedSubstringMetric.compute(
              resp, ["".join(teacher_action[CONST.RETRIEVED_DOCS])]
          ),
      )
      self.metrics.add(
          "max_f1_selected_docs_senetences",
          F1Metric.compute(resp, selected_doc_senetences),
      )
      self.metrics.add(
          "max_f1_docs_senetences",
          F1Metric.compute(resp, all_doc_senetences),
      )
  
      # N-gram matching metrics
      for k in range(1, 5):  # 1..4
          self.metrics.add(
              f"max_bleu_selected_docs_senetences-{k}",
              BleuMetric.compute(resp, selected_doc_senetences, k),
          )
  
      r1, r2, rL = RougeMetric.compute_many(
          resp, selected_doc_senetences
      )
      self.metrics.add("max_rouge_selected_docs_senetences_1", r1)
      self.metrics.add("max_rouge_selected_docs_senetences_2", r2)
      self.metrics.add("max_rouge_selected_docs_senetences_L", rL)
  
imports: from abc import ABC, abstractmethod
  import os
  from typing import Tuple, List, Optional, Any, Dict
  import random
  from parlai.core.message import Message
  from parlai.core.metrics import F1Metric, BleuMetric, RougeMetric, AverageMetric, ExactMatchMetric, normalize_answer
  from parlai.core.opt import Opt
  from parlai.core.params import ParlaiParser
  from parlai.core.teachers import ChunkTeacher, ChunkOutput
  import parlai.tasks.wizard_of_internet.constants
  from parlai.utils.conversations import Conversations
  from parlai.utils.data import DatatypeHelper
  import parlai.utils.logging
  from parlai.tasks.wizard_of_wikipedia.agents import TOKEN_KNOWLEDGE, TOKEN_END_KNOWLEDGE
  from projects.seeker.utils import extract_entities, remove_possible_title_from_text
label_desc: Use image node_id 1 for calling the KnowledgeTeacher obj's underlying member method code with example usage: obj.custom_evaluation(teacher_action, labels, model_response) without return types