code: def get_prompt_from_messages(
      messages,
      model="mistralai/Mistral-7B-Instruct-v0.1",
      system_prompt=None,
  ):
      from transformers import AutoTokenizer
  
      tokenizer = AutoTokenizer.from_pretrained(model)
      if system_prompt:
          messages = [
              {"role": "system", "content": system_prompt}
          ] + messages
  
      # add_generation_prompt=True somehow only required for Yi
      prompt = tokenizer.apply_chat_template(
          messages, tokenize=False, add_generation_prompt=True
      )
      return prompt
  
file_path: h2ogpt/tests/test_prompter.py
imports: import time
  import pytest
  from tests.utils import wrap_test_forked
  from src.enums import source_prefix, source_postfix
  from src.prompter import generate_prompt
label_desc: Use image node_id 4 for calling a global function with example usage: get_prompt_from_messages(messages, model, system_prompt) and returns: prompt