# prompt_format.py from __future__ import annotations RESPONSE_TAG = "### Response:" def format_instruction_prompt(instruction: str, inp: str | None = None) -> str: instruction = (instruction or "").strip() inp = (inp or "").strip() if inp is not None else "" if inp: return ( f"### Instruction:\n{instruction}\n\n" f"### Input:\n{inp}\n\n" f"{RESPONSE_TAG}\n" ) else: return ( f"### Instruction:\n{instruction}\n\n" f"{RESPONSE_TAG}\n" )