swift-ai-22 / utils.py
AiCoderv2's picture
Deploy Gradio app with multiple files
819ac9a verified
raw
history blame contribute delete
242 Bytes
def format_history(history):
"""Format chat history for the model input."""
formatted = ""
for user_msg, assistant_msg in history:
formatted += f"User: {user_msg}\nAssistant: {assistant_msg}\n"
return formatted.strip()