LLM_TEMPLATE = "### Instruction:\n\n{instruction}\n\n### Response:\n\n" def messages_to_prompt(messages): message_str = "\n".join([str(x) for x in messages]) prompt = LLM_TEMPLATE.format(instruction=message_str) return prompt def completion_to_prompt(completion): prompt = LLM_TEMPLATE.format(instruction=completion) return completion