class_docstr: SeeKeR Agent.
  
  One module performs search query generation, knowledge response generation,
  and dialogue response generation.
  
  Additionally, may also perform search decision generation.
  
  To provide arguments to a sub-agent, simply prepend the argument with one of
  `sdm/sqm/krm/drm`.
class_docstr_tok: ["SeeKeR","Agent",".","One","module","performs","search","query","generation",",","knowledge","response","generation",",","and","dialogue","response","generation",".","Additionally",",","may","also","perform","search","decision","generation",".","To","provide","arguments","to","a","sub-agent",",","simply","prepend","the","argument","with","one","of","`","sdm\/sqm\/krm\/drm","`","."]
code: def __init__(self, opt, shared=None):
      self.id = "SeekerAgent"
      self.opt = opt
      one_model = opt.get("all_model_path") or opt.get("model_file")
      assert one_model, "Must specify a model file for this agent."
      for k in [
          "knowledge_",
          "dialogue_",
          "search_query_",
          "search_decision_",
      ]:
          opt[f"{k}response_model_path"] = one_model
      if opt["search_server"]:
          opt["krm_search_server"] = opt["search_server"]
          if "override" in opt:
              opt["override"]["krm_search_server"] = opt[
                  "search_server"
              ]
  
      self._construct_subagent_opts(opt)
      self.search_query_agent = None
      self.search_decision_agent = None
  
      if not shared:
          self.knowledge_agent = create_agent(
              self.opts["knowledge_agent"], requireModelExists=True
          )
          logging.verbose("options for knowledge agent")
          if logging.logger.isEnabledFor(logging.VERBOSE):
              self.knowledge_agent.opt.log()
      else:
          self.knowledge_agent = create_agent_from_shared(
              shared["knowledge_agent_share"]
          )
      self.knowledge_responses = ["__SILENCE__"]
  
      # Monkey-patch 1: KRM Context Blocking (include knowledge responses)
      if opt["include_knowledge_in_krm_context_blocking"]:
          orig_fun = self.knowledge_agent._get_batch_context
          if opt["exclude_context_in_krm_context_blocking"]:
              self.knowledge_agent._get_batch_context = MethodType(
                  lambda self, batch: krm_get_batch_context_only_knowledge(
                      self, batch, orig_fun
                  ),
                  self.knowledge_agent,
              )
          else:
              self.knowledge_agent._get_batch_context = MethodType(
                  lambda self, batch: krm_get_batch_context(
                      self, batch, orig_fun
                  ),
                  self.knowledge_agent,
              )
  
      # Monkey-patch 2: DRM Context Blocking (exclude knowledge responses)
      self.dialogue_agent = self._init_shared_model("dialogue_agent")
      if opt["beam_disregard_knowledge_for_context_blocking"]:
          orig_fun = self.dialogue_agent._get_batch_context
          self.dialogue_agent._get_batch_context = MethodType(
              lambda self, batch: drm_get_batch_context(
                  self, batch, orig_fun=orig_fun
              ),
              self.dialogue_agent,
          )
  
      # Shared Agents
      self.search_query_agent = self._init_shared_model(
          "search_query_agent"
      )
      self.search_decision_agent = self._init_shared_model(
          "search_decision_agent"
      )
  
      self.dialogue_agent_clones = [self.dialogue_agent]
      if not shared:
          # the main agent needs batchsize-many clones for handling history during batch act.
          self.dialogue_agent_clones += [
              self.dialogue_agent.clone()
              for _ in range(opt.get("batchsize", 1) - 1)
          ]
  
      self._init_mutators(opt)
  
      # Other Attrs
      self.search_decision = SearchDecision(opt["search_decision"])
      self.min_knowledge_length_when_search = opt[
          "min_knowledge_length_when_search"
      ]
      self.inject_query_string = opt.get("inject_query_string", "")
  
      super().__init__(opt, shared)
  
imports: from collections import defaultdict
  import copy
  import torch
  from types import MethodType
  from typing import List, Tuple, Optional, Dict, Any
  from parlai.agents.bart.bart import BartAgent
  from parlai.agents.fid.fid import FidAgent, GoldDocRetrieverFiDAgent, SearchQuerySearchEngineFiDAgent, WizIntGoldDocRetrieverFiDAgent
  from parlai.agents.rag.args import setup_rag_args
  from parlai.agents.rag.retrievers import Document
  from parlai.core.agents import Agent, create_agent_from_shared, create_agent
  from parlai.core.message import Message
  from parlai.core.mutators import MessageMutator, Mutator
  from parlai.core.params import ParlaiParser
  from parlai.core.opt import Opt
  from parlai.core.torch_agent import Batch, Output, History
  from parlai.core.torch_generator_agent import TorchGeneratorAgent
  from parlai.tasks.wizard_of_wikipedia.agents import TOKEN_KNOWLEDGE, TOKEN_END_KNOWLEDGE
  import parlai.utils.logging
  from projects.seeker.agents.seeker_modules import ComboFidModel
  from projects.seeker.utils import SearchDecision, drm_get_batch_context, krm_get_batch_context, krm_get_batch_context_only_knowledge, GENERATE_QUERY, IS_SEARCH_REQUIRED, DO_SEARCH, DO_NOT_SEARCH
  from projects.seeker.agents.modular_agent import ModularAgentMixin
label_desc: Use image node_id 4 to create a new SeekerAgent object from inherited base classes: ModularAgentMixin with example: obj = SeekerAgent(opt, shared)