Pass truncated message as string in ChatMessage when exceeding max prompt size

This commit is contained in:
Saba 2023-06-04 19:33:46 -07:00
parent f6ceb22373
commit f0efe0177e

View file

@ -110,7 +110,7 @@ def generate_chatml_messages_with_context(
logger.debug(
f"Truncate last message to fit within max prompt size of {max_prompt_size[model_name]} supported by {model_name} model:\n {truncated_message}"
)
messages = [ChatMessage(content=[truncated_message], role=last_message.role)]
messages = [ChatMessage(content=truncated_message, role=last_message.role)]
# Return message in chronological order
return messages[::-1]