code: def generate_prompt(
      data_point,
      prompt_type,
      prompt_dict,
      reduced,
      making_context,
      system_prompt=None,
      histi=-1,
  ):
      context = data_point.get("context")
      if context is None:
          context = ""
      instruction = data_point.get("instruction")
      input = data_point.get("input")
      output = data_point.get("output")
      prompt_type = data_point.get("prompt_type", prompt_type)
      prompt_dict = data_point.get("prompt_dict", prompt_dict)
      assert prompt_type in prompt_types, (
          "Bad prompt type: %s" % prompt_type
      )
      (
          promptA,
          promptB,
          PreInstruct,
          PreInput,
          PreResponse,
          terminate_response,
          chat_sep,
          chat_turn_sep,
          humanstr,
          botstr,
          generates_leading_space,
          system_prompt,
          can_handle_system_prompt,
      ) = get_prompt(
          prompt_type,
          prompt_dict,
          context,
          reduced,
          making_context,
          system_prompt=system_prompt,
          histi=histi,
      )
  
      # could avoid if reduce=True, but too complex for parent functions to handle
      prompt = context
  
      if input and promptA:
          prompt += f"""{promptA}"""
      elif promptB:
          prompt += f"""{promptB}"""
  
      if (
          instruction
          and PreInstruct is not None
          and input
          and PreInput is not None
      ):
          prompt += f"""{PreInstruct}{instruction}{PreInput}{input}"""
          prompt = inject_chatsep(
              prompt_type, prompt, chat_sep=chat_sep
          )
      elif (
          instruction
          and input
          and PreInstruct is None
          and PreInput is not None
      ):
          prompt += f"""{PreInput}{instruction}
  {input}"""
          prompt = inject_chatsep(
              prompt_type, prompt, chat_sep=chat_sep
          )
      elif (
          input
          and instruction
          and PreInput is None
          and PreInstruct is not None
      ):
          prompt += f"""{PreInstruct}{instruction}
  {input}"""
          prompt = inject_chatsep(
              prompt_type, prompt, chat_sep=chat_sep
          )
      elif instruction and PreInstruct is not None:
          prompt += f"""{PreInstruct}{instruction}"""
          prompt = inject_chatsep(
              prompt_type, prompt, chat_sep=chat_sep
          )
      elif input and PreInput is not None:
          prompt += f"""{PreInput}{input}"""
          prompt = inject_chatsep(
              prompt_type, prompt, chat_sep=chat_sep
          )
      elif input and instruction and PreInput is not None:
          prompt += f"""{PreInput}{instruction}{input}"""
          prompt = inject_chatsep(
              prompt_type, prompt, chat_sep=chat_sep
          )
      elif input and instruction and PreInstruct is not None:
          prompt += f"""{PreInstruct}{instruction}{input}"""
          prompt = inject_chatsep(
              prompt_type, prompt, chat_sep=chat_sep
          )
      elif input and instruction:
          # i.e. for simple_instruct
          prompt += f"""{instruction}: {input}"""
          prompt = inject_chatsep(
              prompt_type, prompt, chat_sep=chat_sep
          )
      elif input:
          prompt += f"""{input}"""
          prompt = inject_chatsep(
              prompt_type, prompt, chat_sep=chat_sep
          )
      elif instruction:
          prompt += f"""{instruction}"""
          prompt = inject_chatsep(
              prompt_type, prompt, chat_sep=chat_sep
          )
  
      if PreResponse is not None:
          prompt += f"""{PreResponse}"""
          pre_response = PreResponse  # Don't use strip
      else:
          pre_response = ""
  
      if output:
          prompt += f"""{output}"""
  
      return (
          prompt,
          pre_response,
          terminate_response,
          chat_sep,
          chat_turn_sep,
      )
  
file_path: h2ogpt/src/prompter.py
imports: import ast
  import time
  from enums import PromptType, gpt_token_mapping, anthropic_mapping, google_mapping, mistralai_mapping
label_desc: Use image node_id 2 for calling a global function with example usage: generate_prompt(data_point, prompt_type, prompt_dict, reduced, making_context, system_prompt, histi) and returns: prompt,  pre_response,  terminate_response,  chat_sep,  chat_turn_sep