mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-05 21:29:11 +00:00
Pass truncated message as string in ChatMessage when exceeding max prompt size
This commit is contained in:
@@ -110,7 +110,7 @@ def generate_chatml_messages_with_context(
|
|||||||
logger.debug(
|
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}"
|
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 message in chronological order
|
||||||
return messages[::-1]
|
return messages[::-1]
|
||||||
|
|||||||
Reference in New Issue
Block a user