code: def wrap_prompt(
      self, text_embeds, img_embeds=None, history=None, add_special=True
  ):
      if add_special:
          prompt_segs = [" <|User|>:", f"\n{self.eoh} <|Bot|>:"]
      else:
          prompt_segs = [
              " <|User|>:",
              " <|Bot|>:",
          ]  # used in wrap history
      prompt_seg_embeds = []
      for i, seg in enumerate(prompt_segs):
          if history is not None:
              add_special_tokens = False
          else:
              add_special_tokens = i == 0
          seg_embeds = self.encode_text(
              seg, add_special_tokens=add_special_tokens
          )
          prompt_seg_embeds.append(seg_embeds)
      if img_embeds is None:
          img_embeds = text_embeds.new_empty(
              text_embeds.size(0), 0, text_embeds.size(-1)
          )
      prompt_seg_embeds = [
          prompt_seg_embeds[0],
          img_embeds,
          text_embeds,
          prompt_seg_embeds[1],
      ]
      prompt_embeds = torch.cat(prompt_seg_embeds, dim=1)
      if history is not None:
          prompt_embeds = torch.cat([*history, prompt_embeds], dim=1)
      return prompt_embeds
  
imports: import copy
  import os
  import sys
  import contextlib
  import torch.utils.checkpoint
  from torch.nn import LayerNorm
  from torchvision import transforms
  from torchvision.transforms.functional import InterpolationMode
  from PIL import Image
  from .modeling_perceive_sampler import BertConfig, BertLMHeadModel
  from .modeling_vit import *
  from .modeling_InternLM import *
  from .modeling_utils import *
  from transformers.utils import logging
label_desc: Use image node_id 13 for calling the InternLMXComposerForCausalLM obj's underlying member method code with example usage: obj.wrap_prompt(text_embeds, img_embeds, history, add_special) and returns: prompt_embeds