class_docstr: Modular agent mixin.
  
  Provides shared functionality across modular agents (seeker, BB3)
docstr: Search Query Generator batch act.
  
  :param observations:
      list of observations
  :param search_indices:
      list of batch indices for which search is required.
  
  :return batch_reply:
      return the batch reply from the search query agent
docstr_tok: ["Search","Query","Generator","batch","act",".",":","param","observations",":","list","of","observations",":","param","search_indices",":","list","of","batch","indices","for","which","search","is","required",".",":","return","batch_reply",":","return","the","batch","reply","from","the","search","query","agent"]
code: def batch_act_search_query_generation(
      self,
      observations: Any,
      search_query_generation_observations: List[Message],
      search_indices: List[int],
      search_query_agent: Agent,
      search_knowledge_agent: Agent,
      inject_query_string: str,
  ) -> List[Message]:
      """
      Search Query Generator batch act.
  
      :param observations:
          list of observations
      :param search_indices:
          list of batch indices for which search is required.
  
      :return batch_reply:
          return the batch reply from the search query agent
      """
      batch_reply = [Message({}) for _ in range(len(observations))]
      search_queries = []
      if search_indices:
          batch_replies_with_search = search_query_agent.batch_act(
              [
                  o
                  for i, o in enumerate(
                      search_query_generation_observations
                  )
                  if i in search_indices
              ]
          )
          for i, reply in zip(
              search_indices, batch_replies_with_search
          ):
              batch_reply[i] = reply
          search_queries = [o.get("text", "") for o in batch_reply]
          if inject_query_string:
              for i in range(len(search_queries)):
                  if search_queries[i]:
                      new_query = " ".join(
                          [search_queries[i], inject_query_string]
                      )
                      search_queries[i] = new_query
                      batch_reply[i].force_set("text", new_query)
          logging.debug(f"Search Queries: {search_queries}")
      try:
          search_knowledge_agent.model_api.set_search_queries(
              search_queries
          )
      except AttributeError:
          # Gold Documents, most likely
          pass
  
      return batch_reply
  
file_path: ParlAI/projects/seeker/agents/modular_agent.py
imports: from abc import ABC
  from typing import Dict, Any, List
  from parlai.core.agents import Agent
  from parlai.core.build_data import modelzoo_path
  from parlai.core.message import Message
  from parlai.core.opt import Opt
  from parlai.core.loader import load_agent_module
  import parlai.utils.logging
label_desc: Use image node_id 3 for calling the ModularAgentMixin obj's underlying member method code with example usage: obj.batch_act_search_query_generation(observations, search_query_generation_observations, search_indices, search_query_agent, search_knowledge_agent, inject_query_string) and returns: batch_reply